Compare commits
1
Commits
v0.3.1
...
b65658bda0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b65658bda0
|
@@ -70,15 +70,32 @@ jobs:
|
||||
cli:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: catthehacker/ubuntu:rust-latest
|
||||
# Bundles the Rust toolchain, zig and a macOS SDK, which the generic builder images lack;
|
||||
# we cross-compile every target from here with cargo-zigbuild.
|
||||
image: ghcr.io/rust-cross/cargo-zigbuild:latest
|
||||
strategy:
|
||||
fail-fast: true
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target:
|
||||
- aarch64-unknown-linux-musl
|
||||
- x86_64-pc-windows-gnu
|
||||
- x86_64-unknown-linux-musl
|
||||
- universal2-apple-darwin
|
||||
env:
|
||||
RUSTUP_HOME: /usr/local/rustup
|
||||
CARGO_HOME: /usr/local/cargo
|
||||
steps:
|
||||
# JavaScript actions need node, which the rust-cross image does not ship. Install it (and the
|
||||
# rest of the tooling the actions rely on) before anything else, as a shell step.
|
||||
- name: Install Actions tooling
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends ca-certificates curl git zip zstd
|
||||
if ! command -v node > /dev/null; then
|
||||
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
|
||||
apt-get install -y --no-install-recommends nodejs
|
||||
fi
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
@@ -89,19 +106,19 @@ jobs:
|
||||
key: rustup-cli-${{ matrix.target }}-${{ runner.os }}
|
||||
|
||||
- name: Install Rust Toolchain
|
||||
run: rustup target install ${{ matrix.target }}
|
||||
run: |
|
||||
rustup target install ${{ matrix.target }}
|
||||
# cargo-zigbuild builds both architectures and merges them for the universal binary.
|
||||
if [[ "${{ matrix.target }}" == universal2-apple-darwin ]]; then
|
||||
rustup target install aarch64-apple-darwin x86_64-apple-darwin
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Cache cargo
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
shared-key: cli-${{ matrix.target }}
|
||||
|
||||
- name: Cache zigbuild install
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /opt/zigvenv
|
||||
key: zigbuild-venv-${{ runner.os }}
|
||||
|
||||
# compiled libc/compiler-rt are per target, so these stay keyed on it
|
||||
- name: Cache zig build artifacts
|
||||
uses: actions/cache@v4
|
||||
@@ -111,13 +128,6 @@ jobs:
|
||||
~/.cache/cargo-zigbuild
|
||||
key: zigbuild-cache-${{ matrix.target }}-${{ runner.os }}
|
||||
|
||||
- name: Install cargo-zigbuild Toolchain
|
||||
run: |
|
||||
# venv keeps cargo-zigbuild and ziglang in one relocatable-by-path directory we can cache
|
||||
[ -d /opt/zigvenv ] || python3 -m venv /opt/zigvenv
|
||||
/opt/zigvenv/bin/pip install cargo-zigbuild
|
||||
echo /opt/zigvenv/bin >> "$GITHUB_PATH"
|
||||
|
||||
- name: Build cli (${{ matrix.target }})
|
||||
working-directory: cli
|
||||
run: cargo zigbuild --release --target ${{ matrix.target }}
|
||||
|
||||
Reference in new issue
Block a user