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 }}
36 CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
39 SCCACHE_BUCKET: rust-lang-ci-sccache2
40 TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
41 CACHE_DOMAIN: ci-caches.rust-lang.org
44 SCCACHE_BUCKET: rust-lang-ci-sccache2
45 DEPLOY_BUCKET: rust-lang-ci2
46 TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
47 TOOLSTATE_ISSUES_API_URL: https://api.github.com/repos/rust-lang/rust/issues
49 # AWS_SECRET_ACCESS_KEYs are stored in GitHub's secrets storage, named
50 # AWS_SECRET_ACCESS_KEY_<keyid>. Including the key id in the name allows to
51 # rotate them in a single branch while keeping the old key in another
52 # branch, which wouldn't be possible if the key was named with the kind
53 # (caches, artifacts...).
54 CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZI5DHEBFL
55 ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZN24CBO55
56 CACHE_DOMAIN: ci-caches.rust-lang.org
59 SCCACHE_BUCKET: rust-lang-gha-caches
60 DEPLOY_BUCKET: rust-lang-gha
61 TOOLSTATE_REPO: https://github.com/pietroalbini/rust-toolstate
62 TOOLSTATE_ISSUES_API_URL: https://api.github.com/repos/pietroalbini/rust-toolstate/issues
64 # AWS_SECRET_ACCESS_KEYs are stored in GitHub's secrets storage, named
65 # AWS_SECRET_ACCESS_KEY_<keyid>. Including the key id in the name allows to
66 # rotate them in a single branch while keeping the old key in another
67 # branch, which wouldn't be possible if the key was named with the kind
68 # (caches, artifacts...).
69 CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZOMUQATD5
70 ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZH5AYXDVF
71 CACHE_DOMAIN: ci-caches-gha.rust-lang.org
81 os: macos-latest # We don't have an XL builder for this
89 os: [self-hosted, ARM64, linux]
92 if: success() && !env.SKIP_JOB
96 runs-on: "${{ matrix.os }}"
97 env: *shared-ci-variables
99 - name: disable git crlf conversion
100 run: git config --global core.autocrlf false
102 - name: checkout the source code
103 uses: actions/checkout@v3
107 # Rust Log Analyzer can't currently detect the PR number of a GitHub
108 # Actions build on its own, so a hint in the log message is needed to
109 # point it in the right direction.
110 - name: configure the PR in which the error message will be posted
111 run: echo "[CI_PR_NUMBER=$num]"
113 num: ${{ github.event.number }}
114 if: success() && !env.SKIP_JOB && github.event_name == 'pull_request'
116 - name: add extra environment variables
117 run: src/ci/scripts/setup-environment.sh
119 # Since it's not possible to merge `${{ matrix.env }}` with the other
120 # variables in `job.<name>.env`, the variables defined in the matrix
121 # are passed to the `setup-environment.sh` script encoded in JSON,
122 # which then uses log commands to actually set them.
123 EXTRA_VARIABLES: ${{ toJson(matrix.env) }}
126 - name: decide whether to skip this job
127 run: src/ci/scripts/should-skip-this.sh
130 - name: ensure the channel matches the target branch
131 run: src/ci/scripts/verify-channel.sh
134 - name: configure GitHub Actions to kill the build when outdated
135 uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
137 github_token: "${{ secrets.github_token }}"
138 if: success() && !env.SKIP_JOB && github.ref != 'refs/heads/try' && github.ref != 'refs/heads/try-perf'
141 - name: collect CPU statistics
142 run: src/ci/scripts/collect-cpu-stats.sh
145 - name: show the current environment
146 run: src/ci/scripts/dump-environment.sh
149 - name: install awscli
150 run: src/ci/scripts/install-awscli.sh
153 - name: install sccache
154 run: src/ci/scripts/install-sccache.sh
158 run: src/ci/scripts/select-xcode.sh
161 - name: install clang
162 run: src/ci/scripts/install-clang.sh
166 run: src/ci/scripts/install-wix.sh
169 - name: disable git crlf conversion
170 run: src/ci/scripts/disable-git-crlf-conversion.sh
173 - name: checkout submodules
174 run: src/ci/scripts/checkout-submodules.sh
177 - name: install MSYS2
178 run: src/ci/scripts/install-msys2.sh
181 - name: install MinGW
182 run: src/ci/scripts/install-mingw.sh
185 - name: install ninja
186 run: src/ci/scripts/install-ninja.sh
189 - name: enable ipv6 on Docker
190 run: src/ci/scripts/enable-docker-ipv6.sh
193 # Disable automatic line ending conversion (again). On Windows, when we're
194 # installing dependencies, something switches the git configuration directory or
195 # re-enables autocrlf. We've not tracked down the exact cause -- and there may
196 # be multiple -- but this should ensure submodules are checked out with the
197 # appropriate line endings.
198 - name: disable git crlf conversion
199 run: src/ci/scripts/disable-git-crlf-conversion.sh
202 - name: ensure line endings are correct
203 run: src/ci/scripts/verify-line-endings.sh
206 - name: ensure backported commits are in upstream branches
207 run: src/ci/scripts/verify-backported-commits.sh
210 - name: ensure the stable version number is correct
211 run: src/ci/scripts/verify-stable-version-number.sh
214 - name: run the build
215 run: src/ci/scripts/run-build-from-ci.sh
217 AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }}
218 AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}
219 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
222 - name: upload artifacts to S3
223 run: src/ci/scripts/upload-artifacts.sh
225 AWS_ACCESS_KEY_ID: ${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}
226 AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}
227 # Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
228 # builders *should* have the AWS credentials available. Still, explicitly
229 # adding the condition is helpful as this way CI will not silently skip
230 # deploying artifacts from a dist builder if the variables are misconfigured,
231 # erroring about invalid credentials instead.
232 if: success() && !env.SKIP_JOB && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')
235 # These snippets are used by the try-success, try-failure, auto-success and auto-failure jobs.
236 # Check out their documentation for more information on why they're needed.
239 name: bors build finished
240 runs-on: ubuntu-latest
244 - name: mark the job as a success
247 <<: *base-outcome-job
251 - name: mark the job as a failure
254 <<: *base-outcome-job
256 ###########################
257 # Builders definition #
258 ###########################
277 # On Linux, macOS, and Windows, use the system-provided bash as the default
278 # shell. (This should only make a difference on Windows, where the default
279 # shell is PowerShell.)
285 actions: write # for rust-lang/simpleinfra/github-actions/cancel-outdated-builds
289 <<: [*shared-ci-variables, *public-variables]
290 if: github.event_name == 'pull_request'
291 continue-on-error: ${{ matrix.tidy }}
299 - name: mingw-check-tidy
303 - name: x86_64-gnu-llvm-13
307 - name: x86_64-gnu-tools
311 CI_ONLY_WHEN_SUBMODULES_CHANGED: 1
315 actions: write # for rust-lang/simpleinfra/github-actions/cancel-outdated-builds
319 <<: [*shared-ci-variables, *prod-variables]
320 if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
324 #############################
325 # Linux/Docker builders #
326 #############################
329 <<: *job-aarch64-linux
337 - name: dist-aarch64-linux
343 - name: dist-arm-linux
346 - name: dist-armhf-linux
349 - name: dist-armv7-linux
352 - name: dist-i586-gnu-i586-i686-musl
355 - name: dist-i686-linux
358 - name: dist-mips-linux
361 - name: dist-mips64-linux
364 - name: dist-mips64el-linux
367 - name: dist-mipsel-linux
370 - name: dist-powerpc-linux
373 - name: dist-powerpc64-linux
376 - name: dist-powerpc64le-linux
379 - name: dist-riscv64-linux
382 - name: dist-s390x-linux
385 - name: dist-various-1
388 - name: dist-various-2
391 - name: dist-x86_64-freebsd
394 - name: dist-x86_64-illumos
398 name: dist-x86_64-linux
401 - name: dist-x86_64-linux-alt
403 IMAGE: dist-x86_64-linux
406 - name: dist-x86_64-musl
409 - name: dist-x86_64-netbsd
415 - name: i686-gnu-nopt
430 # This job ensures commits landing on nightly still pass the full
431 # test suite on the stable channel. There are some UI tests that
432 # depend on the channel being built (for example if they include the
433 # channel name on the output), and this builder prevents landing
434 # changes that would result in broken builds after a promotion.
435 - name: x86_64-gnu-stable
438 RUST_CI_OVERRIDE_RELEASE_CHANNEL: stable
439 # Only run this job on the nightly channel. Running this on beta
440 # could cause failures when `dev: 1` in `stage0.txt`, and running
441 # this on stable is useless.
442 CI_ONLY_WHEN_CHANNEL: nightly
445 - name: x86_64-gnu-aux
448 - name: x86_64-gnu-debug
451 - name: x86_64-gnu-distcheck
454 - name: x86_64-gnu-llvm-15
459 - name: x86_64-gnu-llvm-14
464 - name: x86_64-gnu-llvm-13
469 - name: x86_64-gnu-llvm-13-stage1
474 - name: x86_64-gnu-nopt
477 - name: x86_64-gnu-tools
479 DEPLOY_TOOLSTATES_JSON: toolstates-linux.json
486 - name: dist-x86_64-apple
488 SCRIPT: ./x.py dist bootstrap --include-default-paths --host=x86_64-apple-darwin --target=x86_64-apple-darwin
489 RUST_CONFIGURE_ARGS: --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false --set rust.lto=thin
490 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
491 MACOSX_DEPLOYMENT_TARGET: 10.7
492 SELECT_XCODE: /Applications/Xcode_13.4.1.app
493 NO_LLVM_ASSERTIONS: 1
494 NO_DEBUG_ASSERTIONS: 1
495 NO_OVERFLOW_CHECKS: 1
496 DIST_REQUIRE_ALL_TOOLS: 1
499 - name: dist-apple-various
501 SCRIPT: ./x.py dist bootstrap --include-default-paths --host='' --target=aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim
502 RUST_CONFIGURE_ARGS: --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false
503 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
504 MACOSX_DEPLOYMENT_TARGET: 10.7
505 SELECT_XCODE: /Applications/Xcode_13.4.1.app
506 NO_LLVM_ASSERTIONS: 1
507 NO_DEBUG_ASSERTIONS: 1
508 NO_OVERFLOW_CHECKS: 1
511 - name: dist-x86_64-apple-alt
513 SCRIPT: ./x.py dist bootstrap --include-default-paths
514 RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc --set llvm.ninja=false
515 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
516 MACOSX_DEPLOYMENT_TARGET: 10.7
517 SELECT_XCODE: /Applications/Xcode_13.4.1.app
518 NO_LLVM_ASSERTIONS: 1
519 NO_DEBUG_ASSERTIONS: 1
520 NO_OVERFLOW_CHECKS: 1
523 - name: x86_64-apple-1
524 env: &env-x86_64-apple-tests
525 SCRIPT: ./x.py --stage 2 test --exclude tests/ui --exclude tests/rustdoc --exclude tests/run-make-fulldeps
526 RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false
527 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
528 MACOSX_DEPLOYMENT_TARGET: 10.8
529 MACOSX_STD_DEPLOYMENT_TARGET: 10.7
530 NO_LLVM_ASSERTIONS: 1
531 NO_DEBUG_ASSERTIONS: 1
532 NO_OVERFLOW_CHECKS: 1
535 - name: x86_64-apple-2
537 SCRIPT: ./x.py --stage 2 test tests/ui tests/rustdoc tests/run-make-fulldeps
538 <<: *env-x86_64-apple-tests
541 # This target only needs to support 11.0 and up as nothing else supports the hardware
542 - name: dist-aarch64-apple
544 SCRIPT: ./x.py dist bootstrap --include-default-paths --stage 2
545 RUST_CONFIGURE_ARGS: >-
546 --build=x86_64-apple-darwin
547 --host=aarch64-apple-darwin
548 --target=aarch64-apple-darwin
554 --set llvm.ninja=false
555 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
556 SELECT_XCODE: /Applications/Xcode_13.4.1.app
558 MACOSX_DEPLOYMENT_TARGET: 11.0
559 MACOSX_STD_DEPLOYMENT_TARGET: 11.0
560 NO_LLVM_ASSERTIONS: 1
561 NO_DEBUG_ASSERTIONS: 1
562 NO_OVERFLOW_CHECKS: 1
563 DIST_REQUIRE_ALL_TOOLS: 1
564 # Corresponds to 16K page size
566 # Shouldn't be needed if jemalloc-sys is updated to
567 # handle this platform like iOS or if we build on
568 # aarch64-apple-darwin itself.
570 # https://github.com/gnzlbg/jemallocator/blob/c27a859e98e3cb790dc269773d9da71a1e918458/jemalloc-sys/build.rs#L237
571 JEMALLOC_SYS_WITH_LG_PAGE: 14
574 ######################
576 ######################
578 - name: x86_64-msvc-1
580 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
581 SCRIPT: make ci-subset-1
584 - name: x86_64-msvc-2
586 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
587 SCRIPT: make ci-subset-2
592 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
593 SCRIPT: make ci-subset-1
598 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
599 SCRIPT: make ci-subset-2
602 - name: x86_64-msvc-cargo
604 SCRIPT: python x.py --stage 2 test src/tools/cargotest src/tools/cargo
605 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld
608 - name: x86_64-msvc-tools
610 SCRIPT: src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows
611 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstate/toolstates.json
612 DEPLOY_TOOLSTATES_JSON: toolstates-windows.json
615 # 32/64-bit MinGW builds.
617 # We are using MinGW with POSIX threads since LLVM requires
618 # C++'s std::thread which is disabled in libstdc++ with win32 threads.
619 # FIXME: Libc++ doesn't have this limitation so we can avoid
620 # winpthreads if we switch to it.
622 # Instead of relying on the MinGW version installed on CI we download
623 # and install one ourselves so we won't be surprised by changes to CI's
626 # Finally, note that the downloads below are all in the `rust-lang-ci` S3
627 # bucket, but they clearly didn't originate there! The downloads originally
628 # came from the mingw-w64 SourceForge download site. Unfortunately
629 # SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
633 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
634 SCRIPT: make ci-mingw-subset-1
635 # We are intentionally allowing an old toolchain on this builder (and that's
636 # incompatible with LLVM downloads today).
637 NO_DOWNLOAD_CI_LLVM: 1
643 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
644 SCRIPT: make ci-mingw-subset-2
645 # We are intentionally allowing an old toolchain on this builder (and that's
646 # incompatible with LLVM downloads today).
647 NO_DOWNLOAD_CI_LLVM: 1
651 - name: x86_64-mingw-1
653 SCRIPT: make ci-mingw-subset-1
654 RUST_CONFIGURE_ARGS: >-
655 --build=x86_64-pc-windows-gnu
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
663 - name: x86_64-mingw-2
665 SCRIPT: make ci-mingw-subset-2
666 RUST_CONFIGURE_ARGS: >-
667 --build=x86_64-pc-windows-gnu
669 # We are intentionally allowing an old toolchain on this builder (and that's
670 # incompatible with LLVM downloads today).
671 NO_DOWNLOAD_CI_LLVM: 1
675 - name: dist-x86_64-msvc
677 RUST_CONFIGURE_ARGS: >-
678 --build=x86_64-pc-windows-msvc
679 --host=x86_64-pc-windows-msvc
680 --target=x86_64-pc-windows-msvc
684 SCRIPT: PGO_HOST=x86_64-pc-windows-msvc python src/ci/stage-build.py python x.py dist bootstrap --include-default-paths
685 DIST_REQUIRE_ALL_TOOLS: 1
688 - name: dist-i686-msvc
690 RUST_CONFIGURE_ARGS: >-
691 --build=i686-pc-windows-msvc
692 --host=i686-pc-windows-msvc
693 --target=i686-pc-windows-msvc,i586-pc-windows-msvc
696 SCRIPT: python x.py dist bootstrap --include-default-paths
697 DIST_REQUIRE_ALL_TOOLS: 1
700 - name: dist-aarch64-msvc
702 RUST_CONFIGURE_ARGS: >-
703 --build=x86_64-pc-windows-msvc
704 --host=aarch64-pc-windows-msvc
707 SCRIPT: python x.py dist bootstrap --include-default-paths
708 DIST_REQUIRE_ALL_TOOLS: 1
709 # Hack around this SDK version, because it doesn't work with clang.
710 # See https://github.com/rust-lang/rust/issues/88796
711 WINDOWS_SDK_20348_HACK: 1
714 - name: dist-i686-mingw
716 RUST_CONFIGURE_ARGS: >-
717 --build=i686-pc-windows-gnu
720 # We are intentionally allowing an old toolchain on this builder (and that's
721 # incompatible with LLVM downloads today).
722 NO_DOWNLOAD_CI_LLVM: 1
723 SCRIPT: python x.py dist bootstrap --include-default-paths
725 DIST_REQUIRE_ALL_TOOLS: 1
728 - name: dist-x86_64-mingw
730 SCRIPT: python x.py dist bootstrap --include-default-paths
731 RUST_CONFIGURE_ARGS: >-
732 --build=x86_64-pc-windows-gnu
735 # We are intentionally allowing an old toolchain on this builder (and that's
736 # incompatible with LLVM downloads today).
737 NO_DOWNLOAD_CI_LLVM: 1
739 DIST_REQUIRE_ALL_TOOLS: 1
742 - name: dist-x86_64-msvc-alt
744 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
745 SCRIPT: python x.py dist bootstrap --include-default-paths
750 actions: write # for rust-lang/simpleinfra/github-actions/cancel-outdated-builds
754 <<: [*shared-ci-variables, *prod-variables]
755 if: github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'
760 name: dist-x86_64-linux
765 runs-on: ubuntu-latest
767 <<: [*prod-variables]
768 if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'
770 - name: checkout the source code
771 uses: actions/checkout@v3
775 - name: publish toolstate
776 run: src/ci/publish_toolstate.sh
779 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
782 # These jobs don't actually test anything, but they're used to tell bors the
783 # build completed, as there is no practical way to detect when a workflow is
784 # successful listening to webhooks only.
787 if: "success() && github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'"
788 <<: *base-success-job
791 if: "!success() && github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'"
792 <<: *base-failure-job
795 if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
796 <<: *base-success-job
799 if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
800 <<: *base-failure-job