Skip to content

Commit ac9e992

Browse files
committed
update github actions
* Node.js 16 actions are deprecated; update checkout * action-rs/* are archived; switch to dtolnay/rust-toolchain (unclear how to properly configure cache)
1 parent 6f506ca commit ac9e992

File tree

1 file changed

+26
-116
lines changed

1 file changed

+26
-116
lines changed

.github/workflows/rust.yml

Lines changed: 26 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -5,179 +5,89 @@ name: Rust CI
55
jobs:
66
# if this fails we don't try anything else on stable
77
#
8-
# we use multiple jobs so no single check prevents others from being run;
9-
# but use a cache to speedup steps after build
108
# (if initial build fails nothing else is checked)
9+
#
10+
# TODO: unclear how to setup cache with dtolnay/rust-toolchain
1111
build:
1212
name: Build
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v2
16-
- name: Cache stable
17-
uses: actions/cache@v2
18-
with:
19-
key: build-stable-${{ github.run_id }}
20-
path: |
21-
/usr/share/rust/.cargo/
22-
target/
23-
- uses: actions-rs/toolchain@v1
24-
with:
25-
profile: minimal
26-
toolchain: stable
27-
override: true
28-
- name: Build
29-
uses: actions-rs/cargo@v1
30-
with:
31-
command: build
15+
- uses: actions/checkout@v4
16+
- uses: dtolnay/rust-toolchain@stable
17+
- name: Build default features
18+
run: cargo build
3219
- name: Build with all features
33-
uses: actions-rs/cargo@v1
34-
with:
35-
command: build
36-
args: --all-features
20+
run: cargo build --all-features
3721

3822
check:
3923
name: Check
4024
runs-on: ubuntu-latest
4125
needs: build
4226
steps:
43-
- uses: actions/checkout@v2
44-
- name: Cache stable
45-
uses: actions/cache@v2
46-
with:
47-
key: build-stable-${{ github.run_id }}
48-
path: |
49-
/usr/share/rust/.cargo/
50-
target/
51-
- uses: actions-rs/toolchain@v1
52-
with:
53-
profile: minimal
54-
toolchain: stable
55-
override: true
27+
- uses: actions/checkout@v4
28+
- uses: dtolnay/rust-toolchain@stable
5629
- name: Check
57-
uses: actions-rs/cargo@v1
58-
with:
59-
command: check
60-
args: --all-features
30+
run: cargo check --all-features
6131

6232
test:
6333
name: Test Suite
6434
runs-on: ubuntu-latest
6535
needs: build
6636
steps:
67-
- uses: actions/checkout@v2
68-
- name: Cache stable
69-
uses: actions/cache@v2
70-
with:
71-
key: build-stable-${{ github.run_id }}
72-
path: |
73-
/usr/share/rust/.cargo/
74-
target/
75-
- uses: actions-rs/toolchain@v1
76-
with:
77-
profile: minimal
78-
toolchain: stable
79-
override: true
37+
- uses: actions/checkout@v4
38+
- uses: dtolnay/rust-toolchain@stable
8039
- name: Test
81-
uses: actions-rs/cargo@v1
82-
with:
83-
command: test
84-
args: --all-features
40+
run: cargo test --all-features
8541

8642
clippy:
8743
name: Clippy
8844
runs-on: ubuntu-latest
8945
needs: build
9046
steps:
91-
- uses: actions/checkout@v2
92-
- name: Cache stable
93-
uses: actions/cache@v2
94-
with:
95-
key: build-stable-${{ github.run_id }}
96-
path: |
97-
/usr/share/rust/.cargo/
98-
target/
99-
- uses: actions-rs/toolchain@v1
100-
with:
101-
profile: minimal
102-
toolchain: stable
103-
override: true
104-
components: clippy
47+
- uses: actions/checkout@v4
48+
- uses: dtolnay/rust-toolchain@stable
10549
- name: Clippy
106-
uses: actions-rs/cargo@v1
107-
with:
108-
command: clippy
109-
args: -- -D warnings
50+
run: cargo clippy -- -D warnings
11051

11152
doc:
11253
name: Rustdoc
11354
runs-on: ubuntu-latest
11455
needs: build
11556
steps:
116-
- uses: actions/checkout@v2
117-
- name: Cache stable
118-
uses: actions/cache@v2
119-
with:
120-
key: build-stable-${{ github.run_id }}
121-
path: |
122-
/usr/share/rust/.cargo/
123-
target/
124-
- uses: actions-rs/toolchain@v1
125-
with:
126-
profile: minimal
127-
toolchain: stable
128-
override: true
57+
- uses: actions/checkout@v4
58+
- uses: dtolnay/rust-toolchain@stable
12959
- name: Rustdoc
130-
uses: actions-rs/cargo@v1
131-
with:
132-
command: doc
133-
args: --all-features
60+
run: cargo doc --all-features
13461

13562
# no cache for nightly, run all steps in same job - if one fails, the others won't be tried
13663
build-nightly:
13764
name: Build [nightly]
13865
runs-on: ubuntu-latest
13966
steps:
140-
- uses: actions/checkout@v2
141-
- uses: actions-rs/toolchain@v1
67+
- uses: actions/checkout@v4
68+
- uses: dtolnay/rust-toolchain@nightly
14269
with:
143-
profile: minimal
144-
toolchain: nightly
145-
override: true
14670
components: rustfmt
14771
# nightly fmt
14872
- name: Rustfmt [nightly]
149-
uses: actions-rs/cargo@v1
150-
with:
151-
command: fmt
152-
args: --all -- --check
73+
run: cargo fmt --all -- --check
15374
# nightly build
15475
- name: Build [nightly]
155-
uses: actions-rs/cargo@v1
156-
with:
157-
command: build
76+
run: cargo build
15877
# nightly build all features
15978
- name: Build with all features [nightly]
160-
uses: actions-rs/cargo@v1
161-
with:
162-
command: build
163-
args: --all-features
79+
run: cargo build --all-features
16480
# check
16581
- name: Check [nightly]
166-
uses: actions-rs/cargo@v1
167-
with:
168-
command: check
169-
args: --all-features
82+
run: cargo check --all-features
17083
# doc_cfg not stable yet
17184
# https://doc.rust-lang.org/unstable-book/language-features/doc-cfg.html
17285
# https://github.com/rust-lang/rust/issues/43781
17386
- name: Rustdoc [nightly]
174-
uses: actions-rs/cargo@v1
17587
env:
17688
# this should need nightly
17789
RUSTDOCFLAGS: "--cfg doc_cfg"
178-
with:
179-
command: doc
180-
args: --all-features
90+
run: cargo doc --all-features
18191
# deploy docs from nightly for doc_cfg feature
18292
# (for stable we'd create a new job and use the cache)
18393
- name: Deploy docs

0 commit comments

Comments
 (0)