]> git.lizzy.rs Git - rust.git/blob - src/ci/github-actions/ci.yml
Checkout `master` branch in CI
[rust.git] / src / ci / github-actions / ci.yml
1 ######################################################
2 #   WARNING! Action needed when changing this file   #
3 ######################################################
4
5 # Due to GitHub Actions limitations, we can't use YAML Anchors directly in the
6 # CI configuration stored on the repository. To work around that this file is
7 # expanded by a tool in the repository, and the expansion is committed as well.
8 #
9 # After you make any change to the file you'll need to run this command:
10 #
11 #   ./x.py run src/tools/expand-yaml-anchors
12 #
13 # ...and commit the file it updated in addition to this one. If you forget this
14 # step CI will fail.
15
16 ---
17
18 ###############################
19 #   YAML Anchors Definition   #
20 ###############################
21
22 # This key contains most of the YAML anchors that will be used later in the
23 # document. YAML anchors allows us to greatly reduce duplication inside the CI
24 # configuration by reusing parts of the configuration.
25 #
26 # YAML anchors work by defining an anchor with `&anchor-name` and reusing its
27 # content in another place with `*anchor-name`. The special `<<` map key merges
28 # the content of the map with the content of the anchor (or list of anchors).
29 #
30 # The expand-yaml-anchors tool will automatically remove this block from the
31 # output YAML file.
32 x--expand-yaml-anchors--remove:
33
34   - &shared-ci-variables
35     CI_JOB_NAME: ${{ matrix.name }}
36
37   - &public-variables
38     SCCACHE_BUCKET: rust-lang-ci-sccache2
39     TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
40     CACHE_DOMAIN: ci-caches.rust-lang.org
41
42   - &prod-variables
43     SCCACHE_BUCKET: rust-lang-ci-sccache2
44     DEPLOY_BUCKET: rust-lang-ci2
45     TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
46     TOOLSTATE_ISSUES_API_URL: https://api.github.com/repos/rust-lang/rust/issues
47     TOOLSTATE_PUBLISH: 1
48     # AWS_SECRET_ACCESS_KEYs are stored in GitHub's secrets storage, named
49     # AWS_SECRET_ACCESS_KEY_<keyid>. Including the key id in the name allows to
50     # rotate them in a single branch while keeping the old key in another
51     # branch, which wouldn't be possible if the key was named with the kind
52     # (caches, artifacts...).
53     CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZI5DHEBFL
54     ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZN24CBO55
55     CACHE_DOMAIN: ci-caches.rust-lang.org
56
57   - &dummy-variables
58     SCCACHE_BUCKET: rust-lang-gha-caches
59     DEPLOY_BUCKET: rust-lang-gha
60     TOOLSTATE_REPO: https://github.com/pietroalbini/rust-toolstate
61     TOOLSTATE_ISSUES_API_URL: https://api.github.com/repos/pietroalbini/rust-toolstate/issues
62     TOOLSTATE_PUBLISH: 1
63     # AWS_SECRET_ACCESS_KEYs are stored in GitHub's secrets storage, named
64     # AWS_SECRET_ACCESS_KEY_<keyid>. Including the key id in the name allows to
65     # rotate them in a single branch while keeping the old key in another
66     # branch, which wouldn't be possible if the key was named with the kind
67     # (caches, artifacts...).
68     CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZOMUQATD5
69     ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZH5AYXDVF
70     CACHE_DOMAIN: ci-caches-gha.rust-lang.org
71
72   - &base-job
73     env: {}
74
75   - &job-linux-xl
76     os: ubuntu-20.04-xl
77     <<: *base-job
78
79   - &job-macos-xl
80     os: macos-12-xl
81     <<: *base-job
82
83   - &job-windows-xl
84     os: windows-latest-xl
85     <<: *base-job
86
87   - &job-aarch64-linux
88     os: [self-hosted, ARM64, linux]
89
90   - &step
91     if: success() && !env.SKIP_JOB
92
93   - &base-ci-job
94     timeout-minutes: 600
95     runs-on: "${{ matrix.os }}"
96     env: *shared-ci-variables
97     steps:
98       - name: disable git crlf conversion
99         run: git config --global core.autocrlf false
100
101       - name: checkout the source code
102         uses: actions/checkout@v3
103         with:
104           fetch-depth: 2
105
106       - name: checkout the `master` branch for tidy
107         uses: actions/checkout@v3
108         with:
109           ref: master
110           fetch-depth: 1
111
112       # Rust Log Analyzer can't currently detect the PR number of a GitHub
113       # Actions build on its own, so a hint in the log message is needed to
114       # point it in the right direction.
115       - name: configure the PR in which the error message will be posted
116         run: echo "[CI_PR_NUMBER=$num]"
117         env:
118           num: ${{ github.event.number }}
119         if: success() && !env.SKIP_JOB && github.event_name == 'pull_request'
120
121       - name: add extra environment variables
122         run: src/ci/scripts/setup-environment.sh
123         env:
124           # Since it's not possible to merge `${{ matrix.env }}` with the other
125           # variables in `job.<name>.env`, the variables defined in the matrix
126           # are passed to the `setup-environment.sh` script encoded in JSON,
127           # which then uses log commands to actually set them.
128           EXTRA_VARIABLES: ${{ toJson(matrix.env) }}
129         <<: *step
130
131       - name: decide whether to skip this job
132         run: src/ci/scripts/should-skip-this.sh
133         <<: *step
134
135       - name: ensure the channel matches the target branch
136         run: src/ci/scripts/verify-channel.sh
137         <<: *step
138
139       - name: configure GitHub Actions to kill the build when outdated
140         uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
141         with:
142           github_token: "${{ secrets.github_token }}"
143         if: success() && !env.SKIP_JOB && github.ref != 'refs/heads/try' && github.ref != 'refs/heads/try-perf'
144         <<: *step
145
146       - name: collect CPU statistics
147         run: src/ci/scripts/collect-cpu-stats.sh
148         <<: *step
149
150       - name: show the current environment
151         run: src/ci/scripts/dump-environment.sh
152         <<: *step
153
154       - name: install awscli
155         run: src/ci/scripts/install-awscli.sh
156         <<: *step
157
158       - name: install sccache
159         run: src/ci/scripts/install-sccache.sh
160         <<: *step
161
162       - name: select Xcode
163         run: src/ci/scripts/select-xcode.sh
164         <<: *step
165
166       - name: install clang
167         run: src/ci/scripts/install-clang.sh
168         <<: *step
169
170       - name: install WIX
171         run: src/ci/scripts/install-wix.sh
172         <<: *step
173
174       - name: disable git crlf conversion
175         run: src/ci/scripts/disable-git-crlf-conversion.sh
176         <<: *step
177
178       - name: checkout submodules
179         run: src/ci/scripts/checkout-submodules.sh
180         <<: *step
181
182       - name: install MSYS2
183         run: src/ci/scripts/install-msys2.sh
184         <<: *step
185
186       - name: install MinGW
187         run: src/ci/scripts/install-mingw.sh
188         <<: *step
189
190       - name: install ninja
191         run: src/ci/scripts/install-ninja.sh
192         <<: *step
193
194       - name: enable ipv6 on Docker
195         run: src/ci/scripts/enable-docker-ipv6.sh
196         <<: *step
197
198       # Disable automatic line ending conversion (again). On Windows, when we're
199       # installing dependencies, something switches the git configuration directory or
200       # re-enables autocrlf. We've not tracked down the exact cause -- and there may
201       # be multiple -- but this should ensure submodules are checked out with the
202       # appropriate line endings.
203       - name: disable git crlf conversion
204         run: src/ci/scripts/disable-git-crlf-conversion.sh
205         <<: *step
206
207       - name: ensure line endings are correct
208         run: src/ci/scripts/verify-line-endings.sh
209         <<: *step
210
211       - name: ensure backported commits are in upstream branches
212         run: src/ci/scripts/verify-backported-commits.sh
213         <<: *step
214
215       - name: ensure the stable version number is correct
216         run: src/ci/scripts/verify-stable-version-number.sh
217         <<: *step
218
219       - name: run the build
220         run: src/ci/scripts/run-build-from-ci.sh
221         env:
222           AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }}
223           AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}
224           TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
225         <<: *step
226
227       - name: upload artifacts to S3
228         run: src/ci/scripts/upload-artifacts.sh
229         env:
230           AWS_ACCESS_KEY_ID: ${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}
231           AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}
232         # Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
233         # builders *should* have the AWS credentials available. Still, explicitly
234         # adding the condition is helpful as this way CI will not silently skip
235         # deploying artifacts from a dist builder if the variables are misconfigured,
236         # erroring about invalid credentials instead.
237         if: success() && !env.SKIP_JOB && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')
238         <<: *step
239
240   # These snippets are used by the try-success, try-failure, auto-success and auto-failure jobs.
241   # Check out their documentation for more information on why they're needed.
242
243   - &base-outcome-job
244     name: bors build finished
245     runs-on: ubuntu-latest
246
247   - &base-success-job
248     steps:
249       - name: mark the job as a success
250         run: exit 0
251         shell: bash
252     <<: *base-outcome-job
253
254   - &base-failure-job
255     steps:
256       - name: mark the job as a failure
257         run: exit 1
258         shell: bash
259     <<: *base-outcome-job
260
261 ###########################
262 #   Builders definition   #
263 ###########################
264
265 name: CI
266 on:
267   push:
268     branches:
269       - auto
270       - try
271       - try-perf
272       - master
273   pull_request:
274     branches:
275       - "**"
276
277 permissions:
278   contents: read
279
280 defaults:
281   run:
282     # On Linux, macOS, and Windows, use the system-provided bash as the default
283     # shell. (This should only make a difference on Windows, where the default
284     # shell is PowerShell.)
285     shell: bash
286
287 jobs:
288   pr:
289     permissions:
290       actions: write # for rust-lang/simpleinfra/github-actions/cancel-outdated-builds
291     <<: *base-ci-job
292     name: PR
293     env:
294       <<: [*shared-ci-variables, *public-variables]
295     if: github.event_name == 'pull_request'
296     continue-on-error: ${{ matrix.tidy }}
297     strategy:
298       matrix:
299         include:
300           - name: mingw-check
301             <<: *job-linux-xl
302             tidy: false
303
304           - name: mingw-check-tidy
305             <<: *job-linux-xl
306             tidy: true
307
308           - name: x86_64-gnu-llvm-13
309             <<: *job-linux-xl
310             tidy: false
311
312           - name: x86_64-gnu-tools
313             <<: *job-linux-xl
314             tidy: false
315             env:
316               CI_ONLY_WHEN_SUBMODULES_CHANGED: 1
317
318   auto:
319     permissions:
320       actions: write # for rust-lang/simpleinfra/github-actions/cancel-outdated-builds
321     <<: *base-ci-job
322     name: auto
323     env:
324       <<: [*shared-ci-variables, *prod-variables]
325     if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
326     strategy:
327       matrix:
328         include:
329           #############################
330           #   Linux/Docker builders   #
331           #############################
332
333           - name: aarch64-gnu
334             <<: *job-aarch64-linux
335
336           - name: arm-android
337             <<: *job-linux-xl
338
339           - name: armhf-gnu
340             <<: *job-linux-xl
341
342           - name: dist-aarch64-linux
343             <<: *job-linux-xl
344
345           - name: dist-android
346             <<: *job-linux-xl
347
348           - name: dist-arm-linux
349             <<: *job-linux-xl
350
351           - name: dist-armhf-linux
352             <<: *job-linux-xl
353
354           - name: dist-armv7-linux
355             <<: *job-linux-xl
356
357           - name: dist-i586-gnu-i586-i686-musl
358             <<: *job-linux-xl
359
360           - name: dist-i686-linux
361             <<: *job-linux-xl
362
363           - name: dist-mips-linux
364             <<: *job-linux-xl
365
366           - name: dist-mips64-linux
367             <<: *job-linux-xl
368
369           - name: dist-mips64el-linux
370             <<: *job-linux-xl
371
372           - name: dist-mipsel-linux
373             <<: *job-linux-xl
374
375           - name: dist-powerpc-linux
376             <<: *job-linux-xl
377
378           - name: dist-powerpc64-linux
379             <<: *job-linux-xl
380
381           - name: dist-powerpc64le-linux
382             <<: *job-linux-xl
383
384           - name: dist-riscv64-linux
385             <<: *job-linux-xl
386
387           - name: dist-s390x-linux
388             <<: *job-linux-xl
389
390           - name: dist-various-1
391             <<: *job-linux-xl
392
393           - name: dist-various-2
394             <<: *job-linux-xl
395
396           - name: dist-x86_64-freebsd
397             <<: *job-linux-xl
398
399           - name: dist-x86_64-illumos
400             <<: *job-linux-xl
401
402           - &dist-x86_64-linux
403             name: dist-x86_64-linux
404             <<: *job-linux-xl
405
406           - name: dist-x86_64-linux-alt
407             env:
408               IMAGE: dist-x86_64-linux
409             <<: *job-linux-xl
410
411           - name: dist-x86_64-musl
412             <<: *job-linux-xl
413
414           - name: dist-x86_64-netbsd
415             <<: *job-linux-xl
416
417           - name: i686-gnu
418             <<: *job-linux-xl
419
420           - name: i686-gnu-nopt
421             <<: *job-linux-xl
422
423           - name: mingw-check
424             <<: *job-linux-xl
425
426           - name: test-various
427             <<: *job-linux-xl
428
429           - name: wasm32
430             <<: *job-linux-xl
431
432           - name: x86_64-gnu
433             <<: *job-linux-xl
434
435           # This job ensures commits landing on nightly still pass the full
436           # test suite on the stable channel. There are some UI tests that
437           # depend on the channel being built (for example if they include the
438           # channel name on the output), and this builder prevents landing
439           # changes that would result in broken builds after a promotion.
440           - name: x86_64-gnu-stable
441             env:
442               IMAGE: x86_64-gnu
443               RUST_CI_OVERRIDE_RELEASE_CHANNEL: stable
444               # Only run this job on the nightly channel. Running this on beta
445               # could cause failures when `dev: 1` in `stage0.txt`, and running
446               # this on stable is useless.
447               CI_ONLY_WHEN_CHANNEL: nightly
448             <<: *job-linux-xl
449
450           - name: x86_64-gnu-aux
451             <<: *job-linux-xl
452
453           - name: x86_64-gnu-debug
454             <<: *job-linux-xl
455
456           - name: x86_64-gnu-distcheck
457             <<: *job-linux-xl
458
459           - name: x86_64-gnu-llvm-13
460             env:
461               RUST_BACKTRACE: 1
462             <<: *job-linux-xl
463
464           - name: x86_64-gnu-llvm-13-stage1
465             env:
466               RUST_BACKTRACE: 1
467             <<: *job-linux-xl
468
469           - name: x86_64-gnu-nopt
470             <<: *job-linux-xl
471
472           - name: x86_64-gnu-tools
473             env:
474               DEPLOY_TOOLSTATES_JSON: toolstates-linux.json
475             <<: *job-linux-xl
476
477           ####################
478           #  macOS Builders  #
479           ####################
480
481           - name: dist-x86_64-apple
482             env:
483               SCRIPT: ./x.py dist bootstrap --include-default-paths --host=x86_64-apple-darwin --target=x86_64-apple-darwin
484               RUST_CONFIGURE_ARGS: --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false --set rust.lto=thin
485               RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
486               MACOSX_DEPLOYMENT_TARGET: 10.7
487               SELECT_XCODE: /Applications/Xcode_13.4.1.app
488               NO_LLVM_ASSERTIONS: 1
489               NO_DEBUG_ASSERTIONS: 1
490               NO_OVERFLOW_CHECKS: 1
491               DIST_REQUIRE_ALL_TOOLS: 1
492             <<: *job-macos-xl
493
494           - name: dist-apple-various
495             env:
496               SCRIPT: ./x.py dist bootstrap --include-default-paths --host='' --target=aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim
497               RUST_CONFIGURE_ARGS: --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false
498               RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
499               MACOSX_DEPLOYMENT_TARGET: 10.7
500               SELECT_XCODE: /Applications/Xcode_13.4.1.app
501               NO_LLVM_ASSERTIONS: 1
502               NO_DEBUG_ASSERTIONS: 1
503               NO_OVERFLOW_CHECKS: 1
504             <<: *job-macos-xl
505
506           - name: dist-x86_64-apple-alt
507             env:
508               SCRIPT: ./x.py dist bootstrap --include-default-paths
509               RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc --set llvm.ninja=false
510               RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
511               MACOSX_DEPLOYMENT_TARGET: 10.7
512               SELECT_XCODE: /Applications/Xcode_13.4.1.app
513               NO_LLVM_ASSERTIONS: 1
514               NO_DEBUG_ASSERTIONS: 1
515               NO_OVERFLOW_CHECKS: 1
516             <<: *job-macos-xl
517
518           - name: x86_64-apple-1
519             env: &env-x86_64-apple-tests
520               SCRIPT: ./x.py --stage 2 test --exclude src/test/ui --exclude src/test/rustdoc --exclude src/test/run-make-fulldeps
521               RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false
522               RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
523               MACOSX_DEPLOYMENT_TARGET: 10.8
524               MACOSX_STD_DEPLOYMENT_TARGET: 10.7
525               NO_LLVM_ASSERTIONS: 1
526               NO_DEBUG_ASSERTIONS: 1
527               NO_OVERFLOW_CHECKS: 1
528             <<: *job-macos-xl
529
530           - name: x86_64-apple-2
531             env:
532               SCRIPT: ./x.py --stage 2 test src/test/ui src/test/rustdoc src/test/run-make-fulldeps
533               <<: *env-x86_64-apple-tests
534             <<: *job-macos-xl
535
536           # This target only needs to support 11.0 and up as nothing else supports the hardware
537           - name: dist-aarch64-apple
538             env:
539               SCRIPT: ./x.py dist bootstrap --include-default-paths --stage 2
540               RUST_CONFIGURE_ARGS: >-
541                 --build=x86_64-apple-darwin
542                 --host=aarch64-apple-darwin
543                 --target=aarch64-apple-darwin
544                 --enable-full-tools
545                 --enable-sanitizers
546                 --enable-profiler
547                 --disable-docs
548                 --set rust.jemalloc
549                 --set llvm.ninja=false
550               RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
551               SELECT_XCODE: /Applications/Xcode_13.4.1.app
552               USE_XCODE_CLANG: 1
553               MACOSX_DEPLOYMENT_TARGET: 11.0
554               MACOSX_STD_DEPLOYMENT_TARGET: 11.0
555               NO_LLVM_ASSERTIONS: 1
556               NO_DEBUG_ASSERTIONS: 1
557               NO_OVERFLOW_CHECKS: 1
558               DIST_REQUIRE_ALL_TOOLS: 1
559               # Corresponds to 16K page size
560               #
561               # Shouldn't be needed if jemalloc-sys is updated to
562               # handle this platform like iOS or if we build on
563               # aarch64-apple-darwin itself.
564               #
565               # https://github.com/gnzlbg/jemallocator/blob/c27a859e98e3cb790dc269773d9da71a1e918458/jemalloc-sys/build.rs#L237
566               JEMALLOC_SYS_WITH_LG_PAGE: 14
567             <<: *job-macos-xl
568
569           ######################
570           #  Windows Builders  #
571           ######################
572
573           - name: x86_64-msvc-1
574             env:
575               RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
576               SCRIPT: make ci-subset-1
577             <<: *job-windows-xl
578
579           - name: x86_64-msvc-2
580             env:
581               RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
582               SCRIPT: make ci-subset-2
583             <<: *job-windows-xl
584
585           - name: i686-msvc-1
586             env:
587               RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
588               SCRIPT: make ci-subset-1
589             <<: *job-windows-xl
590
591           - name: i686-msvc-2
592             env:
593               RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
594               SCRIPT: make ci-subset-2
595             <<: *job-windows-xl
596
597           - name: x86_64-msvc-cargo
598             env:
599               SCRIPT: python x.py --stage 2 test src/tools/cargotest src/tools/cargo
600               RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld
601             <<: *job-windows-xl
602
603           - name: x86_64-msvc-tools
604             env:
605               SCRIPT: src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows
606               RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstate/toolstates.json
607               DEPLOY_TOOLSTATES_JSON: toolstates-windows.json
608             <<: *job-windows-xl
609
610           # 32/64-bit MinGW builds.
611           #
612           # We are using MinGW with POSIX threads since LLVM requires
613           # C++'s std::thread which is disabled in libstdc++ with win32 threads.
614           # FIXME: Libc++ doesn't have this limitation so we can avoid
615           # winpthreads if we switch to it.
616           #
617           # Instead of relying on the MinGW version installed on CI we download
618           # and install one ourselves so we won't be surprised by changes to CI's
619           # build image.
620           #
621           # Finally, note that the downloads below are all in the `rust-lang-ci` S3
622           # bucket, but they clearly didn't originate there! The downloads originally
623           # came from the mingw-w64 SourceForge download site. Unfortunately
624           # SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
625
626           - name: i686-mingw-1
627             env:
628               RUST_CONFIGURE_ARGS: >-
629                 --build=i686-pc-windows-gnu
630                 --set llvm.allow-old-toolchain
631               SCRIPT: make ci-mingw-subset-1
632               # We are intentionally allowing an old toolchain on this builder (and that's
633               # incompatible with LLVM downloads today).
634               NO_DOWNLOAD_CI_LLVM: 1
635               CUSTOM_MINGW: 1
636             <<: *job-windows-xl
637
638           - name: i686-mingw-2
639             env:
640               RUST_CONFIGURE_ARGS: >-
641                 --build=i686-pc-windows-gnu
642                 --set llvm.allow-old-toolchain
643               SCRIPT: make ci-mingw-subset-2
644               # We are intentionally allowing an old toolchain on this builder (and that's
645               # incompatible with LLVM downloads today).
646               NO_DOWNLOAD_CI_LLVM: 1
647               CUSTOM_MINGW: 1
648             <<: *job-windows-xl
649
650           - name: x86_64-mingw-1
651             env:
652               SCRIPT: make ci-mingw-subset-1
653               RUST_CONFIGURE_ARGS: >-
654                 --build=x86_64-pc-windows-gnu
655                 --enable-profiler
656                 --set llvm.allow-old-toolchain
657               # We are intentionally allowing an old toolchain on this builder (and that's
658               # incompatible with LLVM downloads today).
659               NO_DOWNLOAD_CI_LLVM: 1
660               CUSTOM_MINGW: 1
661             <<: *job-windows-xl
662
663           - name: x86_64-mingw-2
664             env:
665               SCRIPT: make ci-mingw-subset-2
666               RUST_CONFIGURE_ARGS: >-
667                 --build=x86_64-pc-windows-gnu
668                 --enable-profiler
669                 --set llvm.allow-old-toolchain
670               # We are intentionally allowing an old toolchain on this builder (and that's
671               # incompatible with LLVM downloads today).
672               NO_DOWNLOAD_CI_LLVM: 1
673               CUSTOM_MINGW: 1
674             <<: *job-windows-xl
675
676           - name: dist-x86_64-msvc
677             env:
678               RUST_CONFIGURE_ARGS: >-
679                 --build=x86_64-pc-windows-msvc
680                 --host=x86_64-pc-windows-msvc
681                 --target=x86_64-pc-windows-msvc
682                 --enable-full-tools
683                 --enable-profiler
684                 --set rust.lto=thin
685               SCRIPT: PGO_HOST=x86_64-pc-windows-msvc src/ci/pgo.sh python x.py dist bootstrap --include-default-paths
686               DIST_REQUIRE_ALL_TOOLS: 1
687             <<: *job-windows-xl
688
689           - name: dist-i686-msvc
690             env:
691               RUST_CONFIGURE_ARGS: >-
692                 --build=i686-pc-windows-msvc
693                 --host=i686-pc-windows-msvc
694                 --target=i686-pc-windows-msvc,i586-pc-windows-msvc
695                 --enable-full-tools
696                 --enable-profiler
697               SCRIPT: python x.py dist bootstrap --include-default-paths
698               DIST_REQUIRE_ALL_TOOLS: 1
699             <<: *job-windows-xl
700
701           - name: dist-aarch64-msvc
702             env:
703               RUST_CONFIGURE_ARGS: >-
704                 --build=x86_64-pc-windows-msvc
705                 --host=aarch64-pc-windows-msvc
706                 --enable-full-tools
707                 --enable-profiler
708               SCRIPT: python x.py dist bootstrap --include-default-paths
709               DIST_REQUIRE_ALL_TOOLS: 1
710               # Hack around this SDK version, because it doesn't work with clang.
711               # See https://github.com/rust-lang/rust/issues/88796
712               WINDOWS_SDK_20348_HACK: 1
713             <<: *job-windows-xl
714
715           - name: dist-i686-mingw
716             env:
717               RUST_CONFIGURE_ARGS: >-
718                 --build=i686-pc-windows-gnu
719                 --enable-full-tools
720                 --enable-profiler
721                 --set llvm.allow-old-toolchain
722               # We are intentionally allowing an old toolchain on this builder (and that's
723               # incompatible with LLVM downloads today).
724               NO_DOWNLOAD_CI_LLVM: 1
725               SCRIPT: python x.py dist bootstrap --include-default-paths
726               CUSTOM_MINGW: 1
727               DIST_REQUIRE_ALL_TOOLS: 1
728             <<: *job-windows-xl
729
730           - name: dist-x86_64-mingw
731             env:
732               SCRIPT: python x.py dist bootstrap --include-default-paths
733               RUST_CONFIGURE_ARGS: >-
734                 --build=x86_64-pc-windows-gnu
735                 --enable-full-tools
736                 --enable-profiler
737                 --set llvm.allow-old-toolchain
738               # We are intentionally allowing an old toolchain on this builder (and that's
739               # incompatible with LLVM downloads today).
740               NO_DOWNLOAD_CI_LLVM: 1
741               CUSTOM_MINGW: 1
742               DIST_REQUIRE_ALL_TOOLS: 1
743             <<: *job-windows-xl
744
745           - name: dist-x86_64-msvc-alt
746             env:
747               RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
748               SCRIPT: python x.py dist bootstrap --include-default-paths
749             <<: *job-windows-xl
750
751   try:
752     permissions:
753       actions: write # for rust-lang/simpleinfra/github-actions/cancel-outdated-builds
754     <<: *base-ci-job
755     name: try
756     env:
757       <<: [*shared-ci-variables, *prod-variables]
758     if: github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'
759     strategy:
760       matrix:
761         include:
762           - &dist-x86_64-linux
763             name: dist-x86_64-linux
764             <<: *job-linux-xl
765
766   master:
767     name: master
768     runs-on: ubuntu-latest
769     env:
770       <<: [*prod-variables]
771     if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'
772     steps:
773       - name: checkout the source code
774         uses: actions/checkout@v3
775         with:
776           fetch-depth: 2
777
778       - name: publish toolstate
779         run: src/ci/publish_toolstate.sh
780         shell: bash
781         env:
782           TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
783         <<: *step
784
785   # These jobs don't actually test anything, but they're used to tell bors the
786   # build completed, as there is no practical way to detect when a workflow is
787   # successful listening to webhooks only.
788   try-success:
789     needs: [try]
790     if: "success() && github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'"
791     <<: *base-success-job
792   try-failure:
793     needs: [try]
794     if: "!success() && github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'"
795     <<: *base-failure-job
796   auto-success:
797     needs: [auto]
798     if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
799     <<: *base-success-job
800   auto-failure:
801     needs: [auto]
802     if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
803     <<: *base-failure-job