1
1
# This file defines our primary CI workflow that runs on pull requests
2
2
# and also on pushes to special branches (auto, try).
3
3
#
4
- # The actual definition of the executed jobs is calculated by a Python
5
- # script located at src/ci/github-actions/calculate-job-matrix.py , which
4
+ # The actual definition of the executed jobs is calculated by the
5
+ # ` src/ci/citool` crate , which
6
6
# uses job definition data from src/ci/github-actions/jobs.yml.
7
7
# You should primarily modify the `jobs.yml` file if you want to modify
8
8
# what jobs are executed in CI.
46
46
# If you want to modify CI jobs, take a look at src/ci/github-actions/jobs.yml.
47
47
calculate_matrix :
48
48
name : Calculate job matrix
49
- runs-on : ubuntu-latest
49
+ runs-on : ubuntu-24.04
50
50
outputs :
51
51
jobs : ${{ steps.jobs.outputs.jobs }}
52
52
run_type : ${{ steps.jobs.outputs.run_type }}
@@ -56,46 +56,31 @@ jobs:
56
56
- name : Calculate the CI job matrix
57
57
env :
58
58
COMMIT_MESSAGE : ${{ github.event.head_commit.message }}
59
- run : python3 src/ci/github-actions/calculate-job-matrix.py >> $GITHUB_OUTPUT
59
+ run : |
60
+ cd src/ci/citool
61
+ cargo test
62
+ cargo run calculate-job-matrix >> $GITHUB_OUTPUT
60
63
id : jobs
61
64
job :
62
- name : ${{ matrix.name }}
65
+ name : ${{ matrix.full_name }}
63
66
needs : [ calculate_matrix ]
64
67
runs-on : " ${{ matrix.os }}"
65
- defaults :
66
- run :
67
- shell : ${{ contains(matrix.os, 'windows') && 'msys2 {0}' || 'bash' }}
68
- timeout-minutes : 240
68
+ timeout-minutes : 360
69
69
env :
70
- CI_JOB_NAME : ${{ matrix.image }}
70
+ CI_JOB_NAME : ${{ matrix.name }}
71
71
CARGO_REGISTRIES_CRATES_IO_PROTOCOL : sparse
72
72
# commit of PR sha or commit sha. `GITHUB_SHA` is not accurate for PRs.
73
73
HEAD_SHA : ${{ github.event.pull_request.head.sha || github.sha }}
74
74
DOCKER_TOKEN : ${{ secrets.GITHUB_TOKEN }}
75
75
SCCACHE_BUCKET : rust-lang-ci-sccache2
76
+ SCCACHE_REGION : us-west-1
76
77
CACHE_DOMAIN : ci-caches.rust-lang.org
77
78
continue-on-error : ${{ matrix.continue_on_error || false }}
78
79
strategy :
79
80
matrix :
80
81
# Check the `calculate_matrix` job to see how is the matrix defined.
81
82
include : ${{ fromJSON(needs.calculate_matrix.outputs.jobs) }}
82
83
steps :
83
- - if : contains(matrix.os, 'windows')
84
-
85
- with :
86
- # i686 jobs use mingw32. x86_64 and cross-compile jobs use mingw64.
87
- msystem : ${{ contains(matrix.name, 'i686') && 'mingw32' || 'mingw64' }}
88
- # don't try to download updates for already installed packages
89
- update : false
90
- # don't try to use the msys that comes built-in to the github runner,
91
- # so we can control what is installed (i.e. not python)
92
- release : true
93
- # Inherit the full path from the Windows environment, with MSYS2's */bin/
94
- # dirs placed in front. This lets us run Windows-native Python etc.
95
- path-type : inherit
96
- install : >
97
- make
98
-
99
84
- name : disable git crlf conversion
100
85
run : git config --global core.autocrlf false
101
86
@@ -104,6 +89,14 @@ jobs:
104
89
with :
105
90
fetch-depth : 2
106
91
92
+ # Free up disk space on Linux by removing preinstalled components that
93
+ # we do not need. We do this to enable some of the less resource
94
+ # intensive jobs to run on free runners, which however also have
95
+ # less disk space.
96
+ - name : free up disk space
97
+ run : src/ci/scripts/free-disk-space.sh
98
+ if : matrix.free_disk
99
+
107
100
# Rust Log Analyzer can't currently detect the PR number of a GitHub
108
101
# Actions build on its own, so a hint in the log message is needed to
109
102
# point it in the right direction.
@@ -122,6 +115,9 @@ jobs:
122
115
# which then uses log commands to actually set them.
123
116
EXTRA_VARIABLES : ${{ toJson(matrix.env) }}
124
117
118
+ - name : setup upstream remote
119
+ run : src/ci/scripts/setup-upstream-remote.sh
120
+
125
121
- name : ensure the channel matches the target branch
126
122
run : src/ci/scripts/verify-channel.sh
127
123
@@ -181,6 +177,11 @@ jobs:
181
177
- name : ensure the stable version number is correct
182
178
run : src/ci/scripts/verify-stable-version-number.sh
183
179
180
+ # Show the environment just before we run the build
181
+ # This makes it easier to diagnose problems with the above install scripts.
182
+ - name : show the current environment
183
+ run : src/ci/scripts/dump-environment.sh
184
+
184
185
- name : run the build
185
186
# Redirect stderr to stdout to avoid reordering the two streams in the GHA logs.
186
187
run : src/ci/scripts/run-build-from-ci.sh 2>&1
@@ -191,6 +192,11 @@ jobs:
191
192
- name : create github artifacts
192
193
run : src/ci/scripts/create-doc-artifacts.sh
193
194
195
+ - name : print disk usage
196
+ run : |
197
+ echo "disk usage:"
198
+ df -h
199
+
194
200
- name : upload artifacts to github
195
201
uses : actions/upload-artifact@v4
196
202
with :
@@ -212,11 +218,22 @@ jobs:
212
218
# erroring about invalid credentials instead.
213
219
if : github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1'
214
220
221
+ - name : upload job metrics to DataDog
222
+ if : needs.calculate_matrix.outputs.run_type != 'pr'
223
+ env :
224
+ DATADOG_SITE : datadoghq.com
225
+ DATADOG_API_KEY : ${{ secrets.DATADOG_API_KEY }}
226
+ DD_GITHUB_JOB_NAME : ${{ matrix.full_name }}
227
+ run : |
228
+ cd src/ci
229
+ npm ci
230
+ python3 scripts/upload-build-metrics.py ../../build/cpu-usage.csv
231
+
215
232
# This job isused to tell bors the final status of the build, as there is no practical way to detect
216
233
# when a workflow is successful listening to webhooks only in our current bors implementation (homu).
217
234
outcome :
218
235
name : bors build finished
219
- runs-on : ubuntu-latest
236
+ runs-on : ubuntu-24.04
220
237
needs : [ calculate_matrix, job ]
221
238
# !cancelled() executes the job regardless of whether the previous jobs passed or failed
222
239
if : ${{ !cancelled() && contains(fromJSON('["auto", "try"]'), needs.calculate_matrix.outputs.run_type) }}
0 commit comments