main
yml 44 lines 1.5 KB
Raw
1 name: CI
2
3 on:
4 pull_request:
5 push:
6 branches: [main, development]
7
8 concurrency:
9 # Keyed on the commit, not the ref: a merge lands the same SHA on development
10 # and then on main, and keying on the ref put those in separate groups, so one
11 # commit paid for two full macOS runs of identical code. Pull requests key on
12 # their number instead, because there `github.sha` is the ephemeral merge
13 # commit and changes with every push to the branch, which would leave
14 # superseded runs alive.
15 group: ci-${{ github.event.pull_request.number || github.sha }}
16 cancel-in-progress: true
17
18 jobs:
19 check:
20 runs-on: macos-26
21 defaults:
22 run:
23 working-directory: ed
24 steps:
25 - uses: actions/checkout@v6
26 with:
27 path: ed
28 - name: Read Rust toolchain
29 run: |
30 rust_toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml | head -n 1)"
31 test -n "$rust_toolchain"
32 echo "RUST_TOOLCHAIN=$rust_toolchain" >> "$GITHUB_ENV"
33 - uses: dtolnay/rust-toolchain@stable
34 with:
35 toolchain: ${{ env.RUST_TOOLCHAIN }}
36 # The action installs a minimal profile, so the pinned toolchain has
37 # neither of these unless they are asked for by name.
38 components: rustfmt, clippy
39 - uses: Swatinem/rust-cache@v2
40 with:
41 workspaces: ed
42 - run: cargo fmt --all -- --check
43 - run: cargo clippy --locked --workspace --all-targets -- -D warnings
44 - run: cargo test --locked --workspace