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@v1
106 - name: configure GitHub Actions to kill the build when outdated
107 uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
109 github_token: "${{ secrets.github_token }}"
110 if: success() && !env.SKIP_JOB && github.ref != 'refs/heads/try'
113 # Rust Log Analyzer can't currently detect the PR number of a GitHub
114 # Actions build on its own, so a hint in the log message is needed to
115 # point it in the right direction.
116 - name: configure the PR in which the error message will be posted
117 run: echo "[CI_PR_NUMBER=$num]"
119 num: ${{ github.event.number }}
120 if: success() && !env.SKIP_JOBS && github.event_name == 'pull_request'
122 - name: add extra environment variables
123 run: src/ci/scripts/setup-environment.sh
125 # Since it's not possible to merge `${{ matrix.env }}` with the other
126 # variables in `job.<name>.env`, the variables defined in the matrix
127 # are passed to the `setup-environment.sh` script encoded in JSON,
128 # which then uses log commands to actually set them.
129 EXTRA_VARIABLES: ${{ toJson(matrix.env) }}
132 - name: decide whether to skip this job
133 run: src/ci/scripts/should-skip-this.sh
136 - name: collect CPU statistics
137 run: src/ci/scripts/collect-cpu-stats.sh
140 - name: show the current environment
141 run: src/ci/scripts/dump-environment.sh
144 - name: install awscli
145 run: src/ci/scripts/install-awscli.sh
148 - name: install sccache
149 run: src/ci/scripts/install-sccache.sh
152 - name: install clang
153 run: src/ci/scripts/install-clang.sh
157 run: src/ci/scripts/install-wix.sh
160 - name: ensure the build happens on a partition with enough space
161 run: src/ci/scripts/symlink-build-dir.sh
164 - name: disable git crlf conversion
165 run: src/ci/scripts/disable-git-crlf-conversion.sh
168 - name: install MSYS2
169 run: src/ci/scripts/install-msys2.sh
172 - name: install MinGW
173 run: src/ci/scripts/install-mingw.sh
176 - name: install ninja
177 run: src/ci/scripts/install-ninja.sh
180 - name: enable ipv6 on Docker
181 run: src/ci/scripts/enable-docker-ipv6.sh
184 # Disable automatic line ending conversion (again). On Windows, when we're
185 # installing dependencies, something switches the git configuration directory or
186 # re-enables autocrlf. We've not tracked down the exact cause -- and there may
187 # be multiple -- but this should ensure submodules are checked out with the
188 # appropriate line endings.
189 - name: disable git crlf conversion
190 run: src/ci/scripts/disable-git-crlf-conversion.sh
193 - name: checkout submodules
194 run: src/ci/scripts/checkout-submodules.sh
197 - name: ensure line endings are correct
198 run: src/ci/scripts/verify-line-endings.sh
201 - name: run the build
202 run: src/ci/scripts/run-build-from-ci.sh
204 AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }}
205 AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}
206 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
209 - name: upload artifacts to S3
210 run: src/ci/scripts/upload-artifacts.sh
212 AWS_ACCESS_KEY_ID: ${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}
213 AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}
214 # Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
215 # builders *should* have the AWS credentials available. Still, explicitly
216 # adding the condition is helpful as this way CI will not silently skip
217 # deploying artifacts from a dist builder if the variables are misconfigured,
218 # erroring about invalid credentials instead.
219 if: success() && !env.SKIP_JOB && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')
222 # These snippets are used by the try-success, try-failure, auto-success and auto-failure jobs.
223 # Check out their documentation for more information on why they're needed.
226 name: bors build finished
227 runs-on: ubuntu-latest
231 - name: mark the job as a success
234 <<: *base-outcome-job
238 - name: mark the job as a failure
241 <<: *base-outcome-job
243 ###########################
244 # Builders definition #
245 ###########################
261 # On Linux, macOS, and Windows, use the system-provided bash as the default
262 # shell. (This should only make a difference on Windows, where the default
263 # shell is PowerShell.)
271 <<: [*shared-ci-variables, *public-variables]
272 if: github.event_name == 'pull_request'
279 - name: x86_64-gnu-llvm-8
282 - name: x86_64-gnu-tools
284 CI_ONLY_WHEN_SUBMODULES_CHANGED: 1
291 <<: [*shared-ci-variables, *prod-variables]
292 if: github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'
296 - name: dist-x86_64-linux
303 <<: [*shared-ci-variables, *prod-variables]
304 if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
308 #############################
309 # Linux/Docker builders #
310 #############################
318 - name: dist-aarch64-linux
324 - name: dist-arm-linux
327 - name: dist-armhf-linux
330 - name: dist-armv7-linux
333 - name: dist-i586-gnu-i586-i686-musl
336 - name: dist-i686-freebsd
339 - name: dist-i686-linux
342 - name: dist-mips-linux
345 - name: dist-mips64-linux
348 - name: dist-mips64el-linux
351 - name: dist-mipsel-linux
354 - name: dist-powerpc-linux
357 - name: dist-powerpc64-linux
360 - name: dist-powerpc64le-linux
363 - name: dist-riscv64-linux
366 - name: dist-s390x-linux
369 - name: dist-various-1
372 - name: dist-various-2
375 - name: dist-x86_64-freebsd
378 - name: dist-x86_64-illumos
381 - name: dist-x86_64-linux
384 - name: dist-x86_64-linux-alt
386 IMAGE: dist-x86_64-linux
389 - name: dist-x86_64-musl
392 - name: dist-x86_64-netbsd
398 - name: i686-gnu-nopt
413 - name: x86_64-gnu-aux
416 - name: x86_64-gnu-debug
419 - name: x86_64-gnu-distcheck
422 - name: x86_64-gnu-full-bootstrap
425 - name: x86_64-gnu-llvm-8
430 - name: x86_64-gnu-nopt
433 - name: x86_64-gnu-tools
435 DEPLOY_TOOLSTATES_JSON: toolstates-linux.json
438 ######################
440 ######################
442 - name: x86_64-msvc-1
444 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
445 SCRIPT: make ci-subset-1
447 NO_DEBUG_ASSERTIONS: 1
448 NO_LLVM_ASSERTIONS: 1
451 - name: x86_64-msvc-2
453 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
454 SCRIPT: make ci-subset-2
459 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
460 SCRIPT: make ci-subset-1
462 NO_DEBUG_ASSERTIONS: 1
463 NO_LLVM_ASSERTIONS: 1
468 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
469 SCRIPT: make ci-subset-2
471 NO_DEBUG_ASSERTIONS: 1
472 NO_LLVM_ASSERTIONS: 1
475 - name: x86_64-msvc-cargo
477 SCRIPT: python x.py --stage 2 test src/tools/cargotest src/tools/cargo
478 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld
479 VCVARS_BAT: vcvars64.bat
481 NO_DEBUG_ASSERTIONS: 1
482 NO_LLVM_ASSERTIONS: 1
485 - name: x86_64-msvc-tools
487 SCRIPT: src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows
488 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstate/toolstates.json
491 # 32/64-bit MinGW builds.
493 # We are using MinGW with posix threads since LLVM does not compile with
494 # the win32 threads version due to missing support for C++'s std::thread.
496 # Instead of relying on the MinGW version installed on appveryor we download
497 # and install one ourselves so we won't be surprised by changes to appveyor's
500 # Finally, note that the downloads below are all in the `rust-lang-ci` S3
501 # bucket, but they cleraly didn't originate there! The downloads originally
502 # came from the mingw-w64 SourceForge download site. Unfortunately
503 # SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
507 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
508 SCRIPT: make ci-mingw-subset-1
511 NO_DEBUG_ASSERTIONS: 1
512 NO_LLVM_ASSERTIONS: 1
517 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
518 SCRIPT: make ci-mingw-subset-2
522 - name: x86_64-mingw-1
524 SCRIPT: make ci-mingw-subset-1
525 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
528 NO_DEBUG_ASSERTIONS: 1
529 NO_LLVM_ASSERTIONS: 1
532 - name: x86_64-mingw-2
534 SCRIPT: make ci-mingw-subset-2
535 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
539 - name: dist-x86_64-msvc
541 RUST_CONFIGURE_ARGS: >-
542 --build=x86_64-pc-windows-msvc
543 --target=x86_64-pc-windows-msvc,aarch64-pc-windows-msvc
546 SCRIPT: python x.py dist
547 DIST_REQUIRE_ALL_TOOLS: 1
550 - name: dist-i686-msvc
552 RUST_CONFIGURE_ARGS: >-
553 --build=i686-pc-windows-msvc
554 --target=i586-pc-windows-msvc
557 SCRIPT: python x.py dist
558 DIST_REQUIRE_ALL_TOOLS: 1
561 - name: dist-i686-mingw
563 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools --enable-profiler
564 SCRIPT: python x.py dist
566 DIST_REQUIRE_ALL_TOOLS: 1
569 - name: dist-x86_64-mingw
571 SCRIPT: python x.py dist
572 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler
574 DIST_REQUIRE_ALL_TOOLS: 1
577 - name: dist-x86_64-msvc-alt
579 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
580 SCRIPT: python x.py dist
587 <<: [*shared-ci-variables, *dummy-variables]
588 if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
592 #############################
593 # Linux/Docker builders #
594 #############################
597 <<: *job-aarch64-linux
603 - name: dist-x86_64-apple
606 RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc
607 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
608 MACOSX_DEPLOYMENT_TARGET: 10.7
609 NO_LLVM_ASSERTIONS: 1
610 NO_DEBUG_ASSERTIONS: 1
611 DIST_REQUIRE_ALL_TOOLS: 1
614 - name: dist-x86_64-apple-alt
617 RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc
618 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
619 MACOSX_DEPLOYMENT_TARGET: 10.7
620 NO_LLVM_ASSERTIONS: 1
621 NO_DEBUG_ASSERTIONS: 1
626 SCRIPT: ./x.py --stage 2 test
627 RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc
628 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
629 MACOSX_DEPLOYMENT_TARGET: 10.8
630 MACOSX_STD_DEPLOYMENT_TARGET: 10.7
631 NO_LLVM_ASSERTIONS: 1
632 NO_DEBUG_ASSERTIONS: 1
637 runs-on: ubuntu-latest
639 <<: [*prod-variables]
640 if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'
642 - name: checkout the source code
643 uses: actions/checkout@v1
647 - name: publish toolstate
648 run: src/ci/publish_toolstate.sh
651 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
654 # These jobs don't actually test anything, but they're used to tell bors the
655 # build completed, as there is no practical way to detect when a workflow is
656 # successful listening to webhooks only.
659 if: "success() && github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'"
660 <<: *base-success-job
663 if: "!success() && github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'"
664 <<: *base-failure-job
667 if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
668 <<: *base-success-job
671 if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
672 <<: *base-failure-job