Skip to content

Commit e50eaca

Browse files
ci(rust): rewrite rust-ci.yml so the workflow actually registers (#89)
The previous Rust CI workflow had been failing at the workflow-parse layer since 2026-04-04. The symptoms in the Actions API are characteristic: `name: ".github/workflows/rust-ci.yml"` (the file path, not the declared `name: Rust CI`), 0 jobs ever scheduled, and "This run likely failed because of a workflow file issue" in the runner output. Every push for ~6 weeks reported failure for this workflow specifically without ever running any of its jobs. Because Rust CI is not a required status check, auto-merge was happy to land PRs without it. ~25 PRs landed in this state. I could not reproduce the parser failure offline (`actionlint` was not available locally). Rather than spelunk through invisible-char hunches, rewrite from a minimal template that is known to work in GitHub Actions today and let CI tell us if it actually registers: - drop the verbose comment header and SPDX-only line (keep one) - simplify `on:` to its idiomatic form - replace SHA-pinned actions with major-version tags (`actions/checkout@v4`, `dtolnay/rust-toolchain@stable`/`@master`, `Swatinem/rust-cache@v2`) — easier to maintain and matches what works elsewhere in the org - keep the MSRV matrix (`1.85`, `stable`) from V-L3-K1 - drop the `if: hashFiles('Cargo.toml') != ''` gate — this repo has a Cargo.toml at root unconditionally, so the gate adds zero value and is a source of parse-time complexity - keep the dependency `test` → `check` so test only runs when fmt+clippy are clean Closes the "Rust CI never ran" debt accumulated across recent PRs. Future Rust changes will land with real verification. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 2c089a7 commit e50eaca

1 file changed

Lines changed: 18 additions & 49 deletions

File tree

.github/workflows/rust-ci.yml

Lines changed: 18 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
# SPDX-License-Identifier: PMPL-1.0-or-later
2-
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3-
#
4-
# rust-ci.yml — Cargo build, test, clippy, and fmt for Rust projects.
5-
# Only runs if Cargo.toml exists in the repo root.
2+
# Rust CI - cargo check + clippy + fmt + test on stable and MSRV
63
name: Rust CI
74

85
on:
96
pull_request:
10-
branches: ['**']
117
push:
12-
branches: [main, master]
8+
branches:
9+
- main
1310

1411
concurrency:
1512
group: rust-ci-${{ github.ref }}
@@ -20,64 +17,36 @@ permissions:
2017

2118
jobs:
2219
check:
23-
name: Cargo check + clippy + fmt
20+
name: cargo check (stable)
2421
runs-on: ubuntu-latest
25-
if: hashFiles('Cargo.toml') != ''
26-
2722
steps:
28-
- name: Checkout repository
29-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
30-
31-
- name: Install Rust toolchain
32-
uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable
23+
- uses: actions/checkout@v4
24+
- uses: dtolnay/rust-toolchain@stable
3325
with:
3426
components: clippy, rustfmt
35-
36-
- name: Cache cargo registry and build
37-
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
38-
39-
- name: Cargo check
40-
run: cargo check --all-targets 2>&1
41-
42-
- name: Cargo fmt
27+
- uses: Swatinem/rust-cache@v2
28+
- name: cargo fmt
4329
run: cargo fmt --all -- --check
44-
45-
- name: Cargo clippy
30+
- name: cargo clippy
4631
run: cargo clippy --all-targets -- -D warnings
4732

4833
test:
49-
name: Cargo test (${{ matrix.rust }})
34+
name: cargo test (${{ matrix.rust }})
5035
runs-on: ubuntu-latest
5136
needs: check
52-
if: hashFiles('Cargo.toml') != ''
5337
strategy:
5438
fail-fast: false
5539
matrix:
56-
# `1.85` matches Cargo.toml `rust-version` — the MSRV gate.
57-
# `stable` keeps the lane honest against the latest stable.
58-
rust: ['1.85', 'stable']
59-
40+
rust:
41+
- "1.85"
42+
- "stable"
6043
steps:
61-
- name: Checkout repository
62-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
63-
64-
- name: Install Rust toolchain
65-
uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # pinned
44+
- uses: actions/checkout@v4
45+
- uses: dtolnay/rust-toolchain@master
6646
with:
6747
toolchain: ${{ matrix.rust }}
68-
69-
- name: Cache cargo registry and build
70-
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
48+
- uses: Swatinem/rust-cache@v2
7149
with:
7250
key: ${{ matrix.rust }}
73-
74-
- name: Run tests
75-
run: cargo test --all-targets
76-
77-
- name: Write summary
78-
if: always()
79-
run: |
80-
echo "## Rust CI Results (${{ matrix.rust }})" >> "$GITHUB_STEP_SUMMARY"
81-
echo "" >> "$GITHUB_STEP_SUMMARY"
82-
echo "- **cargo check**: passed" >> "$GITHUB_STEP_SUMMARY"
83-
echo "- **cargo test**: completed" >> "$GITHUB_STEP_SUMMARY"
51+
- name: cargo test
52+
run: cargo test --all-targets --no-fail-fast

0 commit comments

Comments
 (0)