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
313 actions: write # for rust-lang/simpleinfra/github-actions/cancel-outdated-builds
317 <<: [*shared-ci-variables, *prod-variables]
318 if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
322 #############################
323 # Linux/Docker builders #
324 #############################
327 <<: *job-aarch64-linux
335 - name: dist-aarch64-linux
341 - name: dist-arm-linux
344 - name: dist-armhf-linux
347 - name: dist-armv7-linux
350 - name: dist-i586-gnu-i586-i686-musl
353 - name: dist-i686-linux
356 - name: dist-mips-linux
359 - name: dist-mips64-linux
362 - name: dist-mips64el-linux
365 - name: dist-mipsel-linux
368 - name: dist-powerpc-linux
371 - name: dist-powerpc64-linux
374 - name: dist-powerpc64le-linux
377 - name: dist-riscv64-linux
380 - name: dist-s390x-linux
383 - name: dist-various-1
386 - name: dist-various-2
389 - name: dist-x86_64-freebsd
392 - name: dist-x86_64-illumos
396 name: dist-x86_64-linux
399 - name: dist-x86_64-linux-alt
401 IMAGE: dist-x86_64-linux
404 - name: dist-x86_64-musl
407 - name: dist-x86_64-netbsd
413 - name: i686-gnu-nopt
428 # This job ensures commits landing on nightly still pass the full
429 # test suite on the stable channel. There are some UI tests that
430 # depend on the channel being built (for example if they include the
431 # channel name on the output), and this builder prevents landing
432 # changes that would result in broken builds after a promotion.
433 - name: x86_64-gnu-stable
436 RUST_CI_OVERRIDE_RELEASE_CHANNEL: stable
437 # Only run this job on the nightly channel. Running this on beta
438 # could cause failures when `dev: 1` in `stage0.txt`, and running
439 # this on stable is useless.
440 CI_ONLY_WHEN_CHANNEL: nightly
443 - name: x86_64-gnu-aux
446 - name: x86_64-gnu-debug
449 - name: x86_64-gnu-distcheck
452 - name: x86_64-gnu-llvm-15
457 - name: x86_64-gnu-llvm-14
462 - name: x86_64-gnu-llvm-13
467 - name: x86_64-gnu-llvm-13-stage1
472 - name: x86_64-gnu-nopt
475 - name: x86_64-gnu-tools
477 DEPLOY_TOOLSTATES_JSON: toolstates-linux.json
484 - name: dist-x86_64-apple
486 SCRIPT: ./x.py dist bootstrap --include-default-paths --host=x86_64-apple-darwin --target=x86_64-apple-darwin
487 RUST_CONFIGURE_ARGS: --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false --set rust.lto=thin
488 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
489 MACOSX_DEPLOYMENT_TARGET: 10.7
490 SELECT_XCODE: /Applications/Xcode_13.4.1.app
491 NO_LLVM_ASSERTIONS: 1
492 NO_DEBUG_ASSERTIONS: 1
493 NO_OVERFLOW_CHECKS: 1
494 DIST_REQUIRE_ALL_TOOLS: 1
497 - name: dist-apple-various
499 SCRIPT: ./x.py dist bootstrap --include-default-paths --host='' --target=aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim
500 RUST_CONFIGURE_ARGS: --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false
501 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
502 MACOSX_DEPLOYMENT_TARGET: 10.7
503 SELECT_XCODE: /Applications/Xcode_13.4.1.app
504 NO_LLVM_ASSERTIONS: 1
505 NO_DEBUG_ASSERTIONS: 1
506 NO_OVERFLOW_CHECKS: 1
509 - name: dist-x86_64-apple-alt
511 SCRIPT: ./x.py dist bootstrap --include-default-paths
512 RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc --set llvm.ninja=false
513 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
514 MACOSX_DEPLOYMENT_TARGET: 10.7
515 SELECT_XCODE: /Applications/Xcode_13.4.1.app
516 NO_LLVM_ASSERTIONS: 1
517 NO_DEBUG_ASSERTIONS: 1
518 NO_OVERFLOW_CHECKS: 1
521 - name: x86_64-apple-1
522 env: &env-x86_64-apple-tests
523 SCRIPT: ./x.py --stage 2 test --exclude tests/ui --exclude tests/rustdoc --exclude tests/run-make-fulldeps
524 RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false
525 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
526 MACOSX_DEPLOYMENT_TARGET: 10.8
527 MACOSX_STD_DEPLOYMENT_TARGET: 10.7
528 NO_LLVM_ASSERTIONS: 1
529 NO_DEBUG_ASSERTIONS: 1
530 NO_OVERFLOW_CHECKS: 1
533 - name: x86_64-apple-2
535 SCRIPT: ./x.py --stage 2 test tests/ui tests/rustdoc tests/run-make-fulldeps
536 <<: *env-x86_64-apple-tests
539 # This target only needs to support 11.0 and up as nothing else supports the hardware
540 - name: dist-aarch64-apple
542 SCRIPT: ./x.py dist bootstrap --include-default-paths --stage 2
543 RUST_CONFIGURE_ARGS: >-
544 --build=x86_64-apple-darwin
545 --host=aarch64-apple-darwin
546 --target=aarch64-apple-darwin
552 --set llvm.ninja=false
553 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
554 SELECT_XCODE: /Applications/Xcode_13.4.1.app
556 MACOSX_DEPLOYMENT_TARGET: 11.0
557 MACOSX_STD_DEPLOYMENT_TARGET: 11.0
558 NO_LLVM_ASSERTIONS: 1
559 NO_DEBUG_ASSERTIONS: 1
560 NO_OVERFLOW_CHECKS: 1
561 DIST_REQUIRE_ALL_TOOLS: 1
562 # Corresponds to 16K page size
564 # Shouldn't be needed if jemalloc-sys is updated to
565 # handle this platform like iOS or if we build on
566 # aarch64-apple-darwin itself.
568 # https://github.com/gnzlbg/jemallocator/blob/c27a859e98e3cb790dc269773d9da71a1e918458/jemalloc-sys/build.rs#L237
569 JEMALLOC_SYS_WITH_LG_PAGE: 14
572 ######################
574 ######################
576 - name: x86_64-msvc-1
578 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
579 SCRIPT: make ci-subset-1
582 - name: x86_64-msvc-2
584 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
585 SCRIPT: make ci-subset-2
590 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
591 SCRIPT: make ci-subset-1
596 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
597 SCRIPT: make ci-subset-2
600 - name: x86_64-msvc-cargo
602 SCRIPT: python x.py --stage 2 test src/tools/cargotest src/tools/cargo
603 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld
606 - name: x86_64-msvc-tools
608 SCRIPT: src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows
609 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstate/toolstates.json
610 DEPLOY_TOOLSTATES_JSON: toolstates-windows.json
613 # 32/64-bit MinGW builds.
615 # We are using MinGW with POSIX threads since LLVM requires
616 # C++'s std::thread which is disabled in libstdc++ with win32 threads.
617 # FIXME: Libc++ doesn't have this limitation so we can avoid
618 # winpthreads if we switch to it.
620 # Instead of relying on the MinGW version installed on CI we download
621 # and install one ourselves so we won't be surprised by changes to CI's
624 # Finally, note that the downloads below are all in the `rust-lang-ci` S3
625 # bucket, but they clearly didn't originate there! The downloads originally
626 # came from the mingw-w64 SourceForge download site. Unfortunately
627 # SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
631 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
632 SCRIPT: make ci-mingw-subset-1
633 # We are intentionally allowing an old toolchain on this builder (and that's
634 # incompatible with LLVM downloads today).
635 NO_DOWNLOAD_CI_LLVM: 1
641 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
642 SCRIPT: make ci-mingw-subset-2
643 # We are intentionally allowing an old toolchain on this builder (and that's
644 # incompatible with LLVM downloads today).
645 NO_DOWNLOAD_CI_LLVM: 1
649 - name: x86_64-mingw-1
651 SCRIPT: make ci-mingw-subset-1
652 RUST_CONFIGURE_ARGS: >-
653 --build=x86_64-pc-windows-gnu
655 # We are intentionally allowing an old toolchain on this builder (and that's
656 # incompatible with LLVM downloads today).
657 NO_DOWNLOAD_CI_LLVM: 1
661 - name: x86_64-mingw-2
663 SCRIPT: make ci-mingw-subset-2
664 RUST_CONFIGURE_ARGS: >-
665 --build=x86_64-pc-windows-gnu
667 # We are intentionally allowing an old toolchain on this builder (and that's
668 # incompatible with LLVM downloads today).
669 NO_DOWNLOAD_CI_LLVM: 1
673 - name: dist-x86_64-msvc
675 RUST_CONFIGURE_ARGS: >-
676 --build=x86_64-pc-windows-msvc
677 --host=x86_64-pc-windows-msvc
678 --target=x86_64-pc-windows-msvc
682 SCRIPT: PGO_HOST=x86_64-pc-windows-msvc python src/ci/stage-build.py python x.py dist bootstrap --include-default-paths
683 DIST_REQUIRE_ALL_TOOLS: 1
686 - name: dist-i686-msvc
688 RUST_CONFIGURE_ARGS: >-
689 --build=i686-pc-windows-msvc
690 --host=i686-pc-windows-msvc
691 --target=i686-pc-windows-msvc,i586-pc-windows-msvc
694 SCRIPT: python x.py dist bootstrap --include-default-paths
695 DIST_REQUIRE_ALL_TOOLS: 1
698 - name: dist-aarch64-msvc
700 RUST_CONFIGURE_ARGS: >-
701 --build=x86_64-pc-windows-msvc
702 --host=aarch64-pc-windows-msvc
705 SCRIPT: python x.py dist bootstrap --include-default-paths
706 DIST_REQUIRE_ALL_TOOLS: 1
707 # Hack around this SDK version, because it doesn't work with clang.
708 # See https://github.com/rust-lang/rust/issues/88796
709 WINDOWS_SDK_20348_HACK: 1
712 - name: dist-i686-mingw
714 RUST_CONFIGURE_ARGS: >-
715 --build=i686-pc-windows-gnu
718 # We are intentionally allowing an old toolchain on this builder (and that's
719 # incompatible with LLVM downloads today).
720 NO_DOWNLOAD_CI_LLVM: 1
721 SCRIPT: python x.py dist bootstrap --include-default-paths
723 DIST_REQUIRE_ALL_TOOLS: 1
726 - name: dist-x86_64-mingw
728 SCRIPT: python x.py dist bootstrap --include-default-paths
729 RUST_CONFIGURE_ARGS: >-
730 --build=x86_64-pc-windows-gnu
733 # We are intentionally allowing an old toolchain on this builder (and that's
734 # incompatible with LLVM downloads today).
735 NO_DOWNLOAD_CI_LLVM: 1
737 DIST_REQUIRE_ALL_TOOLS: 1
740 - name: dist-x86_64-msvc-alt
742 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
743 SCRIPT: python x.py dist bootstrap --include-default-paths
748 actions: write # for rust-lang/simpleinfra/github-actions/cancel-outdated-builds
752 <<: [*shared-ci-variables, *prod-variables]
753 if: github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'
758 name: dist-x86_64-linux
763 runs-on: ubuntu-latest
765 <<: [*prod-variables]
766 if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'
768 - name: checkout the source code
769 uses: actions/checkout@v3
773 - name: publish toolstate
774 run: src/ci/publish_toolstate.sh
777 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
780 # These jobs don't actually test anything, but they're used to tell bors the
781 # build completed, as there is no practical way to detect when a workflow is
782 # successful listening to webhooks only.
785 if: "success() && github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'"
786 <<: *base-success-job
789 if: "!success() && github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'"
790 <<: *base-failure-job
793 if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
794 <<: *base-success-job
797 if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
798 <<: *base-failure-job