Skip to content

Commit 53324cf

Browse files
committed
workflows: build and test on multiple Rust versions; add lint checks
1 parent cf0c8c6 commit 53324cf

File tree

1 file changed

+71
-6
lines changed

1 file changed

+71
-6
lines changed

.github/workflows/rust.yml

Lines changed: 71 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,78 @@ permissions:
1111

1212
env:
1313
CARGO_TERM_COLOR: always
14+
# Minimum supported Rust version (MSRV)
15+
ACTIONS_MSRV_TOOLCHAIN: 1.49.0
16+
# Pinned toolchain for linting
17+
ACTIONS_LINTS_TOOLCHAIN: 1.53.0
1418

1519
jobs:
16-
build:
20+
tests-stable:
21+
name: "Tests, stable toolchain"
1722
runs-on: ubuntu-latest
1823
steps:
19-
- uses: actions/checkout@v2
20-
- name: Build
21-
run: cargo build --verbose
22-
- name: Run tests
23-
run: cargo test --verbose
24+
- name: Checkout repository
25+
uses: actions/checkout@v2
26+
- name: Install toolchain
27+
uses: actions-rs/toolchain@v1
28+
with:
29+
toolchain: stable
30+
default: true
31+
- name: cargo build
32+
run: cargo build
33+
- name: cargo test
34+
run: cargo test
35+
tests-msrv:
36+
name: "Tests, minimum supported toolchain"
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v2
41+
- name: Install toolchain
42+
uses: actions-rs/toolchain@v1
43+
with:
44+
toolchain: ${{ env['ACTIONS_MSRV_TOOLCHAIN'] }}
45+
default: true
46+
- name: cargo build
47+
run: cargo build
48+
- name: cargo test
49+
run: cargo test
50+
lints:
51+
name: "Lints, pinned toolchain"
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Checkout repository
55+
uses: actions/checkout@v2
56+
- name: Install toolchain
57+
uses: actions-rs/toolchain@v1
58+
with:
59+
toolchain: ${{ env['ACTIONS_LINTS_TOOLCHAIN'] }}
60+
default: true
61+
components: rustfmt, clippy
62+
- name: cargo fmt (check)
63+
run: cargo fmt -- --check -l
64+
- name: cargo clippy (warnings)
65+
run: cargo clippy -- -D warnings
66+
- name: cargo build
67+
run: cargo build
68+
tests-other-channels:
69+
name: "Tests, unstable toolchain"
70+
runs-on: ubuntu-latest
71+
continue-on-error: true
72+
strategy:
73+
matrix:
74+
channel:
75+
- beta
76+
- nightly
77+
steps:
78+
- name: Checkout repository
79+
uses: actions/checkout@v2
80+
- name: Install toolchain
81+
uses: actions-rs/toolchain@v1
82+
with:
83+
toolchain: ${{ matrix.channel }}
84+
default: true
85+
- name: cargo build
86+
run: cargo build
87+
- name: cargo test
88+
run: cargo test

0 commit comments

Comments
 (0)