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