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
42 SCCACHE_BUCKET: rust-lang-gha-caches
43 DEPLOY_BUCKET: rust-lang-gha
44 TOOLSTATE_REPO: https://github.com/pietroalbini/rust-toolstate
45 TOOLSTATE_ISSUES_API_URL: https://api.github.com/repos/pietroalbini/rust-toolstate/issues
47 # AWS_SECRET_ACCESS_KEYs are stored in GitHub's secrets storage, named
48 # AWS_SECRET_ACCESS_KEY_<keyid>. Including the key id in the name allows to
49 # rotate them in a single branch while keeping the old key in another
50 # branch, which wouldn't be possible if the key was named with the kind
51 # (caches, artifacts...).
52 CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZOMUQATD5
53 ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZH5AYXDVF
63 os: macos-latest # We don't have an XL builder for this
71 if: success() && !env.SKIP_JOB
75 runs-on: "${{ matrix.os }}"
76 env: *shared-ci-variables
78 - name: disable git crlf conversion
79 run: git config --global core.autocrlf false
82 - name: checkout the source code
83 uses: actions/checkout@v1
87 - name: configure GitHub Actions to kill the build when outdated
88 uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
90 github_token: "${{ secrets.github_token }}"
91 if: success() && !env.SKIP_JOB && github.ref != 'refs/heads/try'
94 - name: add extra environment variables
95 run: src/ci/scripts/setup-environment.sh
97 # Since it's not possible to merge `${{ matrix.env }}` with the other
98 # variables in `job.<name>.env`, the variables defined in the matrix
99 # are passed to the `setup-environment.sh` script encoded in JSON,
100 # which then uses log commands to actually set them.
101 EXTRA_VARIABLES: ${{ toJson(matrix.env) }}
104 - name: decide whether to skip this job
105 run: src/ci/scripts/should-skip-this.sh
108 - name: collect CPU statistics
109 run: src/ci/scripts/collect-cpu-stats.sh
112 - name: show the current environment
113 run: src/ci/scripts/dump-environment.sh
116 - name: install awscli
117 run: src/ci/scripts/install-awscli.sh
120 - name: install sccache
121 run: src/ci/scripts/install-sccache.sh
124 - name: install clang
125 run: src/ci/scripts/install-clang.sh
129 run: src/ci/scripts/install-wix.sh
132 - name: install InnoSetup
133 run: src/ci/scripts/install-innosetup.sh
136 - name: ensure the build happens on a partition with enough space
137 run: src/ci/scripts/symlink-build-dir.sh
140 - name: disable git crlf conversion
141 run: src/ci/scripts/disable-git-crlf-conversion.sh
144 - name: install MSYS2
145 run: src/ci/scripts/install-msys2.sh
148 - name: install MSYS2 packages
149 run: src/ci/scripts/install-msys2-packages.sh
152 - name: install MinGW
153 run: src/ci/scripts/install-mingw.sh
156 - name: install ninja
157 run: src/ci/scripts/install-ninja.sh
160 - name: enable ipv6 on Docker
161 run: src/ci/scripts/enable-docker-ipv6.sh
164 # Disable automatic line ending conversion (again). On Windows, when we're
165 # installing dependencies, something switches the git configuration directory or
166 # re-enables autocrlf. We've not tracked down the exact cause -- and there may
167 # be multiple -- but this should ensure submodules are checked out with the
168 # appropriate line endings.
169 - name: disable git crlf conversion
170 run: src/ci/scripts/disable-git-crlf-conversion.sh
173 - name: checkout submodules
174 run: src/ci/scripts/checkout-submodules.sh
177 - name: ensure line endings are correct
178 run: src/ci/scripts/verify-line-endings.sh
181 - name: run the build
182 run: src/ci/scripts/run-build-from-ci.sh
184 AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }}
185 AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}
186 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
189 - name: upload artifacts to S3
190 run: src/ci/scripts/upload-artifacts.sh
192 AWS_ACCESS_KEY_ID: ${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}
193 AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}
194 # Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
195 # builders *should* have the AWS credentials available. Still, explicitly
196 # adding the condition is helpful as this way CI will not silently skip
197 # deploying artifacts from a dist builder if the variables are misconfigured,
198 # erroring about invalid credentials instead.
199 if: success() && !env.SKIP_JOB && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')
202 # These snippets are used by the try-success, try-failure, auto-success and auto-failure jobs.
203 # Check out their documentation for more information on why they're needed.
206 name: bors build finished
207 runs-on: ubuntu-latest
211 - name: mark the job as a success
214 <<: *base-outcome-job
218 - name: mark the job as a failure
221 <<: *base-outcome-job
223 ###########################
224 # Builders definition #
225 ###########################
240 # While on Linux and macOS builders it just forwards the arguments to the
241 # system bash, this wrapper allows switching from the host's bash.exe to
242 # the one we install along with MSYS2 mid-build on Windows.
244 # Once the step to install MSYS2 is executed, the CI_OVERRIDE_SHELL
245 # environment variable is set pointing to our MSYS2's bash.exe. From that
246 # moment the host's bash.exe will not be called anymore.
248 # This is needed because we can't launch our own bash.exe from the host
249 # bash.exe, as that would load two different cygwin1.dll in memory, causing
250 # "cygwin heap mismatch" errors.
251 shell: python src/ci/exec-with-shell.py {0}
258 <<: [*shared-ci-variables, *public-variables]
259 if: github.event_name == 'pull_request'
266 - name: x86_64-gnu-llvm-8
269 - name: x86_64-gnu-tools
271 CI_ONLY_WHEN_SUBMODULES_CHANGED: 1
278 <<: [*shared-ci-variables, *prod-variables]
279 if: github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'
283 - name: dist-x86_64-linux
286 - name: dist-x86_64-linux-alt
288 IMAGE: dist-x86_64-linux
295 <<: [*shared-ci-variables, *prod-variables]
296 if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
300 #############################
301 # Linux/Docker builders #
302 #############################
310 - name: dist-aarch64-linux
316 - name: dist-arm-linux
319 - name: dist-armhf-linux
322 - name: dist-armv7-linux
325 - name: dist-i586-gnu-i586-i686-musl
328 - name: dist-i686-freebsd
331 - name: dist-i686-linux
334 - name: dist-mips-linux
337 - name: dist-mips64-linux
340 - name: dist-mips64el-linux
343 - name: dist-mipsel-linux
346 - name: dist-powerpc-linux
349 - name: dist-powerpc64-linux
352 - name: dist-powerpc64le-linux
355 - name: dist-s390x-linux
358 - name: dist-various-1
361 - name: dist-various-2
364 - name: dist-x86_64-freebsd
367 - name: dist-x86_64-linux
370 - name: dist-x86_64-linux-alt
372 IMAGE: dist-x86_64-linux
375 - name: dist-x86_64-musl
378 - name: dist-x86_64-netbsd
384 - name: i686-gnu-nopt
399 - name: x86_64-gnu-aux
402 - name: x86_64-gnu-debug
405 - name: x86_64-gnu-distcheck
408 - name: x86_64-gnu-full-bootstrap
411 - name: x86_64-gnu-llvm-8
416 - name: x86_64-gnu-nopt
419 - name: x86_64-gnu-tools
421 DEPLOY_TOOLSTATES_JSON: toolstates-linux.json
428 - name: dist-x86_64-apple
431 RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc
432 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
433 MACOSX_DEPLOYMENT_TARGET: 10.7
434 NO_LLVM_ASSERTIONS: 1
435 NO_DEBUG_ASSERTIONS: 1
436 DIST_REQUIRE_ALL_TOOLS: 1
439 - name: dist-x86_64-apple-alt
442 RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc
443 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
444 MACOSX_DEPLOYMENT_TARGET: 10.7
445 NO_LLVM_ASSERTIONS: 1
446 NO_DEBUG_ASSERTIONS: 1
452 RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc
453 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
454 MACOSX_DEPLOYMENT_TARGET: 10.8
455 MACOSX_STD_DEPLOYMENT_TARGET: 10.7
456 NO_LLVM_ASSERTIONS: 1
457 NO_DEBUG_ASSERTIONS: 1
460 ######################
462 ######################
464 - name: x86_64-msvc-1
466 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
467 SCRIPT: make ci-subset-1
469 NO_DEBUG_ASSERTIONS: 1
470 NO_LLVM_ASSERTIONS: 1
473 - name: x86_64-msvc-2
475 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
476 SCRIPT: make ci-subset-2
481 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
482 SCRIPT: make ci-subset-1
484 NO_DEBUG_ASSERTIONS: 1
485 NO_LLVM_ASSERTIONS: 1
490 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
491 SCRIPT: make ci-subset-2
493 NO_DEBUG_ASSERTIONS: 1
494 NO_LLVM_ASSERTIONS: 1
497 - name: x86_64-msvc-aux
499 RUST_CHECK_TARGET: check-aux EXCLUDE_CARGO=1
500 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
503 - name: x86_64-msvc-cargo
505 SCRIPT: python x.py test src/tools/cargotest src/tools/cargo
506 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
507 VCVARS_BAT: vcvars64.bat
509 NO_DEBUG_ASSERTIONS: 1
510 NO_LLVM_ASSERTIONS: 1
513 - name: x86_64-msvc-tools
515 SCRIPT: src/ci/docker/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows
516 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstate/toolstates.json
519 # 32/64-bit MinGW builds.
521 # We are using MinGW with posix threads since LLVM does not compile with
522 # the win32 threads version due to missing support for C++'s std::thread.
524 # Instead of relying on the MinGW version installed on appveryor we download
525 # and install one ourselves so we won't be surprised by changes to appveyor's
528 # Finally, note that the downloads below are all in the `rust-lang-ci` S3
529 # bucket, but they cleraly didn't originate there! The downloads originally
530 # came from the mingw-w64 SourceForge download site. Unfortunately
531 # SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
535 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
536 SCRIPT: make ci-mingw-subset-1
539 NO_DEBUG_ASSERTIONS: 1
540 NO_LLVM_ASSERTIONS: 1
545 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
546 SCRIPT: make ci-mingw-subset-2
550 - name: x86_64-mingw-1
552 SCRIPT: make ci-mingw-subset-1
553 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
556 NO_DEBUG_ASSERTIONS: 1
557 NO_LLVM_ASSERTIONS: 1
560 - name: x86_64-mingw-2
562 SCRIPT: make ci-mingw-subset-2
563 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
567 - name: dist-x86_64-msvc
569 RUST_CONFIGURE_ARGS: >-
570 --build=x86_64-pc-windows-msvc
571 --target=x86_64-pc-windows-msvc,aarch64-pc-windows-msvc
574 SCRIPT: python x.py dist
575 DIST_REQUIRE_ALL_TOOLS: 1
578 - name: dist-i686-msvc
580 RUST_CONFIGURE_ARGS: >-
581 --build=i686-pc-windows-msvc
582 --target=i586-pc-windows-msvc
585 SCRIPT: python x.py dist
586 DIST_REQUIRE_ALL_TOOLS: 1
589 - name: dist-i686-mingw
591 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools --enable-profiler
592 SCRIPT: python x.py dist
594 DIST_REQUIRE_ALL_TOOLS: 1
597 - name: dist-x86_64-mingw
599 SCRIPT: python x.py dist
600 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler
602 DIST_REQUIRE_ALL_TOOLS: 1
605 - name: dist-x86_64-msvc-alt
607 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
608 SCRIPT: python x.py dist
613 runs-on: ubuntu-latest
615 <<: [*prod-variables]
616 if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'
618 - name: checkout the source code
619 uses: actions/checkout@v1
623 - name: publish toolstate
624 run: src/ci/publish_toolstate.sh
626 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
629 # These jobs don't actually test anything, but they're used to tell bors the
630 # build completed, as there is no practical way to detect when a workflow is
631 # successful listening to webhooks only.
634 if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'"
635 <<: *base-success-job
638 if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'"
639 <<: *base-failure-job
642 if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
643 <<: *base-success-job
646 if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
647 <<: *base-failure-job