Files
triangles_v5/.github/workflows/build-all.yml
T
sami7777 5ad0bb53b4
Build All Platforms / test-linux-unit (push) Waiting to run
Build All Platforms / build-windows-qt (push) Waiting to run
Build All Platforms / build-windows-daemon (push) Waiting to run
Build All Platforms / build-linux-qt (push) Waiting to run
Build All Platforms / build-linux-daemon (push) Waiting to run
Build All Platforms / build-macos (push) Waiting to run
Build All Platforms / release (push) Blocked by required conditions
Derive release VERSION from clientversion.h instead of hardcoding
Build jobs extract MAJOR.MINOR.REVISION from src/clientversion.h.
Release job extracts from the git tag name. No more forgetting to
update the workflow when bumping versions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 22:38:37 -07:00

337 lines
10 KiB
YAML

name: Build All Platforms
on:
push:
branches: [master]
tags: ['v*']
pull_request:
branches: [master]
workflow_dispatch:
jobs:
test-linux-unit:
runs-on: ubuntu-22.04
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libboost-all-dev \
libssl-dev libdb++-dev libleveldb-dev libevent-dev libminiupnpc-dev
- name: Build LevelDB
run: |
cd src/leveldb
chmod +x build_detect_platform
make clean || true
make OPT="-O2" libleveldb.a libmemenv.a
- name: Build and run unit tests
run: |
cd src
make -f makefile.unix test -j$(nproc)
./test_triangles --log_level=test_suite 2>&1 || true
build-windows-qt:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-qt5-base
mingw-w64-x86_64-qt5-tools
mingw-w64-x86_64-boost
mingw-w64-x86_64-openssl
mingw-w64-x86_64-db
mingw-w64-x86_64-libevent
mingw-w64-x86_64-miniupnpc
make
- name: Create Qt5 tool symlinks
run: |
ln -sf /mingw64/bin/qmake-qt5.exe /mingw64/bin/qmake.exe 2>/dev/null || true
ln -sf /mingw64/bin/lrelease-qt5.exe /mingw64/bin/lrelease.exe 2>/dev/null || true
ln -sf /mingw64/bin/windeployqt-qt5.exe /mingw64/bin/windeployqt.exe 2>/dev/null || true
- name: Clean stale build artifacts
run: rm -rf build/*.o build/*.h
- name: Build LevelDB
run: |
cd src/leveldb
make clean || true
CC=gcc CXX=g++ TARGET_OS=OS_WINDOWS_CROSSCOMPILE make OPT="-fno-keep-inline-dllexport -march=nocona -msahf -mtune=generic -Wa,-mbig-obj -O2" libleveldb.a libmemenv.a
- name: Run qmake
run: |
qmake triangles-qt.pro "RELEASE=1"
- name: Build
run: |
make -j$(nproc)
- name: Package
run: |
mkdir -p dist
cp release/triangles-qt.exe dist/
windeployqt dist/triangles-qt.exe || true
# Copy runtime DLLs
for dll in libgcc_s_seh-1.dll libstdc++-6.dll libwinpthread-1.dll; do
cp /mingw64/bin/$dll dist/ 2>/dev/null || true
done
- name: Strip binary
run: strip --strip-all dist/triangles-qt.exe
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-qt
path: dist/
build-windows-daemon:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-boost
mingw-w64-x86_64-openssl
mingw-w64-x86_64-db
mingw-w64-x86_64-libevent
mingw-w64-x86_64-miniupnpc
make
- name: Build LevelDB
run: |
cd src/leveldb
make clean || true
CC=gcc CXX=g++ TARGET_OS=OS_WINDOWS_CROSSCOMPILE make OPT="-fno-keep-inline-dllexport -march=nocona -msahf -mtune=generic -Wa,-mbig-obj -O2" libleveldb.a libmemenv.a
- name: Build daemon
run: |
set -eo pipefail
cd src
mkdir -p obj
make -f makefile.mingw DEPSDIR=/mingw64 all -j$(nproc) 2>&1
strip --strip-all trianglesd.exe
cp trianglesd.exe ../trianglesd.exe
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-daemon
path: trianglesd.exe
build-linux-qt:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set VERSION from source
run: |
MAJOR=$(grep 'CLIENT_VERSION_MAJOR' src/clientversion.h | awk '{print $3}')
MINOR=$(grep 'CLIENT_VERSION_MINOR' src/clientversion.h | awk '{print $3}')
REV=$(grep 'CLIENT_VERSION_REVISION' src/clientversion.h | awk '{print $3}')
echo "VERSION=${MAJOR}.${MINOR}.${REV}" >> $GITHUB_ENV
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential qt5-qmake qtbase5-dev \
qttools5-dev-tools libboost-all-dev libssl-dev libdb++-dev \
libleveldb-dev libevent-dev libminiupnpc-dev
- name: Build LevelDB
run: |
cd src/leveldb
chmod +x build_detect_platform
make clean || true
make OPT="-O2" libleveldb.a libmemenv.a
- name: Clean stale build artifacts
run: rm -rf build/*.o
- name: Run qmake
run: qmake triangles-qt.pro "RELEASE=1"
- name: Build
run: make -j$(nproc)
- name: Strip binary
run: strip --strip-all triangles-qt
- name: Rename
run: mv triangles-qt Cryptographic-Triangles-v${VERSION}-linux-x64-qt
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-qt
path: Cryptographic-Triangles-v*-linux-x64-qt
build-linux-daemon:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set VERSION from source
run: |
MAJOR=$(grep 'CLIENT_VERSION_MAJOR' src/clientversion.h | awk '{print $3}')
MINOR=$(grep 'CLIENT_VERSION_MINOR' src/clientversion.h | awk '{print $3}')
REV=$(grep 'CLIENT_VERSION_REVISION' src/clientversion.h | awk '{print $3}')
echo "VERSION=${MAJOR}.${MINOR}.${REV}" >> $GITHUB_ENV
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libboost-all-dev \
libssl-dev libdb++-dev libleveldb-dev libevent-dev libminiupnpc-dev
- name: Build LevelDB
run: |
cd src/leveldb
chmod +x build_detect_platform
make clean || true
make OPT="-O2" libleveldb.a libmemenv.a
- name: Build daemon
run: |
cd src
mkdir -p obj
make -f makefile.unix trianglesd -j$(nproc)
- name: Strip binary
run: strip --strip-all src/trianglesd
- name: Rename
run: mv src/trianglesd Cryptographic-Triangles-v${VERSION}-linux-x64-daemon
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-daemon
path: Cryptographic-Triangles-v*-linux-x64-daemon
build-macos:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- name: Set VERSION from source
run: |
MAJOR=$(grep 'CLIENT_VERSION_MAJOR' src/clientversion.h | awk '{print $3}')
MINOR=$(grep 'CLIENT_VERSION_MINOR' src/clientversion.h | awk '{print $3}')
REV=$(grep 'CLIENT_VERSION_REVISION' src/clientversion.h | awk '{print $3}')
echo "VERSION=${MAJOR}.${MINOR}.${REV}" >> $GITHUB_ENV
- name: Install dependencies
run: |
brew install qt@5 openssl@3 boost berkeley-db@5 leveldb libevent miniupnpc
- name: Clean stale build artifacts
run: rm -rf build/*.o build/*.h
- name: Build LevelDB
run: |
cd src/leveldb
chmod +x build_detect_platform
make clean || true
CC=clang CXX=clang++ make OPT="-O2" libleveldb.a libmemenv.a
- name: Run qmake
run: |
export PATH="/opt/homebrew/opt/qt@5/bin:$PATH"
qmake triangles-qt.pro -spec macx-clang \
"BOOST_INCLUDE_PATH=/opt/homebrew/opt/boost/include" \
"BOOST_LIB_PATH=/opt/homebrew/opt/boost/lib" \
"BDB_INCLUDE_PATH=/opt/homebrew/opt/berkeley-db@5/include" \
"BDB_LIB_PATH=/opt/homebrew/opt/berkeley-db@5/lib" \
"BDB_LIB_SUFFIX=" \
"OPENSSL_INCLUDE_PATH=/opt/homebrew/opt/openssl@3/include" \
"OPENSSL_LIB_PATH=/opt/homebrew/opt/openssl@3/lib" \
"MINIUPNPC_INCLUDE_PATH=/opt/homebrew/opt/miniupnpc/include" \
"MINIUPNPC_LIB_PATH=/opt/homebrew/opt/miniupnpc/lib" \
"EVENT_INCLUDE_PATH=/opt/homebrew/opt/libevent/include" \
"EVENT_LIB_PATH=/opt/homebrew/opt/libevent/lib" \
"RELEASE=1"
- name: Build
run: |
export PATH="/opt/homebrew/opt/qt@5/bin:$PATH"
make -j$(sysctl -n hw.ncpu)
- name: Create .app bundle
run: |
export PATH="/opt/homebrew/opt/qt@5/bin:$PATH"
macdeployqt Triangles-Qt.app -verbose=1
- name: Create DMG
run: |
mkdir -p dmg_contents
cp -R Triangles-Qt.app dmg_contents/
ln -s /Applications dmg_contents/Applications
hdiutil create -volname "Cryptographic Triangles" \
-srcfolder dmg_contents \
-ov -format UDZO \
"Cryptographic-Triangles-v${VERSION}-macos-arm64.dmg"
- name: Upload DMG
uses: actions/upload-artifact@v4
with:
name: macos-arm64-dmg
path: "*.dmg"
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [build-windows-qt, build-windows-daemon, build-linux-qt, build-linux-daemon, build-macos]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Set VERSION from tag
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release assets
run: |
mkdir -p release
# Windows
cd artifacts/windows-qt && zip -r ../../release/Cryptographic-Triangles-${VERSION}-win-x64.zip . && cd ../..
cp artifacts/windows-qt/triangles-qt.exe release/Cryptographic-Triangles-${VERSION}-win-x64-qt.exe
cp artifacts/windows-daemon/trianglesd.exe release/Cryptographic-Triangles-${VERSION}-win-x64-daemon.exe
# Linux
cp artifacts/linux-qt/Cryptographic-Triangles-* release/
cp artifacts/linux-daemon/Cryptographic-Triangles-* release/
# macOS
cp artifacts/macos-arm64-dmg/*.dmg release/
ls -la release/
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: release/*
generate_release_notes: true