-
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (55 loc) · 2.01 KB
/
Copy pathrust-ci.yml
File metadata and controls
55 lines (55 loc) · 2.01 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
# SPDX-License-Identifier: MPL-2.0
# // Copyright (c) Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
# SPDX-License-Identifier: MPL-2.0
# Rust CI — thin wrapper calling the shared estate reusable in
# hyperpolymath/standards. Configure once, propagate everywhere.
# See: docs/CI-REUSABLE-WORKFLOWS.adoc in standards.
name: Rust CI
on:
push:
branches: [main, master]
permissions:
contents: read
jobs:
check:
name: Cargo check + clippy + fmt
runs-on: ubuntu-latest
timeout-minutes: 15
if: hashFiles('Cargo.toml') != ''
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable
with:
components: clippy, rustfmt
- name: Cache cargo registry and build
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
- name: Cargo check
run: cargo check --all-targets 2>&1
- name: Cargo fmt
run: cargo fmt --all -- --check
- name: Cargo clippy
run: cargo clippy --all-targets -- -D warnings
test:
name: Cargo test
runs-on: ubuntu-latest
timeout-minutes: 15
needs: check
if: hashFiles('Cargo.toml') != ''
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable
- name: Cache cargo registry and build
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
- name: Run tests
run: cargo test --all-targets
- name: Write summary
if: always()
run: |
echo "## Rust CI Results" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "- **cargo check**: passed" >> "$GITHUB_STEP_SUMMARY"
echo "- **cargo test**: completed" >> "$GITHUB_STEP_SUMMARY"