Repository navigation
132 lines (113 loc) · 3.41 KB
/
Copy pathrust.yml
File metadata and controls
132 lines (113 loc) · 3.41 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# This workflow is managed by gh actions-lock.
# SPDX-License-Identifier: MPL-2.0
# This workflow is managed by gh actions-lock.
# Consolidated workflow (behaviour-preserving merge).
# Merged from: rust-ci.yml, rust.yml
name: Rust CI
on:
push:
branches:
- main
- master
pull_request:
branches:
- '**'
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: read-all
jobs:
check:
name: Check
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7.0.1
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2.9.2
# Every cargo invocation in this workflow passes --locked: the committed
# Cargo.lock is a hard constraint, not a hint (#841). A failure reading
# "the lock file ... needs to be updated but --locked was passed" means
# Cargo.lock is out of date w.r.t. the manifests -- regenerate it
# deliberately and commit it; never drop --locked to get green.
- run: cargo check --workspace --locked
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7.0.1
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2.9.2
- run: cargo test --workspace --locked
fmt:
name: Format
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7.0.1
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: rustfmt
- run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7.0.1
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: clippy
- uses: Swatinem/rust-cache@v2.9.2
- run: cargo clippy --workspace --locked -- -D warnings
rustci_check:
name: Cargo check + clippy + fmt
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v7.0.1
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: clippy, rustfmt
- name: Cache cargo registry and build
uses: Swatinem/rust-cache@v2.9.2
- name: Cargo check
run: cargo check --all-targets --locked 2>&1
- name: Cargo fmt
run: cargo fmt --all -- --check
- name: Cargo clippy
run: cargo clippy --all-targets --locked -- -D warnings
rustci_test:
name: Cargo test
runs-on: ubuntu-latest
timeout-minutes: 30
needs: rustci_check
steps:
- name: Checkout repository
uses: actions/checkout@v7.0.1
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
- name: Cache cargo registry and build
uses: Swatinem/rust-cache@v2.9.2
- name: Run tests
run: cargo test --all-targets --locked
- 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"