Files
claude-code-skill-manager/.gitea/workflows/build.yml
T
siujamo 5bef4ef2ee fix(ci): switch to zigbuild for cross-compilation
- Replace cross-rs with Zig toolchain and cargo-zigbuild
- Add rustup target installation step for all platforms
- Include --target flag in native Linux build for consistent output paths

cross-rs has no Docker image for macOS targets and the Windows image
ships with a broken cargo PATH, causing all non-Linux builds to fail.
Zig provides its own cross-linker and ships macOS/Win libc headers,
enabling cross-compilation for all three targets from a single Linux
runner.
2026-06-22 10:37:27 +08:00

72 lines
2.1 KiB
YAML

name: Build
on:
push:
branches: [main]
tags: ["*"]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
binary: ccsm
archive: ccsm-linux-amd64.tar.gz
- target: x86_64-apple-darwin
binary: ccsm
archive: ccsm-darwin-amd64.tar.gz
- target: x86_64-pc-windows-gnu
binary: ccsm.exe
archive: ccsm-windows-amd64.zip
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Install Rust targets
run: |
rustup target add ${{ matrix.target }}
- name: Build (Linux)
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: cargo build --release --target ${{ matrix.target }}
- name: Install Zig
if: matrix.target != 'x86_64-unknown-linux-gnu'
run: |
curl -L -o zig.tar.xz https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz
tar xf zig.tar.xz
echo "$PWD/zig-linux-x86_64-0.13.0" >> "$GITHUB_PATH"
- name: Install cargo-zigbuild
if: matrix.target != 'x86_64-unknown-linux-gnu'
run: cargo install cargo-zigbuild
- name: Build with zigbuild
if: matrix.target != 'x86_64-unknown-linux-gnu'
run: cargo zigbuild --release --target ${{ matrix.target }}
- name: Package
run: |
cd "target/${{ matrix.target }}/release"
if [[ "${{ matrix.target }}" == *-windows-* ]]; then
zip "${{ matrix.archive }}" "${{ matrix.binary }}"
else
tar czf "${{ matrix.archive }}" "${{ matrix.binary }}"
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.archive }}
path: target/${{ matrix.target }}/release/${{ matrix.archive }}