Files
Dylan M. Taylor ca6100634b ci: use StepSecurity's maintained actions (#183)
Each third-party action that StepSecurity publishes a secure drop-in
replacement for now uses that replacement, pinned to a commit with its
version as a comment. Versions follow what we used: the newest
StepSecurity release in the same major, or the closest major they
publish. dtolnay/rust-toolchain refs that named a toolchain (stable,
nightly, 1.76) become the replacement's `toolchain` input.
2026-11-11 14:57:14 -05:00

100 lines
4.0 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
permissions:
contents: read
concurrency:
# Pull requests share one group per branch, so a newer push cancels the older run. Every other
# run (main, manual) gets its own group: it is never cancelled or replaced while queued, so it
# always gets to save the cache.
group: ci-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
lint:
name: fmt, clippy, wasm
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: python3 -m unittest discover -s tools/mutation -p 'test_*.py'
- run: python3 -m unittest discover -s tools/intake -p 'test_*.py'
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: stable
components: clippy, rustfmt
targets: wasm32-unknown-unknown
- uses: step-security/rust-cache@8871c8ba063416da7c32246932ea6ae08700453e # v2.9.2
with:
# Save from main only; pull requests restore main's cache. Each pull request saved its own
# 0.6-1.3 GB copy per job, which only that pull request can restore.
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo fmt --all --check
# Same gate as craft-libs. Every lib.rs denies unwrap, expect and panic in shipped code.
- run: cargo clippy --workspace --all-targets --locked -- -D warnings
# The model crate promises to compile for wasm.
- run: cargo check -p craft-ai-core --target wasm32-unknown-unknown --locked
# So does the tool catalogue, which a web launcher reads.
- run: cargo check -p craft-ai-features --target wasm32-unknown-unknown --locked
test:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install software Vulkan renderer for kittest snapshots
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y mesa-vulkan-drivers libvulkan1
# kittest prefers a CPU adapter. Mesa supplies lavapipe for headless Vulkan;
# selecting Vulkan avoids relying on a display-backed GL adapter.
# Windows and macOS keep their existing graphics backends.
echo 'WGPU_BACKEND=vulkan' >> "$GITHUB_ENV"
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: stable
- uses: step-security/rust-cache@8871c8ba063416da7c32246932ea6ae08700453e # v2.9.2
with:
# Save from main only; pull requests restore main's cache. Each pull request saved its own
# 0.6-1.3 GB copy per job, which only that pull request can restore.
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo test --workspace --locked
deny:
name: advisories, licences, sources
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: EmbarkStudios/cargo-deny-action@3c6349835b2b7b196a839186cb8b78e02f7b5f25 # v2
with:
command: check advisories licenses sources