12
12
env :
13
13
# Pinned toolchain for linting
14
14
ACTION_LINTS_TOOLCHAIN : 1.58.1
15
- # Minimum supported Rust version (MSRV)
16
- ACTION_MSRV_TOOLCHAIN : 1.58.1
17
- CARGO_INCREMENTAL : 0
18
15
CARGO_NET_RETRY : 10
19
16
CARGO_TERM_COLOR : always
20
17
CI : 1
21
18
RUSTUP_MAX_RETRIES : 10
22
19
RUST_BACKTRACE : short
23
20
24
21
jobs :
25
- rust :
26
- name : Rust
22
+ build-test :
23
+ name : Build+Test
27
24
runs-on : ubuntu-latest
28
25
container : quay.io/coreos-assembler/fcos-buildroot:testing-devel
29
26
strategy :
@@ -32,51 +29,52 @@ jobs:
32
29
os : [ubuntu-latest]
33
30
steps :
34
31
- name : Checkout repository
35
- uses : actions/checkout@v2
32
+ uses : actions/checkout@v3
36
33
with :
37
34
ref : ${{ github.event.pull_request.head.sha }}
38
35
fetch-depth : 20
39
- - name : Install Rust toolchain
40
- uses : actions-rs/toolchain@v1
41
- with :
42
- toolchain : stable
43
- profile : minimal
44
- override : true
36
+ - uses : dtolnay/rust-toolchain@stable
45
37
- name : Cache Dependencies
46
- uses : Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72
38
+ uses : Swatinem/rust-cache@v2
47
39
- name : Compile (no features)
48
40
run : cargo test --no-run
49
41
- name : Compile (all features)
50
42
run : cargo test --no-run --all-features
51
43
- name : Test
52
44
run : cargo test --all-features -- --nocapture --quiet
53
- # TODO: Re-enable this when git master there lands https://github.com/ostreedev/ostree-rs-ext/pull/123
54
- # - name: Checkout ostree-rs-ext
55
- # uses: actions/checkout@v2
56
- # with:
57
- # repository: ostreedev/ostree-rs-ext
58
- # path: ostree-rs-ext
59
- # fetch-depth: 20
60
- # - name: Test ostree-rs-ext
61
- # run: ./ci/test-ostree-rs-ext.sh
45
+ - name : Checkout ostree-rs-ext
46
+ uses : actions/checkout@v3
47
+ with :
48
+ repository : ostreedev/ostree-rs-ext
49
+ path : ostree-rs-ext
50
+ fetch-depth : 20
51
+ - name : Test ostree-rs-ext
52
+ run : ./ci/test-ostree-rs-ext.sh
62
53
build-minimum-toolchain :
63
54
name : " Build, minimum supported toolchain (MSRV)"
64
55
runs-on : ubuntu-latest
65
56
container : quay.io/coreos-assembler/fcos-buildroot:testing-devel
66
57
steps :
67
58
- name : Checkout repository
68
- uses : actions/checkout@v2
59
+ uses : actions/checkout@v3
60
+ - name : Detect crate MSRV
61
+ shell : bash
62
+ run : |
63
+ msrv=$(cargo metadata --format-version 1 --no-deps | \
64
+ jq -r '.packages | .[0].rust_version')
65
+ echo "Crate MSRV: $msrv"
66
+ echo "ACTION_MSRV_TOOLCHAIN=$msrv" >> $GITHUB_ENV
69
67
- name : Remove system Rust toolchain
70
68
run : dnf remove -y rust cargo
71
- - name : Install toolchain
72
- uses : actions-rs/toolchain@v1
69
+ - uses : dtolnay/rust-toolchain@master
73
70
with :
74
71
toolchain : ${{ env['ACTION_MSRV_TOOLCHAIN'] }}
75
- default : true
76
72
- name : Cache Dependencies
77
- uses : Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72
78
- - name : cargo build
79
- run : cargo build
73
+ uses : Swatinem/rust-cache@v2
74
+ with :
75
+ key : msrv
76
+ - name : cargo check
77
+ run : cargo check
80
78
linting :
81
79
name : " Lints, pinned toolchain"
82
80
runs-on : ubuntu-latest
86
84
uses : actions/checkout@v2
87
85
- name : Remove system Rust toolchain
88
86
run : dnf remove -y rust cargo
89
- - name : Install toolchain
90
- uses : actions-rs/toolchain@v1
87
+ - uses : dtolnay/rust-toolchain@master
91
88
with :
92
89
toolchain : ${{ env['ACTION_LINTS_TOOLCHAIN'] }}
93
- default : true
94
90
components : rustfmt, clippy
95
91
- name : cargo fmt (check)
96
92
run : cargo fmt -- --check -l
0 commit comments