From 9ffca14d8da3e75a37ed23259b1e61414c5b5a94 Mon Sep 17 00:00:00 2001 From: Steve Biedermann Date: Sun, 18 Oct 2026 19:44:13 +0200 Subject: [PATCH] ci: build the Windows client on GitHub and Gitea GitHub builds natively on windows-latest; Gitea cross-compiles with MinGW on a Linux runner. Both upload the client with its assets and publish a zip for v* tags. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .gitea/workflows/windows-client.yml | 69 ++++++++++++++++++++++++++++ .github/workflows/windows-client.yml | 61 ++++++++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 .gitea/workflows/windows-client.yml create mode 100644 .github/workflows/windows-client.yml diff --git a/.gitea/workflows/windows-client.yml b/.gitea/workflows/windows-client.yml new file mode 100644 index 0000000..3c87463 --- /dev/null +++ b/.gitea/workflows/windows-client.yml @@ -0,0 +1,69 @@ +# Gitea Actions: cross-compiles the Windows client on a Linux runner with MinGW, +# since most Gitea runners are Linux containers. +name: Windows client + +on: + push: + branches: [main] + tags: ["v*"] + pull_request: + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 + TARGET: x86_64-pc-windows-gnu + +jobs: + build: + name: Build Windows client + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install MinGW + run: | + SUDO=$(command -v sudo || true) + $SUDO apt-get update + $SUDO apt-get install -y --no-install-recommends gcc-mingw-w64-x86-64 zip + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ env.TARGET }} + + - name: Cache cargo + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: windows-gnu-${{ hashFiles('Cargo.lock') }} + restore-keys: windows-gnu- + + - name: Build + run: cargo build --release --locked -p game_client --bin game --target "$TARGET" + + - name: Package + run: | + dist=dist/station-windows + mkdir -p "$dist" + cp "target/$TARGET/release/game.exe" "$dist/" + cp -r assets README.md "$dist/" + (cd dist && zip -qr station-windows.zip station-windows) + + # Gitea does not support upload-artifact v4. + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: station-windows + path: dist/station-windows + if-no-files-found: error + + - name: Publish release + if: startsWith(github.ref, 'refs/tags/v') + uses: https://gitea.com/actions/release-action@main + with: + files: dist/station-windows.zip + api_key: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/windows-client.yml b/.github/workflows/windows-client.yml new file mode 100644 index 0000000..fe145b6 --- /dev/null +++ b/.github/workflows/windows-client.yml @@ -0,0 +1,61 @@ +name: Windows client + +on: + push: + branches: [main] + tags: ["v*"] + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 + +jobs: + build: + name: Build Windows client + runs-on: windows-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + + - name: Cache cargo + uses: Swatinem/rust-cache@v2 + + - name: Build + run: cargo build --release --locked -p game_client --bin game + + - name: Package + shell: pwsh + run: | + $dist = "dist/station-windows" + New-Item -ItemType Directory -Force -Path $dist | Out-Null + Copy-Item target/release/game.exe $dist/ + Copy-Item -Recurse assets $dist/assets + Copy-Item README.md $dist/ + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: station-windows + path: dist/station-windows + if-no-files-found: error + + - name: Create release archive + if: startsWith(github.ref, 'refs/tags/v') + shell: pwsh + run: Compress-Archive -Path dist/station-windows/* -DestinationPath dist/station-windows.zip + + - name: Publish release + if: startsWith(github.ref, 'refs/tags/v') + uses: softprops/action-gh-release@v2 + with: + files: dist/station-windows.zip