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 if: success() && !env.SKIP_JOB
92 runs-on: "${{ matrix.os }}"
93 env: *shared-ci-variables
95 - name: disable git crlf conversion
96 run: git config --global core.autocrlf false
98 - name: checkout the source code
99 uses: actions/checkout@v1
103 - name: configure GitHub Actions to kill the build when outdated
104 uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
106 github_token: "${{ secrets.github_token }}"
107 if: success() && !env.SKIP_JOB && github.ref != 'refs/heads/try'
110 # Rust Log Analyzer can't currently detect the PR number of a GitHub
111 # Actions build on its own, so a hint in the log message is needed to
112 # point it in the right direction.
113 - name: configure the PR in which the error message will be posted
114 run: echo "[CI_PR_NUMBER=$num]"
116 num: ${{ github.event.number }}
117 if: success() && !env.SKIP_JOBS && github.event_name == 'pull_request'
119 - name: add extra environment variables
120 run: src/ci/scripts/setup-environment.sh
122 # Since it's not possible to merge `${{ matrix.env }}` with the other
123 # variables in `job.<name>.env`, the variables defined in the matrix
124 # are passed to the `setup-environment.sh` script encoded in JSON,
125 # which then uses log commands to actually set them.
126 EXTRA_VARIABLES: ${{ toJson(matrix.env) }}
129 - name: decide whether to skip this job
130 run: src/ci/scripts/should-skip-this.sh
133 - name: collect CPU statistics
134 run: src/ci/scripts/collect-cpu-stats.sh
137 - name: show the current environment
138 run: src/ci/scripts/dump-environment.sh
141 - name: install awscli
142 run: src/ci/scripts/install-awscli.sh
145 - name: install sccache
146 run: src/ci/scripts/install-sccache.sh
149 - name: install clang
150 run: src/ci/scripts/install-clang.sh
154 run: src/ci/scripts/install-wix.sh
157 - name: ensure the build happens on a partition with enough space
158 run: src/ci/scripts/symlink-build-dir.sh
161 - name: disable git crlf conversion
162 run: src/ci/scripts/disable-git-crlf-conversion.sh
165 - name: install MSYS2
166 run: src/ci/scripts/install-msys2.sh
169 - name: install MinGW
170 run: src/ci/scripts/install-mingw.sh
173 - name: install ninja
174 run: src/ci/scripts/install-ninja.sh
177 - name: enable ipv6 on Docker
178 run: src/ci/scripts/enable-docker-ipv6.sh
181 # Disable automatic line ending conversion (again). On Windows, when we're
182 # installing dependencies, something switches the git configuration directory or
183 # re-enables autocrlf. We've not tracked down the exact cause -- and there may
184 # be multiple -- but this should ensure submodules are checked out with the
185 # appropriate line endings.
186 - name: disable git crlf conversion
187 run: src/ci/scripts/disable-git-crlf-conversion.sh
190 - name: checkout submodules
191 run: src/ci/scripts/checkout-submodules.sh
194 - name: ensure line endings are correct
195 run: src/ci/scripts/verify-line-endings.sh
198 - name: run the build
199 run: src/ci/scripts/run-build-from-ci.sh
201 AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }}
202 AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}
203 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
206 - name: upload artifacts to S3
207 run: src/ci/scripts/upload-artifacts.sh
209 AWS_ACCESS_KEY_ID: ${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}
210 AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}
211 # Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
212 # builders *should* have the AWS credentials available. Still, explicitly
213 # adding the condition is helpful as this way CI will not silently skip
214 # deploying artifacts from a dist builder if the variables are misconfigured,
215 # erroring about invalid credentials instead.
216 if: success() && !env.SKIP_JOB && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')
219 # These snippets are used by the try-success, try-failure, auto-success and auto-failure jobs.
220 # Check out their documentation for more information on why they're needed.
223 name: bors build finished
224 runs-on: ubuntu-latest
228 - name: mark the job as a success
231 <<: *base-outcome-job
235 - name: mark the job as a failure
238 <<: *base-outcome-job
240 ###########################
241 # Builders definition #
242 ###########################
258 # On Linux, macOS, and Windows, use the system-provided bash as the default
259 # shell. (This should only make a difference on Windows, where the default
260 # shell is PowerShell.)
268 <<: [*shared-ci-variables, *public-variables]
269 if: github.event_name == 'pull_request'
276 - name: x86_64-gnu-llvm-8
279 - name: x86_64-gnu-tools
281 CI_ONLY_WHEN_SUBMODULES_CHANGED: 1
288 <<: [*shared-ci-variables, *prod-variables]
289 if: github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'
293 - name: dist-x86_64-linux
300 <<: [*shared-ci-variables, *prod-variables]
301 if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
305 #############################
306 # Linux/Docker builders #
307 #############################
315 - name: dist-aarch64-linux
321 - name: dist-arm-linux
324 - name: dist-armhf-linux
327 - name: dist-armv7-linux
330 - name: dist-i586-gnu-i586-i686-musl
333 - name: dist-i686-freebsd
336 - name: dist-i686-linux
339 - name: dist-mips-linux
342 - name: dist-mips64-linux
345 - name: dist-mips64el-linux
348 - name: dist-mipsel-linux
351 - name: dist-powerpc-linux
354 - name: dist-powerpc64-linux
357 - name: dist-powerpc64le-linux
360 - name: dist-riscv64-linux
363 - name: dist-s390x-linux
366 - name: dist-various-1
369 - name: dist-various-2
372 - name: dist-x86_64-freebsd
375 - 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 - name: x86_64-gnu-aux
413 - name: x86_64-gnu-debug
416 - name: x86_64-gnu-distcheck
419 - name: x86_64-gnu-full-bootstrap
422 - name: x86_64-gnu-llvm-8
427 - name: x86_64-gnu-nopt
430 - name: x86_64-gnu-tools
432 DEPLOY_TOOLSTATES_JSON: toolstates-linux.json
435 ######################
437 ######################
439 - name: x86_64-msvc-1
441 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
442 SCRIPT: make ci-subset-1
444 NO_DEBUG_ASSERTIONS: 1
445 NO_LLVM_ASSERTIONS: 1
448 - name: x86_64-msvc-2
450 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
451 SCRIPT: make ci-subset-2
456 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
457 SCRIPT: make ci-subset-1
459 NO_DEBUG_ASSERTIONS: 1
460 NO_LLVM_ASSERTIONS: 1
465 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
466 SCRIPT: make ci-subset-2
468 NO_DEBUG_ASSERTIONS: 1
469 NO_LLVM_ASSERTIONS: 1
472 - name: x86_64-msvc-cargo
474 SCRIPT: python x.py --stage 2 test src/tools/cargotest src/tools/cargo
475 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld
476 VCVARS_BAT: vcvars64.bat
478 NO_DEBUG_ASSERTIONS: 1
479 NO_LLVM_ASSERTIONS: 1
482 - name: x86_64-msvc-tools
484 SCRIPT: src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows
485 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstate/toolstates.json
488 # 32/64-bit MinGW builds.
490 # We are using MinGW with posix threads since LLVM does not compile with
491 # the win32 threads version due to missing support for C++'s std::thread.
493 # Instead of relying on the MinGW version installed on appveryor we download
494 # and install one ourselves so we won't be surprised by changes to appveyor's
497 # Finally, note that the downloads below are all in the `rust-lang-ci` S3
498 # bucket, but they cleraly didn't originate there! The downloads originally
499 # came from the mingw-w64 SourceForge download site. Unfortunately
500 # SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
504 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
505 SCRIPT: make ci-mingw-subset-1
508 NO_DEBUG_ASSERTIONS: 1
509 NO_LLVM_ASSERTIONS: 1
514 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
515 SCRIPT: make ci-mingw-subset-2
519 - name: x86_64-mingw-1
521 SCRIPT: make ci-mingw-subset-1
522 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
525 NO_DEBUG_ASSERTIONS: 1
526 NO_LLVM_ASSERTIONS: 1
529 - name: x86_64-mingw-2
531 SCRIPT: make ci-mingw-subset-2
532 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
536 - name: dist-x86_64-msvc
538 RUST_CONFIGURE_ARGS: >-
539 --build=x86_64-pc-windows-msvc
540 --target=x86_64-pc-windows-msvc,aarch64-pc-windows-msvc
543 SCRIPT: python x.py dist
544 DIST_REQUIRE_ALL_TOOLS: 1
547 - name: dist-i686-msvc
549 RUST_CONFIGURE_ARGS: >-
550 --build=i686-pc-windows-msvc
551 --target=i586-pc-windows-msvc
554 SCRIPT: python x.py dist
555 DIST_REQUIRE_ALL_TOOLS: 1
558 - name: dist-i686-mingw
560 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools --enable-profiler
561 SCRIPT: python x.py dist
563 DIST_REQUIRE_ALL_TOOLS: 1
566 - name: dist-x86_64-mingw
568 SCRIPT: python x.py dist
569 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler
571 DIST_REQUIRE_ALL_TOOLS: 1
574 - name: dist-x86_64-msvc-alt
576 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
577 SCRIPT: python x.py dist
584 <<: [*shared-ci-variables, *dummy-variables]
585 if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
593 - name: dist-x86_64-apple
596 RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc
597 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
598 MACOSX_DEPLOYMENT_TARGET: 10.7
599 NO_LLVM_ASSERTIONS: 1
600 NO_DEBUG_ASSERTIONS: 1
601 DIST_REQUIRE_ALL_TOOLS: 1
604 - name: dist-x86_64-apple-alt
607 RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc
608 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
609 MACOSX_DEPLOYMENT_TARGET: 10.7
610 NO_LLVM_ASSERTIONS: 1
611 NO_DEBUG_ASSERTIONS: 1
616 SCRIPT: ./x.py --stage 2 test
617 RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc
618 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
619 MACOSX_DEPLOYMENT_TARGET: 10.8
620 MACOSX_STD_DEPLOYMENT_TARGET: 10.7
621 NO_LLVM_ASSERTIONS: 1
622 NO_DEBUG_ASSERTIONS: 1
627 runs-on: ubuntu-latest
629 <<: [*prod-variables]
630 if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'
632 - name: checkout the source code
633 uses: actions/checkout@v1
637 - name: publish toolstate
638 run: src/ci/publish_toolstate.sh
641 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
644 # These jobs don't actually test anything, but they're used to tell bors the
645 # build completed, as there is no practical way to detect when a workflow is
646 # successful listening to webhooks only.
649 if: "success() && github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'"
650 <<: *base-success-job
653 if: "!success() && github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'"
654 <<: *base-failure-job
657 if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
658 <<: *base-success-job
661 if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
662 <<: *base-failure-job