Skip to content

Commit 73011a4

Browse files
authored
Merge pull request #1 from loichyan/ci/msrv-checks
Add checks of MSRV in CI
2 parents e7776ff + 0d2c790 commit 73011a4

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,40 @@ name: CI
33
on: [push, pull_request]
44

55
jobs:
6+
metadata:
7+
name: Extract crate metadata
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: dtolnay/rust-toolchain@stable
12+
13+
- name: Extract crate metadata
14+
id: metadata
15+
run: |
16+
cargo metadata --no-deps --format-version=1 \
17+
| jq -r '.packages[0]
18+
| {name, version, rust_version}
19+
| to_entries
20+
| map("\(.key)=\(.value)")
21+
| join("\n")' \
22+
| tee -a $GITHUB_OUTPUT
23+
outputs:
24+
name: ${{ steps.metadata.outputs.name }}
25+
version: ${{ steps.metadata.outputs.version }}
26+
rust_version: ${{ steps.metadata.outputs.rust_version }}
27+
628
ci:
29+
needs: [metadata]
730
runs-on: ubuntu-latest
831
strategy:
932
fail-fast: false
1033
matrix:
11-
rust-toolchain: [nightly]
34+
rust-toolchain: [nightly, "${{ needs.metadata.outputs.rust_version }}"]
1235
targets: [x86_64-unknown-linux-gnu, x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none-softfloat]
36+
exclude:
37+
# component 'rust-std' for target 'x86_64-unknown-none' is unavailable for channel '1.57'
38+
- rust-toolchain: "${{ needs.metadata.outputs.rust_version }}"
39+
targets: x86_64-unknown-none
1340
steps:
1441
- uses: actions/checkout@v4
1542
- uses: dtolnay/rust-toolchain@nightly
@@ -26,7 +53,7 @@ jobs:
2653
- name: Build
2754
run: cargo build --target ${{ matrix.targets }} --all-features
2855
- name: Unit test
29-
if: ${{ matrix.targets == 'x86_64-unknown-linux-gnu' }}
56+
if: ${{ matrix.targets == 'x86_64-unknown-linux-gnu' && matrix.rust-toolchain != '${{ needs.metadata.outputs.rust_version }}' }}
3057
run: cargo test --target ${{ matrix.targets }} -- --nocapture
3158

3259
doc:

0 commit comments

Comments
 (0)