|
1 | 1 | # SPDX-License-Identifier: MPL-2.0 |
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 — thin wrapper calling the shared estate reusable in |
| 3 | +# hyperpolymath/standards. Configure once, propagate everywhere. |
| 4 | +# See: docs/CI-REUSABLE-WORKFLOWS.adoc in standards. |
6 | 5 | name: Rust CI |
7 | 6 |
|
8 | 7 | on: |
9 | | - pull_request: |
10 | | - branches: ['**'] |
11 | 8 | push: |
12 | 9 | branches: [main, master] |
| 10 | + pull_request: |
13 | 11 |
|
14 | 12 | permissions: |
15 | 13 | contents: read |
16 | 14 |
|
17 | 15 | jobs: |
18 | | - check: |
19 | | - name: Cargo check + clippy + fmt |
20 | | - runs-on: ubuntu-latest |
21 | | - if: hashFiles('Cargo.toml') != '' |
22 | | - |
23 | | - steps: |
24 | | - - name: Checkout repository |
25 | | - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
26 | | - |
27 | | - - name: Install Rust toolchain |
28 | | - uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable |
29 | | - with: |
30 | | - components: clippy, rustfmt |
31 | | - |
32 | | - - name: Cache cargo registry and build |
33 | | - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2 |
34 | | - |
35 | | - - name: Cargo check |
36 | | - run: cargo check --all-targets 2>&1 |
37 | | - |
38 | | - - name: Cargo fmt |
39 | | - run: cargo fmt --all -- --check |
40 | | - |
41 | | - - name: Cargo clippy |
42 | | - run: cargo clippy --all-targets -- -D warnings |
43 | | - |
44 | | - test: |
45 | | - name: Cargo test |
46 | | - runs-on: ubuntu-latest |
47 | | - needs: check |
48 | | - if: hashFiles('Cargo.toml') != '' |
49 | | - |
50 | | - steps: |
51 | | - - name: Checkout repository |
52 | | - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
53 | | - |
54 | | - - name: Install Rust toolchain |
55 | | - uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable |
56 | | - |
57 | | - - name: Cache cargo registry and build |
58 | | - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2 |
59 | | - |
60 | | - - name: Run tests |
61 | | - run: cargo test --all-targets |
62 | | - |
63 | | - - name: Write summary |
64 | | - if: always() |
65 | | - run: | |
66 | | - echo "## Rust CI Results" >> "$GITHUB_STEP_SUMMARY" |
67 | | - echo "" >> "$GITHUB_STEP_SUMMARY" |
68 | | - echo "- **cargo check**: passed" >> "$GITHUB_STEP_SUMMARY" |
69 | | - echo "- **cargo test**: completed" >> "$GITHUB_STEP_SUMMARY" |
| 16 | + rust-ci: |
| 17 | + uses: hyperpolymath/standards/.github/workflows/rust-ci-reusable.yml@4fdf4314b4ab54269adbaff10e30e483b5e86845 |
0 commit comments