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 MSYS2 packages
151 run: src/ci/scripts/install-msys2-packages.sh
154 - name: install MinGW
155 run: src/ci/scripts/install-mingw.sh
158 - name: install ninja
159 run: src/ci/scripts/install-ninja.sh
162 - name: enable ipv6 on Docker
163 run: src/ci/scripts/enable-docker-ipv6.sh
166 # Disable automatic line ending conversion (again). On Windows, when we're
167 # installing dependencies, something switches the git configuration directory or
168 # re-enables autocrlf. We've not tracked down the exact cause -- and there may
169 # be multiple -- but this should ensure submodules are checked out with the
170 # appropriate line endings.
171 - name: disable git crlf conversion
172 run: src/ci/scripts/disable-git-crlf-conversion.sh
175 - name: checkout submodules
176 run: src/ci/scripts/checkout-submodules.sh
179 - name: ensure line endings are correct
180 run: src/ci/scripts/verify-line-endings.sh
183 - name: run the build
184 run: src/ci/scripts/run-build-from-ci.sh
186 AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }}
187 AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}
188 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
191 - name: upload artifacts to S3
192 run: src/ci/scripts/upload-artifacts.sh
194 AWS_ACCESS_KEY_ID: ${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}
195 AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}
196 # Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
197 # builders *should* have the AWS credentials available. Still, explicitly
198 # adding the condition is helpful as this way CI will not silently skip
199 # deploying artifacts from a dist builder if the variables are misconfigured,
200 # erroring about invalid credentials instead.
201 if: success() && !env.SKIP_JOB && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')
204 # These snippets are used by the try-success, try-failure, auto-success and auto-failure jobs.
205 # Check out their documentation for more information on why they're needed.
208 name: bors build finished
209 runs-on: ubuntu-latest
213 - name: mark the job as a success
216 <<: *base-outcome-job
220 - name: mark the job as a failure
223 <<: *base-outcome-job
225 ###########################
226 # Builders definition #
227 ###########################
242 # While on Linux and macOS builders it just forwards the arguments to the
243 # system bash, this wrapper allows switching from the host's bash.exe to
244 # the one we install along with MSYS2 mid-build on Windows.
246 # Once the step to install MSYS2 is executed, the CI_OVERRIDE_SHELL
247 # environment variable is set pointing to our MSYS2's bash.exe. From that
248 # moment the host's bash.exe will not be called anymore.
250 # This is needed because we can't launch our own bash.exe from the host
251 # bash.exe, as that would load two different cygwin1.dll in memory, causing
252 # "cygwin heap mismatch" errors.
253 shell: python src/ci/exec-with-shell.py {0}
260 <<: [*shared-ci-variables, *public-variables]
261 if: github.event_name == 'pull_request'
268 - name: x86_64-gnu-llvm-8
271 - name: x86_64-gnu-tools
273 CI_ONLY_WHEN_SUBMODULES_CHANGED: 1
280 <<: [*shared-ci-variables, *prod-variables]
281 if: github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'
285 - name: dist-x86_64-linux
288 - name: dist-x86_64-linux-alt
290 IMAGE: dist-x86_64-linux
297 <<: [*shared-ci-variables, *prod-variables]
298 if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
302 #############################
303 # Linux/Docker builders #
304 #############################
312 - name: dist-aarch64-linux
318 - name: dist-arm-linux
321 - name: dist-armhf-linux
324 - name: dist-armv7-linux
327 - name: dist-i586-gnu-i586-i686-musl
330 - name: dist-i686-freebsd
333 - name: dist-i686-linux
336 - name: dist-mips-linux
339 - name: dist-mips64-linux
342 - name: dist-mips64el-linux
345 - name: dist-mipsel-linux
348 - name: dist-powerpc-linux
351 - name: dist-powerpc64-linux
354 - name: dist-powerpc64le-linux
357 - name: dist-s390x-linux
360 - name: dist-various-1
363 - name: dist-various-2
366 - name: dist-x86_64-freebsd
369 - name: dist-x86_64-linux
372 - name: dist-x86_64-linux-alt
374 IMAGE: dist-x86_64-linux
377 - name: dist-x86_64-musl
380 - name: dist-x86_64-netbsd
386 - name: i686-gnu-nopt
401 - name: x86_64-gnu-aux
404 - name: x86_64-gnu-debug
407 - name: x86_64-gnu-distcheck
410 - name: x86_64-gnu-full-bootstrap
413 - name: x86_64-gnu-llvm-8
418 - name: x86_64-gnu-nopt
421 - name: x86_64-gnu-tools
423 DEPLOY_TOOLSTATES_JSON: toolstates-linux.json
430 - name: dist-x86_64-apple
433 RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc
434 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
435 MACOSX_DEPLOYMENT_TARGET: 10.7
436 NO_LLVM_ASSERTIONS: 1
437 NO_DEBUG_ASSERTIONS: 1
438 DIST_REQUIRE_ALL_TOOLS: 1
441 - name: dist-x86_64-apple-alt
444 RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc
445 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
446 MACOSX_DEPLOYMENT_TARGET: 10.7
447 NO_LLVM_ASSERTIONS: 1
448 NO_DEBUG_ASSERTIONS: 1
454 RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc
455 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
456 MACOSX_DEPLOYMENT_TARGET: 10.8
457 MACOSX_STD_DEPLOYMENT_TARGET: 10.7
458 NO_LLVM_ASSERTIONS: 1
459 NO_DEBUG_ASSERTIONS: 1
462 ######################
464 ######################
466 - name: x86_64-msvc-1
468 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
469 SCRIPT: make ci-subset-1
471 NO_DEBUG_ASSERTIONS: 1
472 NO_LLVM_ASSERTIONS: 1
475 - name: x86_64-msvc-2
477 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
478 SCRIPT: make ci-subset-2
483 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
484 SCRIPT: make ci-subset-1
486 NO_DEBUG_ASSERTIONS: 1
487 NO_LLVM_ASSERTIONS: 1
492 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
493 SCRIPT: make ci-subset-2
495 NO_DEBUG_ASSERTIONS: 1
496 NO_LLVM_ASSERTIONS: 1
499 - name: x86_64-msvc-aux
501 RUST_CHECK_TARGET: check-aux EXCLUDE_CARGO=1
502 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
505 - name: x86_64-msvc-cargo
507 SCRIPT: python x.py test src/tools/cargotest src/tools/cargo
508 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
509 VCVARS_BAT: vcvars64.bat
511 NO_DEBUG_ASSERTIONS: 1
512 NO_LLVM_ASSERTIONS: 1
515 - name: x86_64-msvc-tools
517 SCRIPT: src/ci/docker/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows
518 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstate/toolstates.json
521 # 32/64-bit MinGW builds.
523 # We are using MinGW with posix threads since LLVM does not compile with
524 # the win32 threads version due to missing support for C++'s std::thread.
526 # Instead of relying on the MinGW version installed on appveryor we download
527 # and install one ourselves so we won't be surprised by changes to appveyor's
530 # Finally, note that the downloads below are all in the `rust-lang-ci` S3
531 # bucket, but they cleraly didn't originate there! The downloads originally
532 # came from the mingw-w64 SourceForge download site. Unfortunately
533 # SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
537 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
538 SCRIPT: make ci-mingw-subset-1
541 NO_DEBUG_ASSERTIONS: 1
542 NO_LLVM_ASSERTIONS: 1
547 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
548 SCRIPT: make ci-mingw-subset-2
552 - name: x86_64-mingw-1
554 SCRIPT: make ci-mingw-subset-1
555 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
558 NO_DEBUG_ASSERTIONS: 1
559 NO_LLVM_ASSERTIONS: 1
562 - name: x86_64-mingw-2
564 SCRIPT: make ci-mingw-subset-2
565 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
569 - name: dist-x86_64-msvc
571 RUST_CONFIGURE_ARGS: >-
572 --build=x86_64-pc-windows-msvc
573 --target=x86_64-pc-windows-msvc,aarch64-pc-windows-msvc
576 SCRIPT: python x.py dist
577 DIST_REQUIRE_ALL_TOOLS: 1
580 - name: dist-i686-msvc
582 RUST_CONFIGURE_ARGS: >-
583 --build=i686-pc-windows-msvc
584 --target=i586-pc-windows-msvc
587 SCRIPT: python x.py dist
588 DIST_REQUIRE_ALL_TOOLS: 1
591 - name: dist-i686-mingw
593 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools --enable-profiler
594 SCRIPT: python x.py dist
596 DIST_REQUIRE_ALL_TOOLS: 1
599 - name: dist-x86_64-mingw
601 SCRIPT: python x.py dist
602 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler
604 DIST_REQUIRE_ALL_TOOLS: 1
607 - name: dist-x86_64-msvc-alt
609 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
610 SCRIPT: python x.py dist
615 runs-on: ubuntu-latest
617 <<: [*prod-variables]
618 if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'
620 - name: checkout the source code
621 uses: actions/checkout@v1
625 - name: publish toolstate
626 run: src/ci/publish_toolstate.sh
628 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
631 # These jobs don't actually test anything, but they're used to tell bors the
632 # build completed, as there is no practical way to detect when a workflow is
633 # successful listening to webhooks only.
636 if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'"
637 <<: *base-success-job
640 if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'"
641 <<: *base-failure-job
644 if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
645 <<: *base-success-job
648 if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
649 <<: *base-failure-job