|
1 | 1 | #!/bin/bash
|
2 |
| -# Set the SKIP_JOB environment variable if this job is supposed to only run |
3 |
| -# when submodules are updated and they were not. The following time consuming |
4 |
| -# tasks will be skipped when the environment variable is present. |
| 2 | +# Set the SKIP_JOB environment variable if this job is not supposed to run on the current builder. |
5 | 3 |
|
6 | 4 | set -euo pipefail
|
7 | 5 | IFS=$'\n\t'
|
8 | 6 |
|
9 | 7 | source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
|
10 | 8 |
|
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" -- \ |
22 |
| - src/tools/clippy src/tools/rustfmt src/tools/miri \ |
23 |
| - library/std/src/sys); then |
24 |
| - # There is not an easy blanket search for subtrees. For now, manually list |
25 |
| - # the subtrees. |
26 |
| - # Also run this when the platform-specific parts of std change, in case |
27 |
| - # that breaks Miri. |
28 |
| - echo "Tool subtrees were updated" |
29 |
| - elif ! (git diff --quiet "$BASE_COMMIT" -- \ |
30 |
| - tests/rustdoc-gui \ |
31 |
| - src/librustdoc \ |
32 |
| - src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile \ |
33 |
| - src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version \ |
34 |
| - src/tools/rustdoc-gui); then |
35 |
| - # There was a change in either rustdoc or in its GUI tests. |
36 |
| - echo "Rustdoc was updated" |
37 |
| - else |
38 |
| - echo "Not executing this job since no submodules nor subtrees were updated" |
39 |
| - ciCommandSetEnv SKIP_JOB 1 |
40 |
| - exit 0 |
41 |
| - fi |
42 |
| -fi |
43 |
| - |
44 | 9 | if [[ -n "${CI_ONLY_WHEN_CHANNEL-}" ]]; then
|
45 | 10 | if [[ "${CI_ONLY_WHEN_CHANNEL}" = "$(cat src/ci/channel)" ]]; then
|
46 | 11 | echo "The channel is the expected one"
|
|
0 commit comments