-
Notifications
You must be signed in to change notification settings - Fork 9
81 lines (76 loc) Β· 2.92 KB
/
ci.yml
File metadata and controls
81 lines (76 loc) Β· 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: CI
on:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
# Disable incremental compilation on CI: unused by fresh builds and
# wastes cache space. See https://matklad.github.io/2021/09/04/fast-rust-builds.html
CARGO_INCREMENTAL: 0
# Use git CLI for cargo fetches β more reliable on Windows than libgit2.
CARGO_NET_GIT_FETCH_WITH_CLI: true
# Shrink debuginfo to speed compile + cache. Tests still run fine.
CARGO_PROFILE_DEV_DEBUG: "line-tables-only"
CARGO_PROFILE_TEST_DEBUG: "line-tables-only"
jobs:
check:
name: Check & Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
# Pin to MSRV (matches workspace.package.rust-version in Cargo.toml).
# This keeps CI reproducible across Rust releases β new clippy lints
# in stable don't break builds until MSRV is bumped intentionally.
toolchain: "1.95"
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
# Share cache between check & test on ubuntu β same toolchain
# + Cargo.lock β same dependency graph, so this is safe and
# roughly halves cold-start time for the test-ubuntu job.
shared-key: "ubuntu-stable"
# Save cache even if a step fails. Keeps warm cache primed so
# the next run (after fix) can benefit.
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo fmt --all --check
- run: cargo clippy --workspace -- -D warnings
- run: cargo check --workspace
- run: cargo check -p crab-cli --no-default-features
- run: cargo check -p crab-cli -F full
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
# Pin to MSRV to match the check job β shared cache keys require
# identical toolchain versions to avoid incompatible artifacts.
toolchain: "1.95"
- uses: Swatinem/rust-cache@v2
with:
# Ubuntu shares the check job's cache (same shared-key); win/mac
# get their own per-OS cache (rust-cache keys on OS automatically).
shared-key: ${{ matrix.os == 'ubuntu-latest' && 'ubuntu-stable' || '' }}
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: taiki-e/install-action@nextest
continue-on-error: true
id: nextest
- run: cargo nextest run --workspace
if: steps.nextest.outcome == 'success'
- run: cargo test --workspace
if: steps.nextest.outcome != 'success'
deny:
name: Dependency audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: EmbarkStudios/cargo-deny-action@v2