16
16
CARGO_REGISTRIES_CRATES_IO_PROTOCOL : sparse
17
17
18
18
jobs :
19
+ # Determine which channel will be merged into.
20
+ channel :
21
+ runs-on : ubuntu-latest
22
+ outputs :
23
+ CHANNEL : ${{ steps.channel.outputs.CHANNEL }}
24
+ env :
25
+ BASE_SHA : ${{ github.event.pull_request.base.sha }}
26
+ steps :
27
+ - uses : actions/checkout@v3
28
+ with :
29
+ fetch-depth : 0 # fetch all branches
30
+ - id : channel
31
+ run : ci/which-channel.sh
32
+
19
33
# Check Code style quickly by running `rustfmt` over all code
20
34
rustfmt :
21
35
runs-on : ubuntu-latest
41
55
# Only check cargo lib for now
42
56
- run : cargo clippy -p cargo --lib -- -D warnings
43
57
58
+ # Generate strategy matrix for different platforms and channels
59
+ # (see ci/matrix.json)
60
+ matrix :
61
+ runs-on : ubuntu-latest
62
+ needs :
63
+ - channel
64
+ outputs :
65
+ matrix : ${{ steps.matrix.outputs.matrix }}
66
+ steps :
67
+ - uses : actions/checkout@v3
68
+ - name : Generate strategy matrix
69
+ id : matrix
70
+ run : |
71
+ CHANNEL=${{ needs.channel.outputs.CHANNEL }}
72
+ MATRIX=$(
73
+ jq --arg C "$CHANNEL" 'map (. |
74
+ if ($C == "beta") then select(.rust | startswith("nightly") | not)
75
+ elif ($C == "stable") then select(.rust | startswith("stable"))
76
+ else . end)' ci/matrix.json
77
+ )
78
+ echo "$MATRIX"
79
+ echo "MATRIX={\"include\":$(echo $MATRIX)}" >> "$GITHUB_OUTPUT"
80
+
44
81
test :
45
82
runs-on : ${{ matrix.os }}
83
+ needs :
84
+ - matrix
46
85
env :
47
86
CARGO_PROFILE_DEV_DEBUG : 1
48
87
CARGO_PROFILE_TEST_DEBUG : 1
51
90
# Deny warnings on CI to avoid warnings getting into the codebase.
52
91
RUSTFLAGS : -D warnings
53
92
strategy :
54
- matrix :
55
- include :
56
- - name : Linux x86_64 stable
57
- os : ubuntu-latest
58
- rust : stable
59
- other : i686-unknown-linux-gnu
60
- - name : Linux x86_64 beta
61
- os : ubuntu-latest
62
- rust : beta
63
- other : i686-unknown-linux-gnu
64
- - name : Linux x86_64 nightly
65
- os : ubuntu-latest
66
- rust : nightly
67
- other : i686-unknown-linux-gnu
68
- - name : macOS x86_64 stable
69
- os : macos-latest
70
- rust : stable
71
- other : x86_64-apple-ios
72
- - name : macOS x86_64 nightly
73
- os : macos-latest
74
- rust : nightly
75
- other : x86_64-apple-ios
76
- - name : Windows x86_64 MSVC stable
77
- os : windows-latest
78
- rust : stable-msvc
79
- other : i686-pc-windows-msvc
80
- - name : Windows x86_64 gnu nightly # runs out of space while trying to link the test suite
81
- os : windows-latest
82
- rust : nightly-gnu
83
- other : i686-pc-windows-gnu
93
+ matrix : ${{ fromJSON(needs.matrix.outputs.MATRIX) }}
84
94
name : Tests ${{ matrix.name }}
85
95
steps :
86
96
- uses : actions/checkout@v3
@@ -100,7 +110,6 @@ jobs:
100
110
- name : Configure extra test environment
101
111
run : echo CARGO_CONTAINER_TESTS=1 >> $GITHUB_ENV
102
112
if : matrix.os == 'ubuntu-latest'
103
-
104
113
- run : cargo test
105
114
- name : Clear intermediate test output
106
115
run : ci/clean-test-output.sh
@@ -170,6 +179,9 @@ jobs:
170
179
171
180
build_std :
172
181
runs-on : ubuntu-latest
182
+ needs :
183
+ - channel
184
+ if : ${{ needs.channel.outputs.CHANNEL == 'master' }}
173
185
steps :
174
186
- uses : actions/checkout@v3
175
187
- run : rustup update nightly && rustup default nightly
@@ -180,6 +192,8 @@ jobs:
180
192
CARGO_RUN_BUILD_STD_TESTS : 1
181
193
docs :
182
194
runs-on : ubuntu-latest
195
+ needs :
196
+ - channel
183
197
steps :
184
198
- uses : actions/checkout@v3
185
199
- run : rustup update nightly && rustup default nightly
@@ -196,10 +210,12 @@ jobs:
196
210
env :
197
211
RUSTDOCFLAGS : -D warnings
198
212
- run : cd src/doc && mdbook build --dest-dir ../../target/doc
199
- - run : |
213
+ - name : Run linkchecker.sh
214
+ run : |
215
+ BRANCH=${{ needs.channel.outputs.CHANNEL }}
200
216
cd src/doc
201
217
curl -sSLo linkcheck.sh \
202
- https://raw.githubusercontent.com/rust-lang/rust/master /src/tools/linkchecker/linkcheck.sh
218
+ " https://raw.githubusercontent.com/rust-lang/rust/$BRANCH /src/tools/linkchecker/linkcheck.sh"
203
219
sh linkcheck.sh --all cargo
204
220
205
221
success :
0 commit comments