-
Notifications
You must be signed in to change notification settings - Fork 0
154 lines (127 loc) · 4.16 KB
/
Copy pathcheck-rust.yml
File metadata and controls
154 lines (127 loc) · 4.16 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: check rust
on:
workflow_call:
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUSTFLAGS: -D warnings
jobs:
format:
name: format
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
persist-credentials: false
- name: Install nightly Rust toolchain
uses: dtolnay/rust-toolchain@2c7215f132e9ebf062739d9130488b56d53c060c
with:
toolchain: nightly
components: rustfmt
- name: Check formatting
run: cargo +nightly fmt --check
lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
persist-credentials: false
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@2c7215f132e9ebf062739d9130488b56d53c060c
with:
toolchain: stable
components: clippy
- name: Cache dependencies
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4
with:
shared-key: stable-ubuntu-latest
timeout-minutes: 5
- name: Check lints
run: cargo clippy --locked --all-targets -- -D warnings
test_stable:
name: test stable
needs:
- format
- lint
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
platform:
- macos-latest
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout source code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
persist-credentials: false
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@2c7215f132e9ebf062739d9130488b56d53c060c
with:
toolchain: stable
- name: Cache dependencies
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4
with:
shared-key: stable-${{ matrix.platform }}
timeout-minutes: 5
- name: Install cargo-nextest
uses: taiki-e/install-action@c7eb1735f09259a5035e8e5d44b1406b1cddc0fb
with:
tool: cargo-nextest
- name: Compile tests
run: cargo test --locked --no-run
- name: Run tests
run: cargo nextest run --locked --all-targets
- name: Run doctests
run: cargo test --locked --doc
test_msrv:
name: test msrv
needs:
- format
- lint
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
persist-credentials: false
- id: msrv
name: Get MSRV from package metadata
run: awk -F '"' '/rust-version/{ print "version=" $2 }' Cargo.toml >>"$GITHUB_OUTPUT"
- name: Install ${{ steps.msrv.outputs.version }} Rust toolchain
uses: dtolnay/rust-toolchain@2c7215f132e9ebf062739d9130488b56d53c060c
with:
toolchain: ${{ steps.msrv.outputs.version }}
- name: Install nightly Rust toolchain
uses: dtolnay/rust-toolchain@2c7215f132e9ebf062739d9130488b56d53c060c
with:
toolchain: nightly
- name: Resolve minimal dependency versions instead of maximum
run: cargo +nightly update -Z direct-minimal-versions
- name: Set override to MSRV Rust
env:
STEPS_MSRV_OUTPUTS_VERSION: ${{ steps.msrv.outputs.version }}
run: rustup override set "${STEPS_MSRV_OUTPUTS_VERSION}"
- name: Cache dependencies
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4
with:
shared-key: msrv-ubuntu-latest
timeout-minutes: 5
- name: Install cargo-nextest
uses: taiki-e/install-action@c7eb1735f09259a5035e8e5d44b1406b1cddc0fb
with:
tool: cargo-nextest
- name: Compile tests
run: cargo test --locked --no-run
- name: Run tests
run: cargo nextest run --locked --all-targets
- name: Run doctests
run: cargo test --locked --doc