@@ -55,10 +55,33 @@ jobs:
55
55
# Only check cargo lib for now
56
56
- run : cargo clippy -p cargo --lib -- -D warnings
57
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
+
58
81
test :
59
82
runs-on : ${{ matrix.os }}
60
83
needs :
61
- - channel
84
+ - matrix
62
85
env :
63
86
CARGO_PROFILE_DEV_DEBUG : 1
64
87
CARGO_PROFILE_TEST_DEBUG : 1
@@ -67,112 +90,58 @@ jobs:
67
90
# Deny warnings on CI to avoid warnings getting into the codebase.
68
91
RUSTFLAGS : -D warnings
69
92
strategy :
70
- matrix :
71
- include :
72
- - name : Linux x86_64 stable
73
- os : ubuntu-latest
74
- rust : stable
75
- other : i686-unknown-linux-gnu
76
- if : always()
77
- - name : Linux x86_64 beta
78
- os : ubuntu-latest
79
- rust : beta
80
- other : i686-unknown-linux-gnu
81
- if : ${{ needs.channel.outputs.CHANNEL == 'beta' || needs.channel.outputs.CHANNEL == 'nightly' }}
82
- - name : Linux x86_64 nightly
83
- os : ubuntu-latest
84
- rust : nightly
85
- other : i686-unknown-linux-gnu
86
- if : ${{ needs.channel.outputs.CHANNEL == 'nightly' }}
87
- - name : macOS x86_64 stable
88
- os : macos-latest
89
- rust : stable
90
- other : x86_64-apple-ios
91
- if : always()
92
- - name : macOS x86_64 nightly
93
- os : macos-latest
94
- rust : nightly
95
- other : x86_64-apple-ios
96
- if : ${{ needs.channel.outputs.CHANNEL == 'nightly' }}
97
- - name : Windows x86_64 MSVC stable
98
- os : windows-latest
99
- rust : stable-msvc
100
- other : i686-pc-windows-msvc
101
- if : always()
102
- - name : Windows x86_64 gnu nightly # runs out of space while trying to link the test suite
103
- os : windows-latest
104
- rust : nightly-gnu
105
- other : i686-pc-windows-gnu
106
- if : ${{ needs.channel.outputs.CHANNEL == 'nightly' }}
93
+ matrix : ${{ fromJSON(needs.matrix.outputs.MATRIX) }}
107
94
name : Tests ${{ matrix.name }}
108
95
steps :
109
96
- uses : actions/checkout@v3
110
- if : matrix.if
111
97
- name : Dump Environment
112
98
run : ci/dump-environment.sh
113
- if : matrix.if
114
99
- name : Update Rustup (temporary workaround)
115
100
run : rustup self update
116
101
shell : bash
117
- if : matrix.if && startsWith(matrix.os, 'windows')
102
+ if : startsWith(matrix.os, 'windows')
118
103
- run : rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
119
- if : matrix.if
120
104
- run : rustup target add ${{ matrix.other }}
121
- if : matrix.if
122
105
- run : rustup component add rustc-dev llvm-tools-preview rust-docs
123
- if : matrix.if && startsWith(matrix.rust, 'nightly')
106
+ if : startsWith(matrix.rust, 'nightly')
124
107
- run : sudo apt update -y && sudo apt install gcc-multilib libsecret-1-0 libsecret-1-dev -y
125
- if : matrix.if && matrix. os == 'ubuntu-latest'
108
+ if : matrix.os == 'ubuntu-latest'
126
109
- run : rustup component add rustfmt || echo "rustfmt not available"
127
- if : matrix.if
128
110
- name : Configure extra test environment
129
111
run : echo CARGO_CONTAINER_TESTS=1 >> $GITHUB_ENV
130
- if : matrix.if && matrix. os == 'ubuntu-latest'
112
+ if : matrix.os == 'ubuntu-latest'
131
113
- run : cargo test
132
- if : matrix.if
133
114
- name : Clear intermediate test output
134
115
run : ci/clean-test-output.sh
135
- if : matrix.if
136
116
- name : gitoxide tests (all git-related tests)
137
117
run : cargo test git
138
118
env :
139
119
__CARGO_USE_GITOXIDE_INSTEAD_OF_GIT2 : 1
140
- if : matrix.if
141
120
# The testsuite generates a huge amount of data, and fetch-smoke-test was
142
121
# running out of disk space.
143
122
- name : Clear test output
144
123
run : ci/clean-test-output.sh
145
- if : matrix.if
146
124
- name : Check operability of rustc invocation with argfile
147
125
env :
148
126
__CARGO_TEST_FORCE_ARGFILE : 1
149
127
run : |
150
128
# This only tests `cargo fix` because fix-proxy-mode is one of the most
151
129
# complicated subprocess management in Cargo.
152
130
cargo test --test testsuite -- fix::
153
- if : matrix.if
154
131
- run : cargo test --manifest-path crates/cargo-test-support/Cargo.toml
155
132
env :
156
133
CARGO_TARGET_DIR : target
157
- if : matrix.if
158
- - run : cargo test -p cargo-test-support
159
- if : matrix.if
160
134
- run : cargo test -p cargo-platform
161
- if : matrix.if
162
135
- run : cargo test -p cargo-util
163
- if : matrix.if
164
136
- run : cargo test --manifest-path crates/home/Cargo.toml
165
- if : matrix.if
166
137
- run : cargo test --manifest-path crates/mdman/Cargo.toml
167
- if : matrix.if
168
138
- run : cargo build --manifest-path crates/credential/cargo-credential-1password/Cargo.toml
169
- if : matrix.if
170
139
- run : cargo build --manifest-path crates/credential/cargo-credential-gnome-secret/Cargo.toml
171
- if : matrix.if && matrix. os == 'ubuntu-latest'
140
+ if : matrix.os == 'ubuntu-latest'
172
141
- run : cargo build --manifest-path crates/credential/cargo-credential-macos-keychain/Cargo.toml
173
- if : matrix.if && matrix. os == 'macos-latest'
142
+ if : matrix.os == 'macos-latest'
174
143
- run : cargo build --manifest-path crates/credential/cargo-credential-wincred/Cargo.toml
175
- if : matrix.if && matrix. os == 'windows-latest'
144
+ if : matrix.os == 'windows-latest'
176
145
- name : Check benchmarks
177
146
env :
178
147
# Share the target dir to try to cache a few build-time deps.
@@ -182,15 +151,12 @@ jobs:
182
151
# download all workspaces.
183
152
cargo test --manifest-path benches/benchsuite/Cargo.toml --all-targets -- cargo
184
153
cargo check --manifest-path benches/capture/Cargo.toml
185
- if : matrix.if
186
154
# The testsuite generates a huge amount of data, and fetch-smoke-test was
187
155
# running out of disk space.
188
156
- name : Clear benchmark output
189
157
run : ci/clean-test-output.sh
190
- if : matrix.if
191
158
- name : Fetch smoke test
192
159
run : ci/fetch-smoke-test.sh
193
- if : matrix.if
194
160
195
161
resolver :
196
162
runs-on : ubuntu-latest
@@ -215,7 +181,7 @@ jobs:
215
181
runs-on : ubuntu-latest
216
182
needs :
217
183
- channel
218
- if : ${{ needs.channel.outputs.CHANNEL == 'nightly ' }}
184
+ if : ${{ needs.channel.outputs.CHANNEL == 'master ' }}
219
185
steps :
220
186
- uses : actions/checkout@v3
221
187
- run : rustup update nightly && rustup default nightly
@@ -230,15 +196,6 @@ jobs:
230
196
- channel
231
197
steps :
232
198
- uses : actions/checkout@v3
233
- - name : Set branch for rustc linkchecker
234
- id : branch
235
- run : |
236
- BRANCH=${{ needs.channel.outputs.CHANNEL }}
237
- if [ "$BRANCH" = "nightly" ]
238
- then
239
- BRANCH=master
240
- fi
241
- echo "BRANCH=$BRANCH" >> "$GITHUB_OUTPUT"
242
199
- run : rustup update nightly && rustup default nightly
243
200
- run : rustup update stable
244
201
- run : rustup component add rust-docs
@@ -255,7 +212,7 @@ jobs:
255
212
- run : cd src/doc && mdbook build --dest-dir ../../target/doc
256
213
- name : Run linkchecker.sh
257
214
run : |
258
- BRANCH=${{ steps.branch .outputs.BRANCH }}
215
+ BRANCH=${{ needs.channel .outputs.CHANNEL }}
259
216
cd src/doc
260
217
curl -sSLo linkcheck.sh \
261
218
"https://raw.githubusercontent.com/rust-lang/rust/$BRANCH/src/tools/linkchecker/linkcheck.sh"
0 commit comments