Skip to content

Commit fcf0b64

Browse files
committed
github actions: Use Cargo.toml and rust-toolchain.toml
Use the values specified in these files to set toolchain versions in CI. Signed-off-by: mulhern <amulhern@redhat.com>
1 parent 259d67b commit fcf0b64

3 files changed

Lines changed: 20 additions & 39 deletions

File tree

‎.github/workflows/cargo.yml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ jobs:
3838
openssl-devel
3939
python-requests
4040
python-semantic_version
41-
- uses: dtolnay/rust-toolchain@master
41+
- uses: actions-rust-lang/setup-rust-toolchain@v1
4242
with:
4343
components: cargo
44-
toolchain: 1.95.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN
4544
- name: Check out ci repo
4645
uses: actions/checkout@v6
4746
with:

‎.github/workflows/main.yml‎

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,61 +23,58 @@ jobs:
2323
matrix:
2424
include:
2525
- components: rustfmt
26-
toolchain: 1.95.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN
2726
task: make -f Makefile fmt-ci
2827
- components: clippy
29-
toolchain: 1.95.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN
3028
task: make -f Makefile clippy
3129
- components: cargo
32-
toolchain: 1.95.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN
3330
task: make -f Makefile build
3431
- components: cargo
35-
toolchain: 1.95.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN
3632
task: make -f Makefile docs
3733
- components: cargo
38-
toolchain: 1.95.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN
3934
task: make -f Makefile check-typos
4035
runs-on: ubuntu-22.04
4136
steps:
4237
- uses: actions/checkout@v6
4338
with:
4439
persist-credentials: false
45-
- uses: dtolnay/rust-toolchain@master
40+
- uses: actions-rust-lang/setup-rust-toolchain@v1
4641
with:
4742
components: ${{ matrix.components }}
48-
toolchain: ${{ matrix.toolchain }}
4943
- uses: baptiste0928/cargo-install@v3
5044
with:
5145
crate: typos-cli
5246
- name: Install dependencies
5347
run: |
5448
sudo apt-get -q update
5549
sudo apt-get -y install libdevmapper-dev
56-
- name: Test ${{ matrix.task }} on ${{ matrix.toolchain }} toolchain
50+
- name: Test ${{ matrix.task }} on CURRENT DEVELOPMENT RUST TOOLCHAIN
5751
run: ${{ matrix.task }}
5852

5953
tests-with-sudo:
60-
strategy:
61-
matrix:
62-
include:
63-
- toolchain: 1.85.0 # LOWEST SUPPORTED RUST TOOLCHAIN
64-
- toolchain: 1.95.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN
6554
runs-on: ubuntu-22.04
6655
steps:
6756
- uses: actions/checkout@v6
6857
with:
6958
persist-credentials: false
70-
- uses: dtolnay/rust-toolchain@master
59+
- uses: actions-rust-lang/setup-rust-toolchain@v1
7160
with:
7261
components: cargo
73-
toolchain: ${{ matrix.toolchain }}
7462
- name: Install dependencies
7563
run: |
7664
sudo apt-get -q update
7765
sudo apt-get -y install libdevmapper-dev
66+
- name: Run all tests on CURRENT DEVELOPMENT RUST TOOLCHAIN
67+
run: sudo PATH=$GITHUB_WORKSPACE/.cargo/bin:$PATH make -f Makefile sudo_test
68+
- name: Install toml-cli
69+
run: pip install --user toml-cli
70+
- name: Get package MSRV
71+
id: msrv
72+
run: |
73+
PATH=${PATH}:/github/home/.local/bin MSRV=$(toml get --toml-path Cargo.toml "package.rust-version")
74+
echo "MSRV=$MSRV" >> "$GITHUB_OUTPUT"
7875
- name: Set toolchain override with sudo
79-
run: sudo /home/runner/.cargo/bin/rustup override set ${{ matrix.toolchain }}
80-
- name: Run all tests on ${{ matrix.toolchain }} toolchain
76+
run: sudo /home/runner/.cargo/bin/rustup override set ${{ steps.msrv.outputs.MSRV }}
77+
- name: Run all tests on LOWEST SUPPORTED RUST TOOLCHAIN
8178
run: sudo PATH=$GITHUB_WORKSPACE/.cargo/bin:$PATH make -f Makefile sudo_test
8279

8380
# VERIFICATION OF TEST INFRASTRUCTURE

‎.github/workflows/nightly.yml‎

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,23 @@ on:
1111
jobs:
1212
allowed_failures:
1313
continue-on-error: true
14-
strategy:
15-
matrix:
16-
include:
17-
- components: cargo
18-
toolchain: 1.95.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN
19-
task: make -f Makefile audit
20-
# Allowed because a failure may occur after a new Rust stable
21-
# version is released.
22-
- components: clippy
23-
toolchain: stable
24-
task: make -f Makefile clippy
2514
runs-on: ubuntu-22.04
2615
steps:
2716
- uses: actions/checkout@v6
2817
with:
2918
persist-credentials: false
30-
- uses: dtolnay/rust-toolchain@master
19+
- uses: actions-rust-lang/setup-rust-toolchain@v1
3120
with:
32-
components: ${{ matrix.components }}
33-
toolchain: ${{ matrix.toolchain }}
21+
components: cargo
3422
- name: Install dependencies
3523
run: |
3624
sudo apt-get -q update
3725
sudo apt-get -y install libdevmapper-dev
3826
- uses: baptiste0928/cargo-install@v3
3927
with:
4028
crate: cargo-audit
41-
- name: Test ${{ matrix.task }} on ${{ matrix.toolchain }} toolchain
42-
run: ${{ matrix.task }}
29+
- name: Audit check
30+
run: make -f Makefile audit
4331

4432
checks-with-ci-repo:
4533
runs-on: ubuntu-22.04
@@ -61,10 +49,9 @@ jobs:
6149
openssl-devel
6250
python-requests
6351
python-semantic_version
64-
- uses: dtolnay/rust-toolchain@master
52+
- uses: actions-rust-lang/setup-rust-toolchain@v1
6553
with:
6654
components: cargo
67-
toolchain: 1.95.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN
6855
- name: Check out ci repo
6956
uses: actions/checkout@v6
7057
with:
@@ -98,10 +85,8 @@ jobs:
9885
uses: obi1kenobi/cargo-semver-checks-action@v2
9986
with:
10087
verbose: true
101-
rust-toolchain: 1.95.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN
10288
manifest-path: devicemapper-rs-sys
10389
- name: Do semantic version checks
10490
uses: obi1kenobi/cargo-semver-checks-action@v2
10591
with:
10692
verbose: true
107-
rust-toolchain: 1.95.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN

0 commit comments

Comments
 (0)