The Forgejo runner needs Node.js for actions/checkout@v4. catthehacker/ubuntu:act-latest has Node.js pre-installed. Also install Rust in the workflow since the base image doesn't have it. Build triggers on main + feat/* branches now. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
83 lines
2.2 KiB
YAML
83 lines
2.2 KiB
YAML
name: Build Release Binaries
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- 'feat/*'
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
build-amd64:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: catthehacker/ubuntu:act-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Rust + dependencies
|
|
run: |
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
source "$HOME/.cargo/env"
|
|
apt-get update && apt-get install -y cmake pkg-config libasound2-dev ninja-build
|
|
rustc --version
|
|
|
|
- name: Cache cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: cargo-amd64-${{ hashFiles('Cargo.lock') }}
|
|
restore-keys: cargo-amd64-
|
|
|
|
- name: Build relay + tools
|
|
run: |
|
|
source "$HOME/.cargo/env"
|
|
cargo build --release --bin wzp-relay --bin wzp-client --bin wzp-bench --bin wzp-web
|
|
|
|
- name: Run tests
|
|
run: |
|
|
source "$HOME/.cargo/env"
|
|
cargo test --workspace --lib
|
|
|
|
- name: Package
|
|
run: |
|
|
mkdir -p dist/wzp-linux-amd64
|
|
cp target/release/wzp-relay dist/wzp-linux-amd64/
|
|
cp target/release/wzp-client dist/wzp-linux-amd64/
|
|
cp target/release/wzp-web dist/wzp-linux-amd64/
|
|
cp target/release/wzp-bench dist/wzp-linux-amd64/
|
|
cp -r crates/wzp-web/static dist/wzp-linux-amd64/ 2>/dev/null || true
|
|
cd dist && tar czf wzp-linux-amd64.tar.gz wzp-linux-amd64/
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: wzp-linux-amd64
|
|
path: dist/wzp-linux-amd64.tar.gz
|
|
|
|
release:
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
needs: [build-amd64]
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: catthehacker/ubuntu:act-latest
|
|
steps:
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Create release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: artifacts/**/*.tar.gz
|
|
generate_release_notes: true
|