1 ######################################################
2 # WARNING! Action needed when changing this file #
3 ######################################################
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.
9 # After you make any change to the file you'll need to run this command:
11 # ./x.py run src/tools/expand-yaml-anchors
13 # ...and commit the file it updated in addition to this one. If you forget this
18 ###############################
19 # YAML Anchors Definition #
20 ###############################
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.
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).
30 # The expand-yaml-anchors tool will automatically remove this block from the
32 x--expand-yaml-anchors--remove:
34 - &shared-ci-variables
35 CI_JOB_NAME: ${{ matrix.name }}
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
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
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
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
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
80 os: macos-latest # We don't have an XL builder for this
88 os: [self-hosted, ARM64, linux]
91 if: success() && !env.SKIP_JOB
95 runs-on: "${{ matrix.os }}"
96 env: *shared-ci-variables
98 - name: disable git crlf conversion
99 run: git config --global core.autocrlf false
101 - name: checkout the source code
102 uses: actions/checkout@v3
106 # Rust Log Analyzer can't currently detect the PR number of a GitHub
107 # Actions build on its own, so a hint in the log message is needed to
108 # point it in the right direction.
109 - name: configure the PR in which the error message will be posted
110 run: echo "[CI_PR_NUMBER=$num]"
112 num: ${{ github.event.number }}
113 if: success() && !env.SKIP_JOB && github.event_name == 'pull_request'
115 - name: add extra environment variables
116 run: src/ci/scripts/setup-environment.sh
118 # Since it's not possible to merge `${{ matrix.env }}` with the other
119 # variables in `job.<name>.env`, the variables defined in the matrix
120 # are passed to the `setup-environment.sh` script encoded in JSON,
121 # which then uses log commands to actually set them.
122 EXTRA_VARIABLES: ${{ toJson(matrix.env) }}
125 - name: decide whether to skip this job
126 run: src/ci/scripts/should-skip-this.sh
129 - name: ensure the channel matches the target branch
130 run: src/ci/scripts/verify-channel.sh
133 - name: configure GitHub Actions to kill the build when outdated
134 uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
136 github_token: "${{ secrets.github_token }}"
137 if: success() && !env.SKIP_JOB && github.ref != 'refs/heads/try' && github.ref != 'refs/heads/try-perf'
140 - name: collect CPU statistics
141 run: src/ci/scripts/collect-cpu-stats.sh
144 - name: show the current environment
145 run: src/ci/scripts/dump-environment.sh
148 - name: install awscli
149 run: src/ci/scripts/install-awscli.sh
152 - name: install sccache
153 run: src/ci/scripts/install-sccache.sh
156 - name: install clang
157 run: src/ci/scripts/install-clang.sh
161 run: src/ci/scripts/install-wix.sh
164 - name: disable git crlf conversion
165 run: src/ci/scripts/disable-git-crlf-conversion.sh
168 - name: checkout submodules
169 run: src/ci/scripts/checkout-submodules.sh
172 - name: install MSYS2
173 run: src/ci/scripts/install-msys2.sh
176 - name: install MinGW
177 run: src/ci/scripts/install-mingw.sh
180 - name: install ninja
181 run: src/ci/scripts/install-ninja.sh
184 - name: enable ipv6 on Docker
185 run: src/ci/scripts/enable-docker-ipv6.sh
188 # Disable automatic line ending conversion (again). On Windows, when we're
189 # installing dependencies, something switches the git configuration directory or
190 # re-enables autocrlf. We've not tracked down the exact cause -- and there may
191 # be multiple -- but this should ensure submodules are checked out with the
192 # appropriate line endings.
193 - name: disable git crlf conversion
194 run: src/ci/scripts/disable-git-crlf-conversion.sh
197 - name: ensure line endings are correct
198 run: src/ci/scripts/verify-line-endings.sh
201 - name: ensure backported commits are in upstream branches
202 run: src/ci/scripts/verify-backported-commits.sh
205 - name: ensure the stable version number is correct
206 run: src/ci/scripts/verify-stable-version-number.sh
209 - name: run the build
210 run: src/ci/scripts/run-build-from-ci.sh
212 AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }}
213 AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}
214 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
217 - name: upload artifacts to S3
218 run: src/ci/scripts/upload-artifacts.sh
220 AWS_ACCESS_KEY_ID: ${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}
221 AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}
222 # Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
223 # builders *should* have the AWS credentials available. Still, explicitly
224 # adding the condition is helpful as this way CI will not silently skip
225 # deploying artifacts from a dist builder if the variables are misconfigured,
226 # erroring about invalid credentials instead.
227 if: success() && !env.SKIP_JOB && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')
230 # These snippets are used by the try-success, try-failure, auto-success and auto-failure jobs.
231 # Check out their documentation for more information on why they're needed.
234 name: bors build finished
235 runs-on: ubuntu-latest
239 - name: mark the job as a success
242 <<: *base-outcome-job
246 - name: mark the job as a failure
249 <<: *base-outcome-job
251 ###########################
252 # Builders definition #
253 ###########################
269 # On Linux, macOS, and Windows, use the system-provided bash as the default
270 # shell. (This should only make a difference on Windows, where the default
271 # shell is PowerShell.)
279 <<: [*shared-ci-variables, *public-variables]
280 if: github.event_name == 'pull_request'
287 - name: x86_64-gnu-llvm-13
290 - name: x86_64-gnu-tools
292 CI_ONLY_WHEN_SUBMODULES_CHANGED: 1
299 <<: [*shared-ci-variables, *prod-variables]
300 if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
304 #############################
305 # Linux/Docker builders #
306 #############################
309 <<: *job-aarch64-linux
317 - name: dist-aarch64-linux
323 - name: dist-arm-linux
326 - name: dist-armhf-linux
329 - name: dist-armv7-linux
332 - name: dist-i586-gnu-i586-i686-musl
335 - name: dist-i686-linux
338 - name: dist-mips-linux
341 - name: dist-mips64-linux
344 - name: dist-mips64el-linux
347 - name: dist-mipsel-linux
350 - name: dist-powerpc-linux
353 - name: dist-powerpc64-linux
356 - name: dist-powerpc64le-linux
359 - name: dist-riscv64-linux
362 - name: dist-s390x-linux
365 - name: dist-various-1
368 - name: dist-various-2
371 - name: dist-x86_64-freebsd
374 - name: dist-x86_64-illumos
378 name: dist-x86_64-linux
381 - name: dist-x86_64-linux-alt
383 IMAGE: dist-x86_64-linux
386 - name: dist-x86_64-musl
389 - name: dist-x86_64-netbsd
395 - name: i686-gnu-nopt
410 # This job ensures commits landing on nightly still pass the full
411 # test suite on the stable channel. There are some UI tests that
412 # depend on the channel being built (for example if they include the
413 # channel name on the output), and this builder prevents landing
414 # changes that would result in broken builds after a promotion.
415 - name: x86_64-gnu-stable
418 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
425 - name: x86_64-gnu-aux
428 - name: x86_64-gnu-debug
431 - name: x86_64-gnu-distcheck
434 - name: x86_64-gnu-llvm-13
439 - name: x86_64-gnu-llvm-13-stage1
444 - name: x86_64-gnu-nopt
447 - name: x86_64-gnu-tools
449 DEPLOY_TOOLSTATES_JSON: toolstates-linux.json
456 - name: dist-x86_64-apple
458 SCRIPT: ./x.py dist --host=x86_64-apple-darwin --target=x86_64-apple-darwin
459 RUST_CONFIGURE_ARGS: --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false
460 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
461 MACOSX_DEPLOYMENT_TARGET: 10.7
462 NO_LLVM_ASSERTIONS: 1
463 NO_DEBUG_ASSERTIONS: 1
464 NO_OVERFLOW_CHECKS: 1
465 DIST_REQUIRE_ALL_TOOLS: 1
468 - name: dist-apple-various
470 SCRIPT: ./x.py dist --host='' --target=aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim
471 RUST_CONFIGURE_ARGS: --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false
472 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
473 MACOSX_DEPLOYMENT_TARGET: 10.7
474 NO_LLVM_ASSERTIONS: 1
475 NO_DEBUG_ASSERTIONS: 1
476 NO_OVERFLOW_CHECKS: 1
479 - name: dist-x86_64-apple-alt
482 RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc --set llvm.ninja=false
483 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
484 MACOSX_DEPLOYMENT_TARGET: 10.7
485 NO_LLVM_ASSERTIONS: 1
486 NO_DEBUG_ASSERTIONS: 1
487 NO_OVERFLOW_CHECKS: 1
490 - name: x86_64-apple-1
491 env: &env-x86_64-apple-tests
492 SCRIPT: ./x.py --stage 2 test --exclude src/test/ui --exclude src/test/rustdoc --exclude src/test/run-make-fulldeps
493 RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false
494 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
495 MACOSX_DEPLOYMENT_TARGET: 10.8
496 MACOSX_STD_DEPLOYMENT_TARGET: 10.7
497 NO_LLVM_ASSERTIONS: 1
498 NO_DEBUG_ASSERTIONS: 1
499 NO_OVERFLOW_CHECKS: 1
502 - name: x86_64-apple-2
504 SCRIPT: ./x.py --stage 2 test src/test/ui src/test/rustdoc src/test/run-make-fulldeps
505 <<: *env-x86_64-apple-tests
508 # This target only needs to support 11.0 and up as nothing else supports the hardware
509 - name: dist-aarch64-apple
511 SCRIPT: ./x.py dist --stage 2
512 RUST_CONFIGURE_ARGS: >-
513 --build=x86_64-apple-darwin
514 --host=aarch64-apple-darwin
515 --target=aarch64-apple-darwin
521 --set llvm.ninja=false
522 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
524 MACOSX_DEPLOYMENT_TARGET: 11.0
525 MACOSX_STD_DEPLOYMENT_TARGET: 11.0
526 NO_LLVM_ASSERTIONS: 1
527 NO_DEBUG_ASSERTIONS: 1
528 NO_OVERFLOW_CHECKS: 1
529 DIST_REQUIRE_ALL_TOOLS: 1
530 # Corresponds to 16K page size
532 # Shouldn't be needed if jemalloc-sys is updated to
533 # handle this platform like iOS or if we build on
534 # aarch64-apple-darwin itself.
536 # https://github.com/gnzlbg/jemallocator/blob/c27a859e98e3cb790dc269773d9da71a1e918458/jemalloc-sys/build.rs#L237
537 JEMALLOC_SYS_WITH_LG_PAGE: 14
540 ######################
542 ######################
544 - name: x86_64-msvc-1
546 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
547 SCRIPT: make ci-subset-1
550 - name: x86_64-msvc-2
552 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
553 SCRIPT: make ci-subset-2
558 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
559 SCRIPT: make ci-subset-1
564 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
565 SCRIPT: make ci-subset-2
568 - name: x86_64-msvc-cargo
570 SCRIPT: python x.py --stage 2 test src/tools/cargotest src/tools/cargo
571 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld
574 - name: x86_64-msvc-tools
576 SCRIPT: src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows
577 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstate/toolstates.json
578 DEPLOY_TOOLSTATES_JSON: toolstates-windows.json
581 # 32/64-bit MinGW builds.
583 # We are using MinGW with POSIX threads since LLVM requires
584 # C++'s std::thread which is disabled in libstdc++ with win32 threads.
585 # FIXME: Libc++ doesn't have this limitation so we can avoid
586 # winpthreads if we switch to it.
588 # Instead of relying on the MinGW version installed on CI we download
589 # and install one ourselves so we won't be surprised by changes to CI's
592 # Finally, note that the downloads below are all in the `rust-lang-ci` S3
593 # bucket, but they clearly didn't originate there! The downloads originally
594 # came from the mingw-w64 SourceForge download site. Unfortunately
595 # SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
599 RUST_CONFIGURE_ARGS: >-
600 --build=i686-pc-windows-gnu
601 --set llvm.allow-old-toolchain
602 SCRIPT: make ci-mingw-subset-1
603 # We are intentionally allowing an old toolchain on this builder (and that's
604 # incompatible with LLVM downloads today).
605 NO_DOWNLOAD_CI_LLVM: 1
611 RUST_CONFIGURE_ARGS: >-
612 --build=i686-pc-windows-gnu
613 --set llvm.allow-old-toolchain
614 SCRIPT: make ci-mingw-subset-2
615 # We are intentionally allowing an old toolchain on this builder (and that's
616 # incompatible with LLVM downloads today).
617 NO_DOWNLOAD_CI_LLVM: 1
621 - name: x86_64-mingw-1
623 SCRIPT: make ci-mingw-subset-1
624 RUST_CONFIGURE_ARGS: >-
625 --build=x86_64-pc-windows-gnu
627 --set llvm.allow-old-toolchain
628 # We are intentionally allowing an old toolchain on this builder (and that's
629 # incompatible with LLVM downloads today).
630 NO_DOWNLOAD_CI_LLVM: 1
634 - name: x86_64-mingw-2
636 SCRIPT: make ci-mingw-subset-2
637 RUST_CONFIGURE_ARGS: >-
638 --build=x86_64-pc-windows-gnu
640 --set llvm.allow-old-toolchain
641 # We are intentionally allowing an old toolchain on this builder (and that's
642 # incompatible with LLVM downloads today).
643 NO_DOWNLOAD_CI_LLVM: 1
647 - name: dist-x86_64-msvc
649 RUST_CONFIGURE_ARGS: >-
650 --build=x86_64-pc-windows-msvc
651 --host=x86_64-pc-windows-msvc
652 --target=x86_64-pc-windows-msvc
655 SCRIPT: PGO_HOST=x86_64-pc-windows-msvc src/ci/pgo.sh python x.py dist
656 DIST_REQUIRE_ALL_TOOLS: 1
659 - name: dist-i686-msvc
661 RUST_CONFIGURE_ARGS: >-
662 --build=i686-pc-windows-msvc
663 --host=i686-pc-windows-msvc
664 --target=i686-pc-windows-msvc,i586-pc-windows-msvc
667 SCRIPT: python x.py dist
668 DIST_REQUIRE_ALL_TOOLS: 1
671 - name: dist-aarch64-msvc
673 RUST_CONFIGURE_ARGS: >-
674 --build=x86_64-pc-windows-msvc
675 --host=aarch64-pc-windows-msvc
678 SCRIPT: python x.py dist
679 DIST_REQUIRE_ALL_TOOLS: 1
680 # Hack around this SDK version, because it doesn't work with clang.
681 # See https://github.com/rust-lang/rust/issues/88796
682 WINDOWS_SDK_20348_HACK: 1
685 - name: dist-i686-mingw
687 RUST_CONFIGURE_ARGS: >-
688 --build=i686-pc-windows-gnu
691 --set llvm.allow-old-toolchain
692 # We are intentionally allowing an old toolchain on this builder (and that's
693 # incompatible with LLVM downloads today).
694 NO_DOWNLOAD_CI_LLVM: 1
695 SCRIPT: python x.py dist
697 DIST_REQUIRE_ALL_TOOLS: 1
700 - name: dist-x86_64-mingw
702 SCRIPT: python x.py dist
703 RUST_CONFIGURE_ARGS: >-
704 --build=x86_64-pc-windows-gnu
707 --set llvm.allow-old-toolchain
708 # We are intentionally allowing an old toolchain on this builder (and that's
709 # incompatible with LLVM downloads today).
710 NO_DOWNLOAD_CI_LLVM: 1
712 DIST_REQUIRE_ALL_TOOLS: 1
715 - name: dist-x86_64-msvc-alt
717 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
718 SCRIPT: python x.py dist
725 <<: [*shared-ci-variables, *prod-variables]
726 if: github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'
731 name: dist-x86_64-linux
736 runs-on: ubuntu-latest
738 <<: [*prod-variables]
739 if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'
741 - name: checkout the source code
742 uses: actions/checkout@v3
746 - name: publish toolstate
747 run: src/ci/publish_toolstate.sh
750 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
753 # These jobs don't actually test anything, but they're used to tell bors the
754 # build completed, as there is no practical way to detect when a workflow is
755 # successful listening to webhooks only.
758 if: "success() && github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'"
759 <<: *base-success-job
762 if: "!success() && github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'"
763 <<: *base-failure-job
766 if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
767 <<: *base-success-job
770 if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
771 <<: *base-failure-job