Skip to content

ci: add clippy and cargo test gates via self-hosted macOS runner (#14) #14

ci: add clippy and cargo test gates via self-hosted macOS runner (#14)

ci: add clippy and cargo test gates via self-hosted macOS runner (#14) #14

Workflow file for this run

# PR / push CI for lightweight quality gates. Builds and tests are covered by
# release.yml (signed artifacts) and pipeline-parallel-ci.yml (distributed
# runs); this workflow runs cargo-deny (license / advisory), cargo-fmt, and
# cargo-clippy + cargo-test checks on every touched-Rust change so formatting
# drift, license issues, and lint/test regressions are caught at PR time.
#
# Note on CUDA gating: CUDA verification stays exclusive to release.yml because
# it requires a Linux self-hosted runner (currently only the GB10 node used for
# release builds). Adding a PR-level CUDA gate would double runner cost for
# limited additional safety on PRs that don't touch CUDA-specific code paths.
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
rust: ${{ steps.filter.outputs.rust }}
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
rust:
- '**/*.rs'
- '**/Cargo.toml'
- 'Cargo.lock'
- 'deny.toml'
- '.github/workflows/ci.yml'
deny:
name: cargo-deny
needs: changes
if: needs.changes.outputs.rust == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check
log-level: warn
fmt:
name: cargo-fmt
needs: changes
if: needs.changes.outputs.rust == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
clippy-and-test:
name: clippy + test (macOS ARM64)
needs: changes
# Only run when Rust files changed; block fork-PR access to the self-hosted
# runner pool (mirrors the guard in release.yml and pipeline-parallel-ci.yml).
if: >-
needs.changes.outputs.rust == 'true' &&
github.repository == 'lablup/mlxcel' &&
(github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository)
runs-on: self-hosted-macos-26-arm64
permissions:
contents: read
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Build (verify MLX FFI compiles)
run: cargo build --release --features metal,accelerate
- name: Clippy
run: cargo clippy --all-targets --features metal,accelerate -- -D warnings
- name: Test
run: cargo test --release --features metal,accelerate