mirror of
https://github.com/storytold/craft-ai-integrations.git
synced 2026-11-21 12:00:42 +01:00
Mutable action tags are a supply-chain risk: a moved tag runs different code without a diff. Every workflow action is now pinned through .github/workflows/actions.lock, and CI verifies the lockfile so an out-of-sync or tampered one fails instead of running.
100 lines
3.6 KiB
YAML
100 lines
3.6 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@v2.22.4
|
|
with:
|
|
egress-policy: audit
|
|
- uses: actions/checkout@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@v1.0.0
|
|
with:
|
|
toolchain: stable
|
|
components: clippy, rustfmt
|
|
targets: wasm32-unknown-unknown
|
|
- uses: step-security/rust-cache@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@v2.22.4
|
|
with:
|
|
egress-policy: audit
|
|
- uses: actions/checkout@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@v1.0.0
|
|
with:
|
|
toolchain: stable
|
|
- uses: step-security/rust-cache@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@v2.22.4
|
|
with:
|
|
egress-policy: audit
|
|
- uses: actions/checkout@v7.0.1
|
|
- uses: EmbarkStudios/cargo-deny-action@v2.1.1
|
|
with:
|
|
command: check advisories licenses sources
|