From 0d025b824e43d30a7d67886f774af9a54355fade Mon Sep 17 00:00:00 2001 From: Steve Biedermann Date: Sun, 18 Oct 2026 20:21:07 +0200 Subject: [PATCH] ci(github): package client and server for Windows, Linux and macOS Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/package.yml | 82 ++++++++++++++++++++++++++++ .github/workflows/windows-client.yml | 47 ---------------- CHANGELOG.md | 2 + README.md | 5 ++ 4 files changed, 89 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/package.yml delete mode 100644 .github/workflows/windows-client.yml diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 0000000..50e0be6 --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,82 @@ +# Builds the client and server for every platform and packs everything needed to +# run them into an archive: a zip on Windows and a tar.gz elsewhere. +name: Package + +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: + package: + name: Package ${{ matrix.target }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - { os: windows-latest, target: x86_64-pc-windows-msvc } + - { os: ubuntu-latest, target: x86_64-unknown-linux-gnu } + - { os: macos-latest, target: aarch64-apple-darwin } + steps: + - uses: actions/checkout@v4 + + - name: Install Linux dependencies + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + pkg-config libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - name: Cache cargo + uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} + + - name: Pack client and server + run: cargo xtask pack --target ${{ matrix.target }} + + - name: Upload archive + uses: actions/upload-artifact@v4 + with: + name: station-${{ matrix.target }} + path: | + dist/station-*.zip + dist/station-*.tar.gz + if-no-files-found: error + # The archive is already compressed. + compression-level: 0 + + release: + name: Publish release + if: startsWith(github.ref, 'refs/tags/v') + needs: package + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/download-artifact@v4 + with: + path: dist + merge-multiple: true + + - uses: softprops/action-gh-release@v2 + with: + files: | + dist/station-*.zip + dist/station-*.tar.gz diff --git a/.github/workflows/windows-client.yml b/.github/workflows/windows-client.yml deleted file mode 100644 index 687b22f..0000000 --- a/.github/workflows/windows-client.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Windows package - -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 package - 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: Pack client and server - run: cargo xtask pack --target x86_64-pc-windows-msvc - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: station-windows - path: dist/station-*/ - if-no-files-found: error - - - name: Publish release - if: startsWith(github.ref, 'refs/tags/v') - uses: softprops/action-gh-release@v2 - with: - files: dist/station-*.zip diff --git a/CHANGELOG.md b/CHANGELOG.md index 380c351..b0161f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,3 +20,5 @@ based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). console window. - `cargo xtask pack` builds the client and server and packs them with their assets into a distributable archive; CI publishes these archives. +- GitHub `Package` workflow builds archives for Windows (zip), Linux and macOS + (tar.gz). diff --git a/README.md b/README.md index ccc07be..f79f37e 100644 --- a/README.md +++ b/README.md @@ -199,3 +199,8 @@ stripped `dist` profile and writes `dist/station--.zip` (Window and the changelog. Unpack it and run the binaries from that directory. The unpacked staging directory is kept next to the archive. Options: `--format zip|tar.gz`, `--out-dir DIR`, `--debug`. + +The GitHub `Package` workflow (`.github/workflows/package.yml`) runs `pack` for Windows +(zip), Linux and macOS (tar.gz), uploads each archive as an artifact and attaches them +to the release when a `v*` tag is pushed. The Gitea workflow cross-compiles the Windows +package with MinGW.