From 53481e5d25f715e39635fbe657c13848eb27681b Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Sun, 1 Feb 2026 16:15:36 -0800 Subject: [PATCH 1/8] Update workflow name and add uploading GUI artifacts --- .github/workflows/build-cli.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index ac8d555..d49816f 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -1,4 +1,4 @@ -name: Build CLI and test -h +name: Build CLI and GUI and test -h on: push: @@ -233,10 +233,18 @@ jobs: } Add-Content -Path $env:GITHUB_ENV -Value "WESOFORGE_VERSION=$version" - - name: Upload dist artifacts + - name: Upload CLI artifacts if: always() uses: actions/upload-artifact@v4 with: name: WesoForge-cli_${{ matrix.os }}_${{ env.WESOFORGE_VERSION }}_${{ matrix.arch }} - path: dist/* + path: dist/WesoForge-cli_* + if-no-files-found: warn + + - name: Upload GUI artifacts + if: always() + uses: actions/upload-artifact@v4 + with: + name: WesoForge-gui_${{ matrix.os }}_${{ env.WESOFORGE_VERSION }}_${{ matrix.arch }} + path: dist/WesoForge-gui_* if-no-files-found: warn From a798b4bd8de829666dc867709c392465a795a24d Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Sun, 1 Feb 2026 16:43:58 -0800 Subject: [PATCH 2/8] Revert to a single upload step --- .github/workflows/build-cli.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index d49816f..82af5c6 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -233,18 +233,10 @@ jobs: } Add-Content -Path $env:GITHUB_ENV -Value "WESOFORGE_VERSION=$version" - - name: Upload CLI artifacts + - name: Upload dist artifacts if: always() uses: actions/upload-artifact@v4 with: - name: WesoForge-cli_${{ matrix.os }}_${{ env.WESOFORGE_VERSION }}_${{ matrix.arch }} - path: dist/WesoForge-cli_* - if-no-files-found: warn - - - name: Upload GUI artifacts - if: always() - uses: actions/upload-artifact@v4 - with: - name: WesoForge-gui_${{ matrix.os }}_${{ env.WESOFORGE_VERSION }}_${{ matrix.arch }} - path: dist/WesoForge-gui_* + name: WesoForge_${{ matrix.os }}_${{ env.WESOFORGE_VERSION }}_${{ matrix.arch }} + path: dist/ if-no-files-found: warn From 5a095d03ed27f6b03de4936472cba738df078ba0 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Sun, 1 Feb 2026 17:23:43 -0800 Subject: [PATCH 3/8] Ya know, actually upload both GUI and CLI... --- .github/workflows/build-cli.yml | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index 82af5c6..37e4905 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -17,6 +17,8 @@ jobs: env: # Linux: run AppImages without FUSE (extract and run) so downloaded linuxdeploy works in CI APPIMAGE_EXTRACT_AND_RUN: ${{ matrix.os == 'Linux' && '1' || '' }} + # So Package CLI step finds the binary built in the previous step + CARGO_TARGET_DIR: ${{ github.workspace }}/target strategy: fail-fast: false matrix: @@ -160,6 +162,41 @@ jobs: BBR_SKIP_CARGO_BUILD: 1 run: ./build-cli.ps1 + - name: Copy GUI bundles to dist (Linux / macOS) + if: matrix.os != 'Windows' + run: | + VERSION="$WESOFORGE_VERSION" + ARCH="$(uname -m)" + case "$ARCH" in x86_64) ARCH=amd64;; aarch64|arm64) ARCH=arm64;; esac + case "$(uname -s)" in + Linux) + SRC="$(ls -1t target/release/bundle/appimage/*.AppImage 2>/dev/null | head -n 1)" + [ -n "$SRC" ] && cp "$SRC" "dist/WesoForge-gui_Linux_${VERSION}_${ARCH}.AppImage" + ;; + Darwin) + SRC="$(ls -1t target/release/bundle/dmg/*.dmg 2>/dev/null | head -n 1)" + [ -n "$SRC" ] && cp "$SRC" "dist/WesoForge-gui_macOS_${VERSION}_${ARCH}.dmg" + ;; + esac + + - name: Copy GUI bundles to dist (Windows) + if: matrix.os == 'Windows' + shell: pwsh + run: | + $version = $env:WESOFORGE_VERSION + $arch = "amd64" + $bundleDir = Join-Path $env:CARGO_TARGET_DIR "release\bundle" + $nsisDir = Join-Path $bundleDir "nsis" + $msiDir = Join-Path $bundleDir "msi" + if (Test-Path $nsisDir) { + $exe = Get-ChildItem -Path $nsisDir -Filter "*.exe" | Sort-Object LastWriteTime -Descending | Select-Object -First 1 + if ($exe) { Copy-Item -Force $exe.FullName "dist\WesoForge-gui_Windows_${version}_${arch}.exe" } + } + if (Test-Path $msiDir) { + $msi = Get-ChildItem -Path $msiDir -Filter "*.msi" | Sort-Object LastWriteTime -Descending | Select-Object -First 1 + if ($msi) { Copy-Item -Force $msi.FullName "dist\WesoForge-gui_Windows_${version}_${arch}.msi" } + } + - name: Test -h output (Linux / macOS) if: matrix.os != 'Windows' run: | From 827009ea99073b70f83c4122eaaa254dbbf1e2a4 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Sun, 1 Feb 2026 17:53:33 -0800 Subject: [PATCH 4/8] Refactor to not build so many times and hopefully get our assets --- .github/workflows/build-cli.yml | 37 ++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index 37e4905..7dd5ee8 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -132,21 +132,42 @@ jobs: } Add-Content -Path $env:GITHUB_ENV -Value "WESOFORGE_VERSION=$version" - - name: Install pnpm and Tauri CLI, then build Rust (CLI + GUI once) + - name: Install pnpm and Tauri CLI shell: bash - env: - CARGO_TARGET_DIR: ${{ github.workspace }}/target run: | corepack enable corepack prepare pnpm@latest --activate cargo install tauri-cli pnpm -C ui install - # Build CLI only here; GUI is built by cargo tauri build so its binary has __TAURI_BUNDLE_TYPE - cargo build --release -p bbr-client --features prod-backend + + # Build Rust deps once: tauri build --no-bundle compiles GUI + all shared deps. + # Then build CLI only (reuses deps); then bundle (no recompile). + - name: Build GUI (Rust + frontend, no bundle) — compiles deps once + shell: bash + env: + CARGO_TARGET_DIR: ${{ github.workspace }}/target + run: | + case "$(uname -s)" in + Linux) (cd crates/client-gui && export NO_STRIP=1 && cargo tauri build --no-bundle --features prod-backend) ;; + Darwin) (cd crates/client-gui && cargo tauri build --no-bundle --features prod-backend) ;; + *) (cd crates/client-gui && cargo tauri build --no-bundle --features prod-backend) ;; + esac + + - name: Build CLI only (reuses existing deps) + shell: bash + env: + CARGO_TARGET_DIR: ${{ github.workspace }}/target + run: cargo build --release -p bbr-client --features prod-backend + + - name: Bundle GUI (no recompile) + shell: bash + env: + CARGO_TARGET_DIR: ${{ github.workspace }}/target + run: | case "$(uname -s)" in - Linux) (cd crates/client-gui && export NO_STRIP=1 && cargo tauri build --features prod-backend --bundles appimage) ;; - Darwin) (cd crates/client-gui && cargo tauri build --features prod-backend --bundles dmg) ;; - *) (cd crates/client-gui && cargo tauri build --features prod-backend) ;; + Linux) (cd crates/client-gui && export NO_STRIP=1 && cargo tauri bundle --bundles appimage) ;; + Darwin) (cd crates/client-gui && cargo tauri bundle --bundles dmg) ;; + *) (cd crates/client-gui && cargo tauri bundle) ;; esac - name: Package CLI (Linux / macOS) From 31c28d7e940e72817171e3e3c2e21691ecddc6b2 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Sun, 1 Feb 2026 18:11:09 -0800 Subject: [PATCH 5/8] Revert to using the build scripts and fix an issue on Windows --- .github/workflows/build-cli.yml | 77 ++++--------------------------- crates/client-gui/tauri.conf.json | 3 +- 2 files changed, 10 insertions(+), 70 deletions(-) diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index 7dd5ee8..c311f07 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -140,83 +140,22 @@ jobs: cargo install tauri-cli pnpm -C ui install - # Build Rust deps once: tauri build --no-bundle compiles GUI + all shared deps. - # Then build CLI only (reuses deps); then bundle (no recompile). - - name: Build GUI (Rust + frontend, no bundle) — compiles deps once - shell: bash - env: - CARGO_TARGET_DIR: ${{ github.workspace }}/target - run: | - case "$(uname -s)" in - Linux) (cd crates/client-gui && export NO_STRIP=1 && cargo tauri build --no-bundle --features prod-backend) ;; - Darwin) (cd crates/client-gui && cargo tauri build --no-bundle --features prod-backend) ;; - *) (cd crates/client-gui && cargo tauri build --no-bundle --features prod-backend) ;; - esac - - - name: Build CLI only (reuses existing deps) - shell: bash - env: - CARGO_TARGET_DIR: ${{ github.workspace }}/target - run: cargo build --release -p bbr-client --features prod-backend - - - name: Bundle GUI (no recompile) - shell: bash + - name: Build CLI then GUI (Linux / macOS) + if: matrix.os != 'Windows' env: CARGO_TARGET_DIR: ${{ github.workspace }}/target run: | - case "$(uname -s)" in - Linux) (cd crates/client-gui && export NO_STRIP=1 && cargo tauri bundle --bundles appimage) ;; - Darwin) (cd crates/client-gui && cargo tauri bundle --bundles dmg) ;; - *) (cd crates/client-gui && cargo tauri bundle) ;; - esac + ./build-cli.sh + ./build-gui.sh - - name: Package CLI (Linux / macOS) - if: matrix.os != 'Windows' - env: - BBR_SKIP_CARGO_BUILD: 1 - run: ./build-cli.sh - - - name: Package CLI (Windows) + - name: Build CLI then GUI (Windows) if: matrix.os == 'Windows' shell: pwsh env: - BBR_SKIP_CARGO_BUILD: 1 - run: ./build-cli.ps1 - - - name: Copy GUI bundles to dist (Linux / macOS) - if: matrix.os != 'Windows' - run: | - VERSION="$WESOFORGE_VERSION" - ARCH="$(uname -m)" - case "$ARCH" in x86_64) ARCH=amd64;; aarch64|arm64) ARCH=arm64;; esac - case "$(uname -s)" in - Linux) - SRC="$(ls -1t target/release/bundle/appimage/*.AppImage 2>/dev/null | head -n 1)" - [ -n "$SRC" ] && cp "$SRC" "dist/WesoForge-gui_Linux_${VERSION}_${ARCH}.AppImage" - ;; - Darwin) - SRC="$(ls -1t target/release/bundle/dmg/*.dmg 2>/dev/null | head -n 1)" - [ -n "$SRC" ] && cp "$SRC" "dist/WesoForge-gui_macOS_${VERSION}_${ARCH}.dmg" - ;; - esac - - - name: Copy GUI bundles to dist (Windows) - if: matrix.os == 'Windows' - shell: pwsh + CARGO_TARGET_DIR: ${{ github.workspace }}/target run: | - $version = $env:WESOFORGE_VERSION - $arch = "amd64" - $bundleDir = Join-Path $env:CARGO_TARGET_DIR "release\bundle" - $nsisDir = Join-Path $bundleDir "nsis" - $msiDir = Join-Path $bundleDir "msi" - if (Test-Path $nsisDir) { - $exe = Get-ChildItem -Path $nsisDir -Filter "*.exe" | Sort-Object LastWriteTime -Descending | Select-Object -First 1 - if ($exe) { Copy-Item -Force $exe.FullName "dist\WesoForge-gui_Windows_${version}_${arch}.exe" } - } - if (Test-Path $msiDir) { - $msi = Get-ChildItem -Path $msiDir -Filter "*.msi" | Sort-Object LastWriteTime -Descending | Select-Object -First 1 - if ($msi) { Copy-Item -Force $msi.FullName "dist\WesoForge-gui_Windows_${version}_${arch}.msi" } - } + ./build-cli.ps1 + ./build-gui.ps1 - name: Test -h output (Linux / macOS) if: matrix.os != 'Windows' diff --git a/crates/client-gui/tauri.conf.json b/crates/client-gui/tauri.conf.json index d2e7a46..fb878cc 100644 --- a/crates/client-gui/tauri.conf.json +++ b/crates/client-gui/tauri.conf.json @@ -23,7 +23,8 @@ }, "bundle": { "icon": [ - "icons/icon.png" + "icons/icon.png", + "icons/icon.ico" ] } } From 7e75017f6e5100c8a3b75438389b61b15ec11a49 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Sun, 1 Feb 2026 20:59:52 -0800 Subject: [PATCH 6/8] remove duplicate determine version steps --- .github/workflows/build-cli.yml | 40 --------------------------------- 1 file changed, 40 deletions(-) diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index c311f07..e696c54 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -190,46 +190,6 @@ jobs: if ($output -notmatch "compact proof worker") { throw "Expected -h output to contain 'compact proof worker'" } Write-Host "Help output assertions passed." - - name: Determine version (Linux / macOS) - if: matrix.os != 'Windows' - run: | - VERSION="$(python3 - <<'PY' - import tomllib - with open("Cargo.toml", "rb") as f: - cargo = tomllib.load(f) - print(cargo["workspace"]["package"]["version"]) - PY - )" - if [ -z "${VERSION:-}" ]; then - echo "Failed to determine version from Cargo.toml" >&2 - exit 1 - fi - echo "WESOFORGE_VERSION=$VERSION" >> "$GITHUB_ENV" - - - name: Determine version (Windows) - if: matrix.os == 'Windows' - shell: pwsh - run: | - $inPkg = $false - $version = $null - foreach ($line in Get-Content -LiteralPath "Cargo.toml") { - if ($line -match '^\[workspace\.package\]') { - $inPkg = $true - continue - } - if ($inPkg -and $line -match '^\[') { - $inPkg = $false - } - if ($inPkg -and $line -match '^version\s*=\s*"([^"]+)"') { - $version = $Matches[1] - break - } - } - if ([string]::IsNullOrWhiteSpace($version)) { - throw "Failed to determine version from Cargo.toml" - } - Add-Content -Path $env:GITHUB_ENV -Value "WESOFORGE_VERSION=$version" - - name: Upload dist artifacts if: always() uses: actions/upload-artifact@v4 From 234d79fdb04c5364e8f5466185700c130ec41492 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Sun, 1 Feb 2026 21:17:33 -0800 Subject: [PATCH 7/8] Upload GUI and CLI seperately so we get 8 artifacts instead of 4 .zips --- .github/workflows/build-cli.yml | 199 -------------------------------- 1 file changed, 199 deletions(-) delete mode 100644 .github/workflows/build-cli.yml diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml deleted file mode 100644 index e696c54..0000000 --- a/.github/workflows/build-cli.yml +++ /dev/null @@ -1,199 +0,0 @@ -name: Build CLI and GUI and test -h - -on: - push: - branches: - - main - release: - types: [published] - pull_request: - branches: - - '**' - -jobs: - build-and-test: - name: ${{ matrix.os }} (${{ matrix.arch }}) - runs-on: ${{ matrix.runner }} - env: - # Linux: run AppImages without FUSE (extract and run) so downloaded linuxdeploy works in CI - APPIMAGE_EXTRACT_AND_RUN: ${{ matrix.os == 'Linux' && '1' || '' }} - # So Package CLI step finds the binary built in the previous step - CARGO_TARGET_DIR: ${{ github.workspace }}/target - strategy: - fail-fast: false - matrix: - include: - - os: Linux - runner: ubuntu-latest - arch: amd64 - - os: macOS - runner: macos-latest - arch: arm64 - - os: macOS - runner: macos-15-intel - arch: amd64 - - os: Windows - runner: windows-latest - arch: amd64 - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - components: rustfmt, clippy - - - name: Cache Rust (target + registry) - uses: Swatinem/rust-cache@v2 - with: - shared-key: "rust" - - - name: Setup Node.js (Linux / macOS / Windows, for GUI) - if: matrix.os == 'Linux' || matrix.os == 'macOS' || matrix.os == 'Windows' - uses: actions/setup-node@v4 - with: - node-version: 'lts/*' - - - name: Prepare Linux - if: matrix.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y \ - git curl build-essential clang gawk pkg-config \ - libgmp-dev libboost-all-dev \ - libgtk-3-dev libsoup-3.0-dev libwebkit2gtk-4.1-dev librsvg2-dev - - - name: Prepare macOS - if: matrix.os == 'macOS' - run: | - brew install pkg-config gmp - - - name: Prepare macOS Intel (Boost) - if: matrix.runner == 'macos-15-intel' - run: brew install boost - - - name: Patch chiavdf for GMP 6.3 (macOS Intel) - if: matrix.runner == 'macos-15-intel' - run: git -C chiavdf apply "$GITHUB_WORKSPACE/patches/chiavdf-gmp63-mpz-macro.patch" - - - name: Prepare Windows (MPIR and LLVM) - if: matrix.os == 'Windows' - run: | - git clone https://github.com/Chia-Network/mpir_gc_x64.git chiavdf/mpir_gc_x64 - winget install LLVM.LLVM --accept-package-agreements --accept-source-agreements --silent - - - name: Set Windows PATH for LLVM - if: matrix.os == 'Windows' - run: | - echo "$env:ProgramFiles\LLVM\bin" | Out-File -Append -FilePath $env:GITHUB_PATH - echo "PATH=$env:ProgramFiles\LLVM\bin;$env:PATH" >> $env:GITHUB_ENV - - - name: Determine version (Linux / macOS) - if: matrix.os != 'Windows' - run: | - VERSION="$(python3 - <<'PY' - import tomllib - with open("Cargo.toml", "rb") as f: - cargo = tomllib.load(f) - print(cargo["workspace"]["package"]["version"]) - PY - )" - if [ -z "${VERSION:-}" ]; then - echo "Failed to determine version from Cargo.toml" >&2 - exit 1 - fi - echo "WESOFORGE_VERSION=$VERSION" >> "$GITHUB_ENV" - - - name: Determine version (Windows) - if: matrix.os == 'Windows' - shell: pwsh - run: | - $inPkg = $false - $version = $null - foreach ($line in Get-Content -LiteralPath "Cargo.toml") { - if ($line -match '^\[workspace\.package\]') { - $inPkg = $true - continue - } - if ($inPkg -and $line -match '^\[') { - $inPkg = $false - } - if ($inPkg -and $line -match '^version\s*=\s*"([^"]+)"') { - $version = $Matches[1] - break - } - } - if ([string]::IsNullOrWhiteSpace($version)) { - throw "Failed to determine version from Cargo.toml" - } - Add-Content -Path $env:GITHUB_ENV -Value "WESOFORGE_VERSION=$version" - - - name: Install pnpm and Tauri CLI - shell: bash - run: | - corepack enable - corepack prepare pnpm@latest --activate - cargo install tauri-cli - pnpm -C ui install - - - name: Build CLI then GUI (Linux / macOS) - if: matrix.os != 'Windows' - env: - CARGO_TARGET_DIR: ${{ github.workspace }}/target - run: | - ./build-cli.sh - ./build-gui.sh - - - name: Build CLI then GUI (Windows) - if: matrix.os == 'Windows' - shell: pwsh - env: - CARGO_TARGET_DIR: ${{ github.workspace }}/target - run: | - ./build-cli.ps1 - ./build-gui.ps1 - - - name: Test -h output (Linux / macOS) - if: matrix.os != 'Windows' - run: | - BIN="target/release/wesoforge" - [ -f "$BIN" ] || { echo "Binary not found: $BIN"; exit 1; } - OUTPUT="$("$BIN" -h 2>&1)" - echo "$OUTPUT" - echo "---" - echo "$OUTPUT" | grep -q "WesoForge" || { echo "Expected -h output to contain 'WesoForge'"; exit 1; } - echo "$OUTPUT" | grep -q "Usage" || { echo "Expected -h output to contain 'Usage'"; exit 1; } - echo "$OUTPUT" | grep -q "compact proof worker" || { echo "Expected -h output to contain 'compact proof worker'"; exit 1; } - echo "Help output assertions passed." - - - name: Test -h output (Windows) - if: matrix.os == 'Windows' - shell: pwsh - run: | - # Run from dist/ where MPIR DLLs are; target\release\wesoforge.exe would fail to load without them - $distExe = Get-ChildItem -Path dist -Filter "WesoForge-cli_*.exe" | Select-Object -First 1 - if (-not $distExe) { throw "Binary not found in dist/" } - $bin = $distExe.FullName - # Clap prints -h to stderr; capture both streams so we get the full help text - $outFile = "help-stdout.txt" - $errFile = "help-stderr.txt" - $null = Start-Process -FilePath $bin -ArgumentList "-h" -NoNewWindow -Wait -PassThru -RedirectStandardOutput $outFile -RedirectStandardError $errFile -WorkingDirectory (Split-Path $bin) - $output = (Get-Content $outFile -Raw) + (Get-Content $errFile -Raw) - Write-Host $output - Write-Host "---" - if ($output -notmatch "WesoForge") { throw "Expected -h output to contain 'WesoForge'" } - if ($output -notmatch "Usage") { throw "Expected -h output to contain 'Usage'" } - if ($output -notmatch "compact proof worker") { throw "Expected -h output to contain 'compact proof worker'" } - Write-Host "Help output assertions passed." - - - name: Upload dist artifacts - if: always() - uses: actions/upload-artifact@v4 - with: - name: WesoForge_${{ matrix.os }}_${{ env.WESOFORGE_VERSION }}_${{ matrix.arch }} - path: dist/ - if-no-files-found: warn From f163f9d5285b2230c00988785e30d843762ed747 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Sun, 1 Feb 2026 21:19:22 -0800 Subject: [PATCH 8/8] this time, commit the new file too --- .github/workflows/build-cli-gui.yml | 215 ++++++++++++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 .github/workflows/build-cli-gui.yml diff --git a/.github/workflows/build-cli-gui.yml b/.github/workflows/build-cli-gui.yml new file mode 100644 index 0000000..7a4c497 --- /dev/null +++ b/.github/workflows/build-cli-gui.yml @@ -0,0 +1,215 @@ +name: Build CLI and GUI and test -h + +on: + push: + branches: + - main + release: + types: [published] + pull_request: + branches: + - '**' + +jobs: + build-and-test: + name: ${{ matrix.os }} (${{ matrix.arch }}) + runs-on: ${{ matrix.runner }} + env: + # Linux: run AppImages without FUSE (extract and run) so downloaded linuxdeploy works in CI + APPIMAGE_EXTRACT_AND_RUN: ${{ matrix.os == 'Linux' && '1' || '' }} + # So Package CLI step finds the binary built in the previous step + CARGO_TARGET_DIR: ${{ github.workspace }}/target + strategy: + fail-fast: false + matrix: + include: + - os: Linux + runner: ubuntu-latest + arch: amd64 + - os: macOS + runner: macos-latest + arch: arm64 + - os: macOS + runner: macos-15-intel + arch: amd64 + - os: Windows + runner: windows-latest + arch: amd64 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + + - name: Cache Rust (target + registry) + uses: Swatinem/rust-cache@v2 + with: + shared-key: "rust" + + - name: Setup Node.js (Linux / macOS / Windows, for GUI) + if: matrix.os == 'Linux' || matrix.os == 'macOS' || matrix.os == 'Windows' + uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + + - name: Prepare Linux + if: matrix.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y \ + git curl build-essential clang gawk pkg-config \ + libgmp-dev libboost-all-dev \ + libgtk-3-dev libsoup-3.0-dev libwebkit2gtk-4.1-dev librsvg2-dev + + - name: Prepare macOS + if: matrix.os == 'macOS' + run: | + brew install pkg-config gmp + + - name: Prepare macOS Intel (Boost) + if: matrix.runner == 'macos-15-intel' + run: brew install boost + + - name: Patch chiavdf for GMP 6.3 (macOS Intel) + if: matrix.runner == 'macos-15-intel' + run: git -C chiavdf apply "$GITHUB_WORKSPACE/patches/chiavdf-gmp63-mpz-macro.patch" + + - name: Prepare Windows (MPIR and LLVM) + if: matrix.os == 'Windows' + run: | + git clone https://github.com/Chia-Network/mpir_gc_x64.git chiavdf/mpir_gc_x64 + winget install LLVM.LLVM --accept-package-agreements --accept-source-agreements --silent + + - name: Set Windows PATH for LLVM + if: matrix.os == 'Windows' + run: | + echo "$env:ProgramFiles\LLVM\bin" | Out-File -Append -FilePath $env:GITHUB_PATH + echo "PATH=$env:ProgramFiles\LLVM\bin;$env:PATH" >> $env:GITHUB_ENV + + - name: Determine version (Linux / macOS) + if: matrix.os != 'Windows' + run: | + VERSION="$(python3 - <<'PY' + import tomllib + with open("Cargo.toml", "rb") as f: + cargo = tomllib.load(f) + print(cargo["workspace"]["package"]["version"]) + PY + )" + if [ -z "${VERSION:-}" ]; then + echo "Failed to determine version from Cargo.toml" >&2 + exit 1 + fi + echo "WESOFORGE_VERSION=$VERSION" >> "$GITHUB_ENV" + + - name: Determine version (Windows) + if: matrix.os == 'Windows' + shell: pwsh + run: | + $inPkg = $false + $version = $null + foreach ($line in Get-Content -LiteralPath "Cargo.toml") { + if ($line -match '^\[workspace\.package\]') { + $inPkg = $true + continue + } + if ($inPkg -and $line -match '^\[') { + $inPkg = $false + } + if ($inPkg -and $line -match '^version\s*=\s*"([^"]+)"') { + $version = $Matches[1] + break + } + } + if ([string]::IsNullOrWhiteSpace($version)) { + throw "Failed to determine version from Cargo.toml" + } + Add-Content -Path $env:GITHUB_ENV -Value "WESOFORGE_VERSION=$version" + + - name: Install pnpm and Tauri CLI + shell: bash + run: | + corepack enable + corepack prepare pnpm@latest --activate + cargo install tauri-cli + pnpm -C ui install + + - name: Build CLI then GUI (Linux / macOS) + if: matrix.os != 'Windows' + env: + CARGO_TARGET_DIR: ${{ github.workspace }}/target + run: | + ./build-cli.sh + ./build-gui.sh + + - name: Build CLI then GUI (Windows) + if: matrix.os == 'Windows' + shell: pwsh + env: + CARGO_TARGET_DIR: ${{ github.workspace }}/target + run: | + ./build-cli.ps1 + ./build-gui.ps1 + + - name: Test -h output (Linux / macOS) + if: matrix.os != 'Windows' + run: | + BIN="target/release/wesoforge" + [ -f "$BIN" ] || { echo "Binary not found: $BIN"; exit 1; } + OUTPUT="$("$BIN" -h 2>&1)" + echo "$OUTPUT" + echo "---" + echo "$OUTPUT" | grep -q "WesoForge" || { echo "Expected -h output to contain 'WesoForge'"; exit 1; } + echo "$OUTPUT" | grep -q "Usage" || { echo "Expected -h output to contain 'Usage'"; exit 1; } + echo "$OUTPUT" | grep -q "compact proof worker" || { echo "Expected -h output to contain 'compact proof worker'"; exit 1; } + echo "Help output assertions passed." + + - name: Test -h output (Windows) + if: matrix.os == 'Windows' + shell: pwsh + run: | + # Run from dist/ where MPIR DLLs are; target\release\wesoforge.exe would fail to load without them + $distExe = Get-ChildItem -Path dist -Filter "WesoForge-cli_*.exe" | Select-Object -First 1 + if (-not $distExe) { throw "Binary not found in dist/" } + $bin = $distExe.FullName + # Clap prints -h to stderr; capture both streams so we get the full help text + $outFile = "help-stdout.txt" + $errFile = "help-stderr.txt" + $null = Start-Process -FilePath $bin -ArgumentList "-h" -NoNewWindow -Wait -PassThru -RedirectStandardOutput $outFile -RedirectStandardError $errFile -WorkingDirectory (Split-Path $bin) + $output = (Get-Content $outFile -Raw) + (Get-Content $errFile -Raw) + Write-Host $output + Write-Host "---" + if ($output -notmatch "WesoForge") { throw "Expected -h output to contain 'WesoForge'" } + if ($output -notmatch "Usage") { throw "Expected -h output to contain 'Usage'" } + if ($output -notmatch "compact proof worker") { throw "Expected -h output to contain 'compact proof worker'" } + Write-Host "Help output assertions passed." + + - name: Prepare CLI and GUI artifact dirs + shell: bash + run: | + mkdir -p dist-cli dist-gui + # CLI: binary (and on Windows, MPIR DLLs) + cp -f dist/WesoForge-cli_* dist-cli/ 2>/dev/null || true + cp -f dist/mpir*.dll dist-cli/ 2>/dev/null || true + # GUI: bundle(s) + cp -f dist/WesoForge-gui_* dist-gui/ 2>/dev/null || true + + - name: Upload CLI artifact + uses: actions/upload-artifact@v4 + with: + name: WesoForge-cli_${{ matrix.os }}_${{ env.WESOFORGE_VERSION }}_${{ matrix.arch }} + path: dist-cli/ + if-no-files-found: warn + + - name: Upload GUI artifact + uses: actions/upload-artifact@v4 + with: + name: WesoForge-gui_${{ matrix.os }}_${{ env.WESOFORGE_VERSION }}_${{ matrix.arch }} + path: dist-gui/ + if-no-files-found: warn