1616 CARGO_REGISTRIES_CRATES_IO_PROTOCOL : sparse
1717
1818jobs :
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+
1933 # Check Code style quickly by running `rustfmt` over all code
2034 rustfmt :
2135 runs-on : ubuntu-latest
4357
4458 test :
4559 runs-on : ${{ matrix.os }}
60+ needs :
61+ - channel
4662 env :
4763 CARGO_PROFILE_DEV_DEBUG : 1
4864 CARGO_PROFILE_TEST_DEBUG : 1
@@ -57,82 +73,106 @@ jobs:
5773 os : ubuntu-latest
5874 rust : stable
5975 other : i686-unknown-linux-gnu
76+ if : always()
6077 - name : Linux x86_64 beta
6178 os : ubuntu-latest
6279 rust : beta
6380 other : i686-unknown-linux-gnu
81+ if : ${{ needs.channel.outputs.CHANNEL == 'beta' || needs.channel.outputs.CHANNEL == 'nightly' }}
6482 - name : Linux x86_64 nightly
6583 os : ubuntu-latest
6684 rust : nightly
6785 other : i686-unknown-linux-gnu
86+ if : ${{ needs.channel.outputs.CHANNEL == 'nightly' }}
6887 - name : macOS x86_64 stable
6988 os : macos-latest
7089 rust : stable
7190 other : x86_64-apple-ios
91+ if : always()
7292 - name : macOS x86_64 nightly
7393 os : macos-latest
7494 rust : nightly
7595 other : x86_64-apple-ios
96+ if : ${{ needs.channel.outputs.CHANNEL == 'nightly' }}
7697 - name : Windows x86_64 MSVC stable
7798 os : windows-latest
7899 rust : stable-msvc
79100 other : i686-pc-windows-msvc
101+ if : always()
80102 - name : Windows x86_64 gnu nightly # runs out of space while trying to link the test suite
81103 os : windows-latest
82104 rust : nightly-gnu
83105 other : i686-pc-windows-gnu
106+ if : ${{ needs.channel.outputs.CHANNEL == 'nightly' }}
84107 name : Tests ${{ matrix.name }}
85108 steps :
86109 - uses : actions/checkout@v3
110+ if : matrix.if
87111 - name : Dump Environment
88112 run : ci/dump-environment.sh
113+ if : matrix.if
89114 - name : Update Rustup (temporary workaround)
90115 run : rustup self update
91116 shell : bash
92- if : startsWith(matrix.os, 'windows')
117+ if : matrix.if && startsWith(matrix.os, 'windows')
93118 - run : rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
119+ if : matrix.if
94120 - run : rustup target add ${{ matrix.other }}
121+ if : matrix.if
95122 - 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')
97124 - 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'
99126 - run : rustup component add rustfmt || echo "rustfmt not available"
127+ if : matrix.if
100128 - name : Configure extra test environment
101129 run : echo CARGO_CONTAINER_TESTS=1 >> $GITHUB_ENV
102- if : matrix.os == 'ubuntu-latest'
103-
130+ if : matrix.if && matrix.os == 'ubuntu-latest'
104131 - run : cargo test
132+ if : matrix.if
105133 - name : Clear intermediate test output
106134 run : ci/clean-test-output.sh
135+ if : matrix.if
107136 - name : gitoxide tests (all git-related tests)
108137 run : cargo test git
109138 env :
110139 __CARGO_USE_GITOXIDE_INSTEAD_OF_GIT2 : 1
140+ if : matrix.if
111141 # The testsuite generates a huge amount of data, and fetch-smoke-test was
112142 # running out of disk space.
113143 - name : Clear test output
114144 run : ci/clean-test-output.sh
145+ if : matrix.if
115146 - name : Check operability of rustc invocation with argfile
116147 env :
117148 __CARGO_TEST_FORCE_ARGFILE : 1
118149 run : |
119150 # This only tests `cargo fix` because fix-proxy-mode is one of the most
120151 # complicated subprocess management in Cargo.
121152 cargo test --test testsuite -- fix::
153+ if : matrix.if
122154 - run : cargo test --manifest-path crates/cargo-test-support/Cargo.toml
123155 env :
124156 CARGO_TARGET_DIR : target
157+ if : matrix.if
158+ - run : cargo test -p cargo-test-support
159+ if : matrix.if
125160 - run : cargo test -p cargo-platform
161+ if : matrix.if
126162 - run : cargo test -p cargo-util
163+ if : matrix.if
127164 - run : cargo test --manifest-path crates/home/Cargo.toml
165+ if : matrix.if
128166 - run : cargo test --manifest-path crates/mdman/Cargo.toml
167+ if : matrix.if
129168 - run : cargo build --manifest-path crates/credential/cargo-credential-1password/Cargo.toml
169+ if : matrix.if
130170 - 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'
132172 - 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'
134174 - 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'
136176 - name : Check benchmarks
137177 env :
138178 # Share the target dir to try to cache a few build-time deps.
@@ -142,12 +182,15 @@ jobs:
142182 # download all workspaces.
143183 cargo test --manifest-path benches/benchsuite/Cargo.toml --all-targets -- cargo
144184 cargo check --manifest-path benches/capture/Cargo.toml
185+ if : matrix.if
145186 # The testsuite generates a huge amount of data, and fetch-smoke-test was
146187 # running out of disk space.
147188 - name : Clear benchmark output
148189 run : ci/clean-test-output.sh
190+ if : matrix.if
149191 - name : Fetch smoke test
150192 run : ci/fetch-smoke-test.sh
193+ if : matrix.if
151194
152195 resolver :
153196 runs-on : ubuntu-latest
@@ -170,6 +213,9 @@ jobs:
170213
171214 build_std :
172215 runs-on : ubuntu-latest
216+ needs :
217+ - channel
218+ if : ${{ needs.channel.outputs.CHANNEL == 'nightly' }}
173219 steps :
174220 - uses : actions/checkout@v3
175221 - run : rustup update nightly && rustup default nightly
@@ -180,8 +226,19 @@ jobs:
180226 CARGO_RUN_BUILD_STD_TESTS : 1
181227 docs :
182228 runs-on : ubuntu-latest
229+ needs :
230+ - channel
183231 steps :
184232 - 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"
185242 - run : rustup update nightly && rustup default nightly
186243 - run : rustup update stable
187244 - run : rustup component add rust-docs
@@ -196,10 +253,11 @@ jobs:
196253 env :
197254 RUSTDOCFLAGS : -D warnings
198255 - 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"
203261 sh linkcheck.sh --all cargo
204262
205263 success :
0 commit comments