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 # Rust Log Analyzer can't currently detect the PR number of a GitHub
96 # Actions build on its own, so a hint in the log message is needed to
97 # point it in the right direction.
98 - name: configure the PR in which the error message will be posted
99 run: echo "[CI_PR_NUMBER=$num]"
101 num: ${{ github.event.number }}
102 if: success() && !env.SKIP_JOBS && github.event_name == 'pull_request'
104 - name: add extra environment variables
105 run: src/ci/scripts/setup-environment.sh
107 # Since it's not possible to merge `${{ matrix.env }}` with the other
108 # variables in `job.<name>.env`, the variables defined in the matrix
109 # are passed to the `setup-environment.sh` script encoded in JSON,
110 # which then uses log commands to actually set them.
111 EXTRA_VARIABLES: ${{ toJson(matrix.env) }}
114 - name: decide whether to skip this job
115 run: src/ci/scripts/should-skip-this.sh
118 - name: collect CPU statistics
119 run: src/ci/scripts/collect-cpu-stats.sh
122 - name: show the current environment
123 run: src/ci/scripts/dump-environment.sh
126 - name: install awscli
127 run: src/ci/scripts/install-awscli.sh
130 - name: install sccache
131 run: src/ci/scripts/install-sccache.sh
134 - name: install clang
135 run: src/ci/scripts/install-clang.sh
139 run: src/ci/scripts/install-wix.sh
142 - name: ensure the build happens on a partition with enough space
143 run: src/ci/scripts/symlink-build-dir.sh
146 - name: disable git crlf conversion
147 run: src/ci/scripts/disable-git-crlf-conversion.sh
150 - name: install MSYS2
151 run: src/ci/scripts/install-msys2.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 # On Linux, macOS, and Windows, use the system-provided bash as the default
243 # shell. (This should only make a difference on Windows, where the default
244 # shell is PowerShell.)
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-riscv64-linux
347 - name: dist-s390x-linux
350 - name: dist-various-1
353 - name: dist-various-2
356 - name: dist-x86_64-freebsd
359 - name: dist-x86_64-illumos
362 - name: dist-x86_64-linux
365 - name: dist-x86_64-linux-alt
367 IMAGE: dist-x86_64-linux
370 - name: dist-x86_64-musl
373 - name: dist-x86_64-netbsd
379 - name: i686-gnu-nopt
394 - name: x86_64-gnu-aux
397 - name: x86_64-gnu-debug
400 - name: x86_64-gnu-distcheck
403 - name: x86_64-gnu-full-bootstrap
406 - name: x86_64-gnu-llvm-8
411 - name: x86_64-gnu-nopt
414 - name: x86_64-gnu-tools
416 DEPLOY_TOOLSTATES_JSON: toolstates-linux.json
419 ######################
421 ######################
423 - name: x86_64-msvc-1
425 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
426 SCRIPT: make ci-subset-1
428 NO_DEBUG_ASSERTIONS: 1
429 NO_LLVM_ASSERTIONS: 1
432 - name: x86_64-msvc-2
434 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
435 SCRIPT: make ci-subset-2
440 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
441 SCRIPT: make ci-subset-1
443 NO_DEBUG_ASSERTIONS: 1
444 NO_LLVM_ASSERTIONS: 1
449 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
450 SCRIPT: make ci-subset-2
452 NO_DEBUG_ASSERTIONS: 1
453 NO_LLVM_ASSERTIONS: 1
456 - name: x86_64-msvc-cargo
458 SCRIPT: python x.py test src/tools/cargotest src/tools/cargo
459 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld
460 VCVARS_BAT: vcvars64.bat
462 NO_DEBUG_ASSERTIONS: 1
463 NO_LLVM_ASSERTIONS: 1
466 - name: x86_64-msvc-tools
468 SCRIPT: src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows
469 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstate/toolstates.json
472 # 32/64-bit MinGW builds.
474 # We are using MinGW with posix threads since LLVM does not compile with
475 # the win32 threads version due to missing support for C++'s std::thread.
477 # Instead of relying on the MinGW version installed on appveryor we download
478 # and install one ourselves so we won't be surprised by changes to appveyor's
481 # Finally, note that the downloads below are all in the `rust-lang-ci` S3
482 # bucket, but they cleraly didn't originate there! The downloads originally
483 # came from the mingw-w64 SourceForge download site. Unfortunately
484 # SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
488 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
489 SCRIPT: make ci-mingw-subset-1
492 NO_DEBUG_ASSERTIONS: 1
493 NO_LLVM_ASSERTIONS: 1
498 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
499 SCRIPT: make ci-mingw-subset-2
503 - name: x86_64-mingw-1
505 SCRIPT: make ci-mingw-subset-1
506 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
509 NO_DEBUG_ASSERTIONS: 1
510 NO_LLVM_ASSERTIONS: 1
513 - name: x86_64-mingw-2
515 SCRIPT: make ci-mingw-subset-2
516 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
520 - name: dist-x86_64-msvc
522 RUST_CONFIGURE_ARGS: >-
523 --build=x86_64-pc-windows-msvc
524 --target=x86_64-pc-windows-msvc,aarch64-pc-windows-msvc
527 SCRIPT: python x.py dist
528 DIST_REQUIRE_ALL_TOOLS: 1
531 - name: dist-i686-msvc
533 RUST_CONFIGURE_ARGS: >-
534 --build=i686-pc-windows-msvc
535 --target=i586-pc-windows-msvc
538 SCRIPT: python x.py dist
539 DIST_REQUIRE_ALL_TOOLS: 1
542 - name: dist-i686-mingw
544 RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools --enable-profiler
545 SCRIPT: python x.py dist
547 DIST_REQUIRE_ALL_TOOLS: 1
550 - name: dist-x86_64-mingw
552 SCRIPT: python x.py dist
553 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler
555 DIST_REQUIRE_ALL_TOOLS: 1
558 - name: dist-x86_64-msvc-alt
560 RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
561 SCRIPT: python x.py dist
568 <<: [*shared-ci-variables, *prod-variables]
569 if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
577 - name: dist-x86_64-apple
580 RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc
581 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
582 MACOSX_DEPLOYMENT_TARGET: 10.7
583 NO_LLVM_ASSERTIONS: 1
584 NO_DEBUG_ASSERTIONS: 1
585 DIST_REQUIRE_ALL_TOOLS: 1
588 - name: dist-x86_64-apple-alt
591 RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc
592 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
593 MACOSX_DEPLOYMENT_TARGET: 10.7
594 NO_LLVM_ASSERTIONS: 1
595 NO_DEBUG_ASSERTIONS: 1
601 RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc
602 RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
603 MACOSX_DEPLOYMENT_TARGET: 10.8
604 MACOSX_STD_DEPLOYMENT_TARGET: 10.7
605 NO_LLVM_ASSERTIONS: 1
606 NO_DEBUG_ASSERTIONS: 1
611 runs-on: ubuntu-latest
613 <<: [*prod-variables]
614 if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'
616 - name: checkout the source code
617 uses: actions/checkout@v1
621 - name: publish toolstate
622 run: src/ci/publish_toolstate.sh
625 TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
628 # These jobs don't actually test anything, but they're used to tell bors the
629 # build completed, as there is no practical way to detect when a workflow is
630 # successful listening to webhooks only.
633 if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'"
634 <<: *base-success-job
637 if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'"
638 <<: *base-failure-job
641 if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
642 <<: *base-success-job
645 if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
646 <<: *base-failure-job