vestige/.github/workflows/ci.yml
Sam Valladares f08f1f9fe0 fix(ci): add the cross-compile target to the pinned toolchain
The rust-toolchain.toml pin added in the previous commit broke the Intel Mac
release build: dtolnay/rust-toolchain@stable installs the target for stable,
but cargo then runs the pinned 1.97.1, which has no x86_64-apple-darwin std,
so the build failed with 'can't find crate for core'.

Add an explicit 'rustup target add' step after the toolchain install in both
ci.yml and release.yml. It runs in the repo, so it targets the pinned
toolchain. release.yml needed it too: without this the real release build
would have failed at tag time on Windows and Intel Mac.

Verified locally: reproduced the missing target on the pinned toolchain,
applied the fix, then cargo check -p vestige-mcp --target x86_64-apple-darwin
with the full Intel Mac release feature set exits 0.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 01:09:25 +08:00

129 lines
4.5 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Pin macOS to macos-14 (Sonoma): the rolling `macos-latest` image
# The "ld: library 'clang_rt.osx' not found" failure is NOT a flaky
# image. It is the linker resolving a clang compiler-rt search path
# (Xcode .../clang/<N>/lib/darwin) that no longer exists on the runner,
# because a STALE `target/` was restored from the cache after the
# runner image's default Xcode moved. The real fix is the cache change
# below (we no longer cache `target/`, and the key is bumped to v2 to
# discard the poisoned caches), so the runner choice is no longer
# load-bearing. macos-latest is fine again with a clean target dir.
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache cargo (registry only)
uses: actions/cache@v4
with:
# Deliberately NOT caching `target/`: a `target/` built against a
# different Xcode carries a stale clang compiler-rt search path that
# breaks the linker ("clang_rt.osx not found"). Cache only the
# download-heavy registry/git dirs; recompiling is cheap and correct.
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-v2-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-v2-
- name: Check
run: cargo check --workspace
- name: Clippy
run: cargo clippy --workspace -- -D warnings
- name: Test
run: cargo test --workspace
- name: Test paid cloud-sync path
run: cargo test --locked --package vestige-core --features cloud-sync cloud --lib
release-build:
name: Release Build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
# Run on main pushes AND on PRs that touch workflows, Cargo manifests, or
# crate sources — so Intel Mac / Linux release targets are validated
# before merge, not after.
if: |
github.ref == 'refs/heads/main' ||
github.event_name == 'pull_request'
needs: [test]
strategy:
fail-fast: false
matrix:
include:
- os: macos-14
target: aarch64-apple-darwin
cargo_flags: ""
# Intel Mac builds against a system ONNX Runtime via ort-dynamic
# (ort-sys has no x86_64-apple-darwin prebuilts). Compile-only here;
# runtime linking is a user concern documented in INSTALL-INTEL-MAC.md.
- os: macos-14
target: x86_64-apple-darwin
cargo_flags: "--no-default-features --features ort-dynamic,vector-search,cloud-sync"
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
cargo_flags: ""
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
# rust-toolchain.toml pins the toolchain, so cargo runs the pinned version
# rather than the stable one the action installed. Add the cross-compile
# target to the pinned toolchain too, or the build fails with
# "can't find crate for `core`".
- name: Add target to the pinned toolchain
run: rustup target add ${{ matrix.target }}
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build release
run: cargo build --release --target ${{ matrix.target }} -p vestige-mcp ${{ matrix.cargo_flags }}
- name: Package
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../vestige-mcp-${{ matrix.target }}.tar.gz vestige-mcp vestige vestige-restore
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: vestige-mcp-${{ matrix.target }}
path: vestige-mcp-${{ matrix.target }}.tar.gz