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: install InnoSetup
135 run: src/ci/scripts/install-innosetup.sh
138 - name: ensure the build happens on a partition with enough space
139 run: src/ci/scripts/symlink-build-dir.sh
142 - name: disable git crlf conversion
143 run: src/ci/scripts/disable-git-crlf-conversion.sh
146 - name: install MSYS2
147 run: src/ci/scripts/install-msys2.sh
150 - name: install MinGW
151 run: src/ci/scripts/install-mingw.sh
154 - name: install ninja
155 run: src/ci/scripts/install-ninja.sh
158 - name: enable ipv6 on Docker
159 run: src/ci/scripts/enable-docker-ipv6.sh
162 # Disable automatic line ending conversion (again). On Windows, when we're
163 # installing dependencies, something switches the git configuration directory or
164 # re-enables autocrlf. We've not tracked down the exact cause -- and there may
165 # be multiple -- but this should ensure submodules are checked out with the
166 # appropriate line endings.
167 - name: disable git crlf conversion
168 run: src/ci/scripts/disable-git-crlf-conversion.sh
171 - name: checkout submodules
172 run: src/ci/scripts/checkout-submodules.sh
175 - name: ensure line endings are correct
176 run: src/ci/scripts/verify-line-endings.sh
179 - name: run the build
180 run: src/ci/scripts/run-build-from-ci.sh
182 AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }}
183 AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}
184 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
187 - name: upload artifacts to S3
188 run: src/ci/scripts/upload-artifacts.sh
190 AWS_ACCESS_KEY_ID: ${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}
191 AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}
192 # Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
193 # builders *should* have the AWS credentials available. Still, explicitly
194 # adding the condition is helpful as this way CI will not silently skip
195 # deploying artifacts from a dist builder if the variables are misconfigured,
196 # erroring about invalid credentials instead.
197 if: success() && !env.SKIP_JOB && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')
200 # These snippets are used by the try-success, try-failure, auto-success and auto-failure jobs.
201 # Check out their documentation for more information on why they're needed.
204 name: bors build finished
205 runs-on: ubuntu-latest
209 - name: mark the job as a success
212 <<: *base-outcome-job
216 - name: mark the job as a failure
219 <<: *base-outcome-job
221 ###########################
222 # Builders definition #
223 ###########################
238 # While on Linux and macOS builders it just forwards the arguments to the
239 # system bash, this wrapper allows switching from the host's bash.exe to
240 # the one we install along with MSYS2 mid-build on Windows.
242 # Once the step to install MSYS2 is executed, the CI_OVERRIDE_SHELL
243 # environment variable is set pointing to our MSYS2's bash.exe. From that
244 # moment the host's bash.exe will not be called anymore.
246 # This is needed because we can't launch our own bash.exe from the host
247 # bash.exe, as that would load two different cygwin1.dll in memory, causing
248 # "cygwin heap mismatch" errors.
249 shell: python src/ci/exec-with-shell.py {0}
256 <<: [*shared-ci-variables, *public-variables]
257 if: github.event_name == 'pull_request'
264 - name: x86_64-gnu-llvm-8
267 - name: x86_64-gnu-tools
269 CI_ONLY_WHEN_SUBMODULES_CHANGED: 1
276 <<: [*shared-ci-variables, *prod-variables]
277 if: github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'
281 - name: dist-x86_64-linux
288 <<: [*shared-ci-variables, *prod-variables]
289 if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
293 #############################
294 # Linux/Docker builders #
295 #############################
303 - name: dist-aarch64-linux
309 - name: dist-arm-linux
312 - name: dist-armhf-linux
315 - name: dist-armv7-linux
318 - name: dist-i586-gnu-i586-i686-musl
321 - name: dist-i686-freebsd
324 - name: dist-i686-linux
327 - name: dist-mips-linux
330 - name: dist-mips64-linux
333 - name: dist-mips64el-linux
336 - name: dist-mipsel-linux
339 - name: dist-powerpc-linux
342 - name: dist-powerpc64-linux
345 - name: dist-powerpc64le-linux
348 - name: dist-s390x-linux
351 - name: dist-various-1
354 - name: dist-various-2
357 - name: dist-x86_64-freebsd
360 - name: dist-x86_64-linux
363 - name: dist-x86_64-linux-alt
365 IMAGE: dist-x86_64-linux
368 - name: dist-x86_64-musl
371 - name: dist-x86_64-netbsd
377 - name: i686-gnu-nopt
392 - name: x86_64-gnu-aux
395 - name: x86_64-gnu-debug
398 - name: x86_64-gnu-distcheck
401 - name: x86_64-gnu-full-bootstrap
404 - name: x86_64-gnu-llvm-8
409 - name: x86_64-gnu-nopt
412 - name: x86_64-gnu-tools
414 DEPLOY_TOOLSTATES_JSON: toolstates-linux.json
421 - name: dist-x86_64-apple
424 RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc
425 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
426 MACOSX_DEPLOYMENT_TARGET: 10.7
427 NO_LLVM_ASSERTIONS: 1
428 NO_DEBUG_ASSERTIONS: 1
429 DIST_REQUIRE_ALL_TOOLS: 1
432 - name: dist-x86_64-apple-alt
435 RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc
436 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
437 MACOSX_DEPLOYMENT_TARGET: 10.7
438 NO_LLVM_ASSERTIONS: 1
439 NO_DEBUG_ASSERTIONS: 1
445 RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc
446 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
447 MACOSX_DEPLOYMENT_TARGET: 10.8
448 MACOSX_STD_DEPLOYMENT_TARGET: 10.7
449 NO_LLVM_ASSERTIONS: 1
450 NO_DEBUG_ASSERTIONS: 1
453 ######################
455 ######################
457 - name: x86_64-msvc-1
459 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
460 SCRIPT: make ci-subset-1
462 NO_DEBUG_ASSERTIONS: 1
463 NO_LLVM_ASSERTIONS: 1
466 - name: x86_64-msvc-2
468 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
469 SCRIPT: make ci-subset-2
474 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
475 SCRIPT: make ci-subset-1
477 NO_DEBUG_ASSERTIONS: 1
478 NO_LLVM_ASSERTIONS: 1
483 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
484 SCRIPT: make ci-subset-2
486 NO_DEBUG_ASSERTIONS: 1
487 NO_LLVM_ASSERTIONS: 1
490 - name: x86_64-msvc-cargo
492 SCRIPT: python x.py test src/tools/cargotest src/tools/cargo
493 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld
494 VCVARS_BAT: vcvars64.bat
496 NO_DEBUG_ASSERTIONS: 1
497 NO_LLVM_ASSERTIONS: 1
500 - name: x86_64-msvc-tools
502 SCRIPT: src/ci/docker/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows
503 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstate/toolstates.json
506 # 32/64-bit MinGW builds.
508 # We are using MinGW with posix threads since LLVM does not compile with
509 # the win32 threads version due to missing support for C++'s std::thread.
511 # Instead of relying on the MinGW version installed on appveryor we download
512 # and install one ourselves so we won't be surprised by changes to appveyor's
515 # Finally, note that the downloads below are all in the `rust-lang-ci` S3
516 # bucket, but they cleraly didn't originate there! The downloads originally
517 # came from the mingw-w64 SourceForge download site. Unfortunately
518 # SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
522 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
523 SCRIPT: make ci-mingw-subset-1
526 NO_DEBUG_ASSERTIONS: 1
527 NO_LLVM_ASSERTIONS: 1
532 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
533 SCRIPT: make ci-mingw-subset-2
537 - name: x86_64-mingw-1
539 SCRIPT: make ci-mingw-subset-1
540 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
543 NO_DEBUG_ASSERTIONS: 1
544 NO_LLVM_ASSERTIONS: 1
547 - name: x86_64-mingw-2
549 SCRIPT: make ci-mingw-subset-2
550 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
554 - name: dist-x86_64-msvc
556 RUST_CONFIGURE_ARGS: >-
557 --build=x86_64-pc-windows-msvc
558 --target=x86_64-pc-windows-msvc,aarch64-pc-windows-msvc
561 SCRIPT: python x.py dist
562 DIST_REQUIRE_ALL_TOOLS: 1
565 - name: dist-i686-msvc
567 RUST_CONFIGURE_ARGS: >-
568 --build=i686-pc-windows-msvc
569 --target=i586-pc-windows-msvc
572 SCRIPT: python x.py dist
573 DIST_REQUIRE_ALL_TOOLS: 1
576 - name: dist-i686-mingw
578 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools --enable-profiler
579 SCRIPT: python x.py dist
581 DIST_REQUIRE_ALL_TOOLS: 1
584 - name: dist-x86_64-mingw
586 SCRIPT: python x.py dist
587 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler
589 DIST_REQUIRE_ALL_TOOLS: 1
592 - name: dist-x86_64-msvc-alt
594 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
595 SCRIPT: python x.py dist
600 runs-on: ubuntu-latest
602 <<: [*prod-variables]
603 if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'
605 - name: checkout the source code
606 uses: actions/checkout@v1
610 - name: publish toolstate
611 run: src/ci/publish_toolstate.sh
613 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
616 # These jobs don't actually test anything, but they're used to tell bors the
617 # build completed, as there is no practical way to detect when a workflow is
618 # successful listening to webhooks only.
621 if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'"
622 <<: *base-success-job
625 if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'"
626 <<: *base-failure-job
629 if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
630 <<: *base-success-job
633 if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
634 <<: *base-failure-job