Skip to content

Commit 65003c6

Browse files
authored
Rollup merge of #87550 - pietroalbini:ci-only-when-channel, r=Mark-Simulacrum
Add `CI_ONLY_WHEN_CHANNEL` and run `x86_64-gnu-stable` only on nightly Backporting a commit made on #87508. cc ``@Mark-Simulacrum``
2 parents 9e94d7b + 4b5ac09 commit 65003c6

File tree

3 files changed

+42
-25
lines changed

3 files changed

+42
-25
lines changed

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ jobs:
263263
env:
264264
IMAGE: x86_64-gnu
265265
RUST_CI_OVERRIDE_RELEASE_CHANNEL: stable
266+
CI_ONLY_WHEN_CHANNEL: nightly
266267
os: ubuntu-latest-xl
267268
- name: x86_64-gnu-aux
268269
os: ubuntu-latest-xl

src/ci/github-actions/ci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,10 @@ jobs:
416416
env:
417417
IMAGE: x86_64-gnu
418418
RUST_CI_OVERRIDE_RELEASE_CHANNEL: stable
419+
# Only run this job on the nightly channel. Running this on beta
420+
# could cause failures when `dev: 1` in `stage0.txt`, and running
421+
# this on stable is useless.
422+
CI_ONLY_WHEN_CHANNEL: nightly
419423
<<: *job-linux-xl
420424

421425
- name: x86_64-gnu-aux

src/ci/scripts/should-skip-this.sh

+37-25
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,43 @@ IFS=$'\n\t'
88

99
source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
1010

11-
if [[ -z "${CI_ONLY_WHEN_SUBMODULES_CHANGED+x}" ]]; then
12-
echo "Executing the job since there is no skip rule in effect"
13-
exit 0
11+
if [[ -n "${CI_ONLY_WHEN_SUBMODULES_CHANGED-}" ]]; then
12+
git fetch "https://github.com/$GITHUB_REPOSITORY" "$GITHUB_BASE_REF"
13+
BASE_COMMIT="$(git merge-base FETCH_HEAD HEAD)"
14+
15+
echo "Searching for toolstate changes between $BASE_COMMIT and $(git rev-parse HEAD)"
16+
17+
if git diff "$BASE_COMMIT" | grep --quiet "^index .* 160000"; then
18+
# Submodules pseudo-files inside git have the 160000 permissions, so when
19+
# those files are present in the diff a submodule was updated.
20+
echo "Submodules were updated"
21+
elif ! git diff --quiet "$BASE_COMMIT" -- src/tools/clippy src/tools/rustfmt; then
22+
# There is not an easy blanket search for subtrees. For now, manually list
23+
# the subtrees.
24+
echo "Clippy or rustfmt subtrees were updated"
25+
elif ! (git diff --quiet "$BASE_COMMIT" -- \
26+
src/test/rustdoc-gui \
27+
src/librustdoc \
28+
src/tools/rustdoc-gui); then
29+
# There was a change in either rustdoc or in its GUI tests.
30+
echo "Rustdoc was updated"
31+
else
32+
echo "Not executing this job since no submodules nor subtrees were updated"
33+
ciCommandSetEnv SKIP_JOB 1
34+
exit 0
35+
fi
1436
fi
1537

16-
git fetch "https://github.com/$GITHUB_REPOSITORY" "$GITHUB_BASE_REF"
17-
BASE_COMMIT="$(git merge-base FETCH_HEAD HEAD)"
18-
19-
echo "Searching for toolstate changes between $BASE_COMMIT and $(git rev-parse HEAD)"
20-
21-
if git diff "$BASE_COMMIT" | grep --quiet "^index .* 160000"; then
22-
# Submodules pseudo-files inside git have the 160000 permissions, so when
23-
# those files are present in the diff a submodule was updated.
24-
echo "Executing the job since submodules are updated"
25-
elif ! git diff --quiet "$BASE_COMMIT" -- src/tools/clippy src/tools/rustfmt; then
26-
# There is not an easy blanket search for subtrees. For now, manually list
27-
# the subtrees.
28-
echo "Executing the job since clippy or rustfmt subtree was updated"
29-
elif ! (git diff --quiet "$BASE_COMMIT" -- \
30-
src/test/rustdoc-gui \
31-
src/librustdoc \
32-
src/tools/rustdoc-gui); then
33-
# There was a change in either rustdoc or in its GUI tests.
34-
echo "Executing the job since rustdoc was updated"
35-
else
36-
echo "Not executing this job since no submodules nor subtrees were updated"
37-
ciCommandSetEnv SKIP_JOB 1
38+
if [[ -n "${CI_ONLY_WHEN_CHANNEL-}" ]]; then
39+
if [[ "${CI_ONLY_WHEN_CHANNEL}" = "$(cat src/ci/channel)" ]]; then
40+
echo "The channel is the expected one"
41+
else
42+
echo "Not executing this job as the channel is not the expected one"
43+
ciCommandSetEnv SKIP_JOB 1
44+
exit 0
45+
fi
3846
fi
47+
48+
49+
echo "Executing the job since there is no skip rule preventing the execution"
50+
exit 0

0 commit comments

Comments
 (0)