Skip to content

fix: use mlugg/setup-zig@v2 (v1 does not exist) #40

fix: use mlugg/setup-zig@v2 (v1 does not exist)

fix: use mlugg/setup-zig@v2 (v1 does not exist) #40

Workflow file for this run

name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
# ── Test matrix: build + test on all supported platforms ──────────────
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest, macos-13]
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Install Zig
uses: mlugg/setup-zig@v2
with:
version: 0.16.0
- name: Build native library (Zig)
run: zig build -Doptimize=ReleaseFast
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
- name: Build
run: cargo build --workspace --all-targets
- name: Clippy (deny warnings)
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Test
run: cargo test --workspace --all-targets
# ── Security audit ────────────────────────────────────────────────────
audit:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-audit
run: cargo install cargo-audit --locked
- name: Run cargo-audit
run: cargo audit --ignore RUSTSEC-2026-0235 --ignore RUSTSEC-2025-0141 --ignore RUSTSEC-2024-0436
- name: Run cargo-deny (licenses + advisories)
uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check advisories licenses
# ── Cross-compile verification (no test, just build) ──────────────────
cross-compile:
name: Cross-compile (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
zig-target: aarch64-linux-gnu
- os: macos-latest
target: aarch64-apple-darwin
zig-target: aarch64-macos
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install Zig
uses: mlugg/setup-zig@v2
with:
version: 0.16.0
- name: Install cross-compilation tools (aarch64-linux)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build native library (Zig cross-compile)
run: zig build -Doptimize=ReleaseFast -Dtarget=${{ matrix.zig-target }}
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
key: cross-${{ matrix.target }}
- name: Cross-compile
run: cargo build --release --target ${{ matrix.target }} -p pledgepack-cli
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
# ── npm package dry-run (verify package.json is valid) ────────────────
npm-dry-run:
name: npm pack (dry-run)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 22
- name: npm pack (dry-run)
run: npm pack --dry-run
- name: Verify package contents
run: |
npm pack 2>&1 | tee output.txt
grep -q "bin/pledge.js" output.txt || { echo "ERROR: bin/pledge.js missing from package"; exit 1; }
grep -q "bin/postinstall.js" output.txt || { echo "ERROR: bin/postinstall.js missing from package"; exit 1; }
grep -q "README.md" output.txt || { echo "ERROR: README.md missing from package"; exit 1; }