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-gha-caches
39 TOOLSTATE_REPO: https://github.com/pietroalbini/rust-toolstate
40 CACHE_DOMAIN: ci-caches-gha.rust-lang.org
43 SCCACHE_BUCKET: rust-lang-gha-caches
44 DEPLOY_BUCKET: rust-lang-gha
45 TOOLSTATE_REPO: https://github.com/pietroalbini/rust-toolstate
46 TOOLSTATE_ISSUES_API_URL: https://api.github.com/repos/pietroalbini/rust-toolstate/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: AKIA46X5W6CZOMUQATD5
54 ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZH5AYXDVF
55 CACHE_DOMAIN: ci-caches-gha.rust-lang.org
65 os: macos-latest # We don't have an XL builder for this
73 if: success() && !env.SKIP_JOB
77 runs-on: "${{ matrix.os }}"
78 env: *shared-ci-variables
80 - name: disable git crlf conversion
81 run: git config --global core.autocrlf false
83 - name: checkout the source code
84 uses: actions/checkout@v1
88 - name: configure GitHub Actions to kill the build when outdated
89 uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
91 github_token: "${{ secrets.github_token }}"
92 if: success() && !env.SKIP_JOB && github.ref != 'refs/heads/try'
95 - name: add extra environment variables
96 run: src/ci/scripts/setup-environment.sh
98 # Since it's not possible to merge `${{ matrix.env }}` with the other
99 # variables in `job.<name>.env`, the variables defined in the matrix
100 # are passed to the `setup-environment.sh` script encoded in JSON,
101 # which then uses log commands to actually set them.
102 EXTRA_VARIABLES: ${{ toJson(matrix.env) }}
105 - name: decide whether to skip this job
106 run: src/ci/scripts/should-skip-this.sh
109 - name: collect CPU statistics
110 run: src/ci/scripts/collect-cpu-stats.sh
113 - name: show the current environment
114 run: src/ci/scripts/dump-environment.sh
117 - name: install awscli
118 run: src/ci/scripts/install-awscli.sh
121 - name: install sccache
122 run: src/ci/scripts/install-sccache.sh
125 - name: install clang
126 run: src/ci/scripts/install-clang.sh
130 run: src/ci/scripts/install-wix.sh
133 - name: ensure the build happens on a partition with enough space
134 run: src/ci/scripts/symlink-build-dir.sh
137 - name: disable git crlf conversion
138 run: src/ci/scripts/disable-git-crlf-conversion.sh
141 - name: install MSYS2
142 run: src/ci/scripts/install-msys2.sh
145 - name: install MinGW
146 run: src/ci/scripts/install-mingw.sh
149 - name: install ninja
150 run: src/ci/scripts/install-ninja.sh
153 - name: enable ipv6 on Docker
154 run: src/ci/scripts/enable-docker-ipv6.sh
157 # Disable automatic line ending conversion (again). On Windows, when we're
158 # installing dependencies, something switches the git configuration directory or
159 # re-enables autocrlf. We've not tracked down the exact cause -- and there may
160 # be multiple -- but this should ensure submodules are checked out with the
161 # appropriate line endings.
162 - name: disable git crlf conversion
163 run: src/ci/scripts/disable-git-crlf-conversion.sh
166 - name: checkout submodules
167 run: src/ci/scripts/checkout-submodules.sh
170 - name: ensure line endings are correct
171 run: src/ci/scripts/verify-line-endings.sh
174 - name: run the build
175 run: src/ci/scripts/run-build-from-ci.sh
177 AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }}
178 AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}
179 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
182 - name: upload artifacts to S3
183 run: src/ci/scripts/upload-artifacts.sh
185 AWS_ACCESS_KEY_ID: ${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}
186 AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}
187 # Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
188 # builders *should* have the AWS credentials available. Still, explicitly
189 # adding the condition is helpful as this way CI will not silently skip
190 # deploying artifacts from a dist builder if the variables are misconfigured,
191 # erroring about invalid credentials instead.
192 if: success() && !env.SKIP_JOB && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')
195 # These snippets are used by the try-success, try-failure, auto-success and auto-failure jobs.
196 # Check out their documentation for more information on why they're needed.
199 name: bors build finished
200 runs-on: ubuntu-latest
204 - name: mark the job as a success
207 <<: *base-outcome-job
211 - name: mark the job as a failure
214 <<: *base-outcome-job
216 ###########################
217 # Builders definition #
218 ###########################
233 # On Linux, macOS, and Windows, use the system-provided bash as the default
234 # shell. (This should only make a difference on Windows, where the default
235 # shell is PowerShell.)
243 <<: [*shared-ci-variables, *public-variables]
244 if: github.event_name == 'pull_request'
251 - name: x86_64-gnu-llvm-8
254 - name: x86_64-gnu-tools
256 CI_ONLY_WHEN_SUBMODULES_CHANGED: 1
263 <<: [*shared-ci-variables, *prod-variables]
264 if: github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'
268 - name: dist-x86_64-linux
275 <<: [*shared-ci-variables, *prod-variables]
276 if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
280 #############################
281 # Linux/Docker builders #
282 #############################
290 - name: dist-aarch64-linux
296 - name: dist-arm-linux
299 - name: dist-armhf-linux
302 - name: dist-armv7-linux
305 - name: dist-i586-gnu-i586-i686-musl
308 - name: dist-i686-freebsd
311 - name: dist-i686-linux
314 - name: dist-mips-linux
317 - name: dist-mips64-linux
320 - name: dist-mips64el-linux
323 - name: dist-mipsel-linux
326 - name: dist-powerpc-linux
329 - name: dist-powerpc64-linux
332 - name: dist-powerpc64le-linux
335 - name: dist-riscv64-linux
338 - name: dist-s390x-linux
341 - name: dist-various-1
344 - name: dist-various-2
347 - name: dist-x86_64-freebsd
350 - name: dist-x86_64-illumos
353 - name: dist-x86_64-linux
356 - name: dist-x86_64-linux-alt
358 IMAGE: dist-x86_64-linux
361 - name: dist-x86_64-musl
364 - name: dist-x86_64-netbsd
370 - name: i686-gnu-nopt
385 - name: x86_64-gnu-aux
388 - name: x86_64-gnu-debug
391 - name: x86_64-gnu-distcheck
394 - name: x86_64-gnu-full-bootstrap
397 - name: x86_64-gnu-llvm-8
402 - name: x86_64-gnu-nopt
405 - name: x86_64-gnu-tools
407 DEPLOY_TOOLSTATES_JSON: toolstates-linux.json
410 ######################
412 ######################
414 - name: x86_64-msvc-1
416 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
417 SCRIPT: make ci-subset-1
419 NO_DEBUG_ASSERTIONS: 1
420 NO_LLVM_ASSERTIONS: 1
423 - name: x86_64-msvc-2
425 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
426 SCRIPT: make ci-subset-2
431 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
432 SCRIPT: make ci-subset-1
434 NO_DEBUG_ASSERTIONS: 1
435 NO_LLVM_ASSERTIONS: 1
440 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
441 SCRIPT: make ci-subset-2
443 NO_DEBUG_ASSERTIONS: 1
444 NO_LLVM_ASSERTIONS: 1
447 - name: x86_64-msvc-cargo
449 SCRIPT: python x.py test src/tools/cargotest src/tools/cargo
450 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld
451 VCVARS_BAT: vcvars64.bat
453 NO_DEBUG_ASSERTIONS: 1
454 NO_LLVM_ASSERTIONS: 1
457 - name: x86_64-msvc-tools
459 SCRIPT: src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows
460 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstate/toolstates.json
463 # 32/64-bit MinGW builds.
465 # We are using MinGW with posix threads since LLVM does not compile with
466 # the win32 threads version due to missing support for C++'s std::thread.
468 # Instead of relying on the MinGW version installed on appveryor we download
469 # and install one ourselves so we won't be surprised by changes to appveyor's
472 # Finally, note that the downloads below are all in the `rust-lang-ci` S3
473 # bucket, but they cleraly didn't originate there! The downloads originally
474 # came from the mingw-w64 SourceForge download site. Unfortunately
475 # SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
479 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
480 SCRIPT: make ci-mingw-subset-1
483 NO_DEBUG_ASSERTIONS: 1
484 NO_LLVM_ASSERTIONS: 1
489 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
490 SCRIPT: make ci-mingw-subset-2
494 - name: x86_64-mingw-1
496 SCRIPT: make ci-mingw-subset-1
497 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
500 NO_DEBUG_ASSERTIONS: 1
501 NO_LLVM_ASSERTIONS: 1
504 - name: x86_64-mingw-2
506 SCRIPT: make ci-mingw-subset-2
507 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
511 - name: dist-x86_64-msvc
513 RUST_CONFIGURE_ARGS: >-
514 --build=x86_64-pc-windows-msvc
515 --target=x86_64-pc-windows-msvc,aarch64-pc-windows-msvc
518 SCRIPT: python x.py dist
519 DIST_REQUIRE_ALL_TOOLS: 1
522 - name: dist-i686-msvc
524 RUST_CONFIGURE_ARGS: >-
525 --build=i686-pc-windows-msvc
526 --target=i586-pc-windows-msvc
529 SCRIPT: python x.py dist
530 DIST_REQUIRE_ALL_TOOLS: 1
533 - name: dist-i686-mingw
535 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools --enable-profiler
536 SCRIPT: python x.py dist
538 DIST_REQUIRE_ALL_TOOLS: 1
541 - name: dist-x86_64-mingw
543 SCRIPT: python x.py dist
544 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler
546 DIST_REQUIRE_ALL_TOOLS: 1
549 - name: dist-x86_64-msvc-alt
551 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
552 SCRIPT: python x.py dist
559 <<: [*shared-ci-variables, *prod-variables]
560 if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
568 - name: dist-x86_64-apple
571 RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc
572 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
573 MACOSX_DEPLOYMENT_TARGET: 10.7
574 NO_LLVM_ASSERTIONS: 1
575 NO_DEBUG_ASSERTIONS: 1
576 DIST_REQUIRE_ALL_TOOLS: 1
579 - name: dist-x86_64-apple-alt
582 RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc
583 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
584 MACOSX_DEPLOYMENT_TARGET: 10.7
585 NO_LLVM_ASSERTIONS: 1
586 NO_DEBUG_ASSERTIONS: 1
592 RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc
593 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
594 MACOSX_DEPLOYMENT_TARGET: 10.8
595 MACOSX_STD_DEPLOYMENT_TARGET: 10.7
596 NO_LLVM_ASSERTIONS: 1
597 NO_DEBUG_ASSERTIONS: 1
602 runs-on: ubuntu-latest
604 <<: [*prod-variables]
605 if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'
607 - name: checkout the source code
608 uses: actions/checkout@v1
612 - name: publish toolstate
613 run: src/ci/publish_toolstate.sh
616 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
619 # These jobs don't actually test anything, but they're used to tell bors the
620 # build completed, as there is no practical way to detect when a workflow is
621 # successful listening to webhooks only.
624 if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'"
625 <<: *base-success-job
628 if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'"
629 <<: *base-failure-job
632 if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
633 <<: *base-success-job
636 if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
637 <<: *base-failure-job