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
84 - name: checkout the source code
85 uses: actions/checkout@v1
89 - name: configure GitHub Actions to kill the build when outdated
90 uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
92 github_token: "${{ secrets.github_token }}"
93 if: success() && !env.SKIP_JOB && github.ref != 'refs/heads/try'
96 - name: add extra environment variables
97 run: src/ci/scripts/setup-environment.sh
99 # Since it's not possible to merge `${{ matrix.env }}` with the other
100 # variables in `job.<name>.env`, the variables defined in the matrix
101 # are passed to the `setup-environment.sh` script encoded in JSON,
102 # which then uses log commands to actually set them.
103 EXTRA_VARIABLES: ${{ toJson(matrix.env) }}
106 - name: decide whether to skip this job
107 run: src/ci/scripts/should-skip-this.sh
110 - name: collect CPU statistics
111 run: src/ci/scripts/collect-cpu-stats.sh
114 - name: show the current environment
115 run: src/ci/scripts/dump-environment.sh
118 - name: install awscli
119 run: src/ci/scripts/install-awscli.sh
122 - name: install sccache
123 run: src/ci/scripts/install-sccache.sh
126 - name: install clang
127 run: src/ci/scripts/install-clang.sh
131 run: src/ci/scripts/install-wix.sh
134 - name: ensure the build happens on a partition with enough space
135 run: src/ci/scripts/symlink-build-dir.sh
138 - name: disable git crlf conversion
139 run: src/ci/scripts/disable-git-crlf-conversion.sh
142 - name: install MSYS2
143 run: src/ci/scripts/install-msys2.sh
146 - name: install MinGW
147 run: src/ci/scripts/install-mingw.sh
150 - name: install ninja
151 run: src/ci/scripts/install-ninja.sh
154 - name: enable ipv6 on Docker
155 run: src/ci/scripts/enable-docker-ipv6.sh
158 # Disable automatic line ending conversion (again). On Windows, when we're
159 # installing dependencies, something switches the git configuration directory or
160 # re-enables autocrlf. We've not tracked down the exact cause -- and there may
161 # be multiple -- but this should ensure submodules are checked out with the
162 # appropriate line endings.
163 - name: disable git crlf conversion
164 run: src/ci/scripts/disable-git-crlf-conversion.sh
167 - name: checkout submodules
168 run: src/ci/scripts/checkout-submodules.sh
171 - name: ensure line endings are correct
172 run: src/ci/scripts/verify-line-endings.sh
175 - name: run the build
176 run: src/ci/scripts/run-build-from-ci.sh
178 AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }}
179 AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}
180 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
183 - name: upload artifacts to S3
184 run: src/ci/scripts/upload-artifacts.sh
186 AWS_ACCESS_KEY_ID: ${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}
187 AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}
188 # Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
189 # builders *should* have the AWS credentials available. Still, explicitly
190 # adding the condition is helpful as this way CI will not silently skip
191 # deploying artifacts from a dist builder if the variables are misconfigured,
192 # erroring about invalid credentials instead.
193 if: success() && !env.SKIP_JOB && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')
196 # These snippets are used by the try-success, try-failure, auto-success and auto-failure jobs.
197 # Check out their documentation for more information on why they're needed.
200 name: bors build finished
201 runs-on: ubuntu-latest
205 - name: mark the job as a success
208 <<: *base-outcome-job
212 - name: mark the job as a failure
215 <<: *base-outcome-job
217 ###########################
218 # Builders definition #
219 ###########################
234 # While on Linux and macOS builders it just forwards the arguments to the
235 # system bash, this wrapper allows switching from the host's bash.exe to
236 # the one we install along with MSYS2 mid-build on Windows.
238 # Once the step to install MSYS2 is executed, the CI_OVERRIDE_SHELL
239 # environment variable is set pointing to our MSYS2's bash.exe. From that
240 # moment the host's bash.exe will not be called anymore.
242 # This is needed because we can't launch our own bash.exe from the host
243 # bash.exe, as that would load two different cygwin1.dll in memory, causing
244 # "cygwin heap mismatch" errors.
245 shell: python src/ci/exec-with-shell.py {0}
252 <<: [*shared-ci-variables, *public-variables]
253 if: github.event_name == 'pull_request'
260 - name: x86_64-gnu-llvm-8
263 - name: x86_64-gnu-tools
265 CI_ONLY_WHEN_SUBMODULES_CHANGED: 1
272 <<: [*shared-ci-variables, *prod-variables]
273 if: github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'
277 - name: dist-x86_64-linux
284 <<: [*shared-ci-variables, *prod-variables]
285 if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
289 #############################
290 # Linux/Docker builders #
291 #############################
299 - name: dist-aarch64-linux
305 - name: dist-arm-linux
308 - name: dist-armhf-linux
311 - name: dist-armv7-linux
314 - name: dist-i586-gnu-i586-i686-musl
317 - name: dist-i686-freebsd
320 - name: dist-i686-linux
323 - name: dist-mips-linux
326 - name: dist-mips64-linux
329 - name: dist-mips64el-linux
332 - name: dist-mipsel-linux
335 - name: dist-powerpc-linux
338 - name: dist-powerpc64-linux
341 - name: dist-powerpc64le-linux
344 - name: dist-s390x-linux
347 - name: dist-various-1
350 - name: dist-various-2
353 - name: dist-x86_64-freebsd
356 - name: dist-x86_64-linux
359 - name: dist-x86_64-linux-alt
361 IMAGE: dist-x86_64-linux
364 - name: dist-x86_64-musl
367 - name: dist-x86_64-netbsd
373 - name: i686-gnu-nopt
388 - name: x86_64-gnu-aux
391 - name: x86_64-gnu-debug
394 - name: x86_64-gnu-distcheck
397 - name: x86_64-gnu-full-bootstrap
400 - name: x86_64-gnu-llvm-8
405 - name: x86_64-gnu-nopt
408 - name: x86_64-gnu-tools
410 DEPLOY_TOOLSTATES_JSON: toolstates-linux.json
413 ######################
415 ######################
417 - name: x86_64-msvc-1
419 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
420 SCRIPT: make ci-subset-1
422 NO_DEBUG_ASSERTIONS: 1
423 NO_LLVM_ASSERTIONS: 1
426 - name: x86_64-msvc-2
428 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
429 SCRIPT: make ci-subset-2
434 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
435 SCRIPT: make ci-subset-1
437 NO_DEBUG_ASSERTIONS: 1
438 NO_LLVM_ASSERTIONS: 1
443 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
444 SCRIPT: make ci-subset-2
446 NO_DEBUG_ASSERTIONS: 1
447 NO_LLVM_ASSERTIONS: 1
450 - name: x86_64-msvc-cargo
452 SCRIPT: python x.py test src/tools/cargotest src/tools/cargo
453 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld
454 VCVARS_BAT: vcvars64.bat
456 NO_DEBUG_ASSERTIONS: 1
457 NO_LLVM_ASSERTIONS: 1
460 - name: x86_64-msvc-tools
462 SCRIPT: src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows
463 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstate/toolstates.json
466 # 32/64-bit MinGW builds.
468 # We are using MinGW with posix threads since LLVM does not compile with
469 # the win32 threads version due to missing support for C++'s std::thread.
471 # Instead of relying on the MinGW version installed on appveryor we download
472 # and install one ourselves so we won't be surprised by changes to appveyor's
475 # Finally, note that the downloads below are all in the `rust-lang-ci` S3
476 # bucket, but they cleraly didn't originate there! The downloads originally
477 # came from the mingw-w64 SourceForge download site. Unfortunately
478 # SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
482 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
483 SCRIPT: make ci-mingw-subset-1
486 NO_DEBUG_ASSERTIONS: 1
487 NO_LLVM_ASSERTIONS: 1
492 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
493 SCRIPT: make ci-mingw-subset-2
497 - name: x86_64-mingw-1
499 SCRIPT: make ci-mingw-subset-1
500 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
503 NO_DEBUG_ASSERTIONS: 1
504 NO_LLVM_ASSERTIONS: 1
507 - name: x86_64-mingw-2
509 SCRIPT: make ci-mingw-subset-2
510 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
514 - name: dist-x86_64-msvc
516 RUST_CONFIGURE_ARGS: >-
517 --build=x86_64-pc-windows-msvc
518 --target=x86_64-pc-windows-msvc,aarch64-pc-windows-msvc
521 SCRIPT: python x.py dist
522 DIST_REQUIRE_ALL_TOOLS: 1
525 - name: dist-i686-msvc
527 RUST_CONFIGURE_ARGS: >-
528 --build=i686-pc-windows-msvc
529 --target=i586-pc-windows-msvc
532 SCRIPT: python x.py dist
533 DIST_REQUIRE_ALL_TOOLS: 1
536 - name: dist-i686-mingw
538 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools --enable-profiler
539 SCRIPT: python x.py dist
541 DIST_REQUIRE_ALL_TOOLS: 1
544 - name: dist-x86_64-mingw
546 SCRIPT: python x.py dist
547 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler
549 DIST_REQUIRE_ALL_TOOLS: 1
552 - name: dist-x86_64-msvc-alt
554 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
555 SCRIPT: python x.py dist
562 <<: [*shared-ci-variables, *prod-variables]
563 if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
571 - name: dist-x86_64-apple
574 RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc
575 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
576 MACOSX_DEPLOYMENT_TARGET: 10.7
577 NO_LLVM_ASSERTIONS: 1
578 NO_DEBUG_ASSERTIONS: 1
579 DIST_REQUIRE_ALL_TOOLS: 1
582 - name: dist-x86_64-apple-alt
585 RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc
586 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
587 MACOSX_DEPLOYMENT_TARGET: 10.7
588 NO_LLVM_ASSERTIONS: 1
589 NO_DEBUG_ASSERTIONS: 1
595 RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc
596 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
597 MACOSX_DEPLOYMENT_TARGET: 10.8
598 MACOSX_STD_DEPLOYMENT_TARGET: 10.7
599 NO_LLVM_ASSERTIONS: 1
600 NO_DEBUG_ASSERTIONS: 1
605 runs-on: ubuntu-latest
607 <<: [*prod-variables]
608 if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'
610 - name: checkout the source code
611 uses: actions/checkout@v1
615 - name: publish toolstate
616 run: src/ci/publish_toolstate.sh
618 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
621 # These jobs don't actually test anything, but they're used to tell bors the
622 # build completed, as there is no practical way to detect when a workflow is
623 # successful listening to webhooks only.
626 if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'"
627 <<: *base-success-job
630 if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'"
631 <<: *base-failure-job
634 if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
635 <<: *base-success-job
638 if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
639 <<: *base-failure-job