Skip to content

Commit 5a36a23

Browse files
Run CI for the msrv and latest rust version (#37)
1 parent 757dadb commit 5a36a23

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

.github/workflows/rust.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ on:
55
branches: [main]
66
pull_request:
77

8-
env:
9-
RUSTFLAGS: -D warnings
10-
118
jobs:
129

1310
complete:
@@ -35,12 +32,27 @@ jobs:
3532
run: rustup run nightly rust-analyzer analysis-stats . 2>&1 | (! grep ERROR)
3633

3734
build-and-test:
35+
strategy:
36+
matrix:
37+
rust: [msrv, latest]
3838
runs-on: ubuntu-latest
3939
steps:
4040
- uses: actions/checkout@v3
4141
- uses: stellar/actions/rust-cache@main
42+
- name: Use the minimum supported Rust version
43+
if: matrix.rust == 'msrv'
44+
run: |
45+
msrv="$(cargo metadata --format-version 1 --no-deps | jq -r '.packages | map(.rust_version) | map(values) | min')"
46+
rustup override set $msrv
47+
rustup component add clippy --toolchain $msrv
48+
- name: Error on warnings and clippy checks
49+
# Only error on warnings and checks for the msrv, because new versions of
50+
# Rust will frequently add new warnings and checks.
51+
if: matrix.rust == 'msrv'
52+
run: echo RUSTFLAGS='-Dwarnings' >> $GITHUB_ENV
4253
- run: rustup update
43-
- run: cargo build
54+
- run: cargo version
55+
- run: cargo clippy
4456
- run: cargo test
4557

4658
docs:

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ readme = "README.md"
88
license = "Apache-2.0"
99
version = "0.0.5"
1010
edition = "2021"
11-
rust-version = "1.66"
11+
rust-version = "1.66.0"
1212

1313
[lib]
1414
proc-macro = true

0 commit comments

Comments
 (0)