-
Notifications
You must be signed in to change notification settings - Fork 12.9k
/
ci.yml
649 lines (537 loc) · 20.5 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
######################################################
# WARNING! Action needed when changing this file #
######################################################
# Due to GitHub Actions limitations, we can't use YAML Anchors directly in the
# CI configuration stored on the repository. To work around that this file is
# expanded by a tool in the repository, and the expansion is committed as well.
#
# After you make any change to the file you'll need to run this command:
#
# ./x.py run src/tools/expand-yaml-anchors
#
# ...and commit the file it updated in addition to this one. If you forget this
# step CI will fail.
---
###############################
# YAML Anchors Definition #
###############################
# This key contains most of the YAML anchors that will be used later in the
# document. YAML anchors allows us to greatly reduce duplication inside the CI
# configuration by reusing parts of the configuration.
#
# YAML anchors work by defining an anchor with `&anchor-name` and reusing its
# content in another place with `*anchor-name`. The special `<<` map key merges
# the content of the map with the content of the anchor (or list of anchors).
#
# The expand-yaml-anchors tool will automatically remove this block from the
# output YAML file.
x--expand-yaml-anchors--remove:
- &shared-ci-variables
CI_JOB_NAME: ${{ matrix.name }}
- &public-variables
SCCACHE_BUCKET: rust-lang-gha-caches
TOOLSTATE_REPO: https://github.com/pietroalbini/rust-toolstate
CACHE_DOMAIN: ci-caches-gha.rust-lang.org
- &prod-variables
SCCACHE_BUCKET: rust-lang-gha-caches
DEPLOY_BUCKET: rust-lang-gha
TOOLSTATE_REPO: https://github.com/pietroalbini/rust-toolstate
TOOLSTATE_ISSUES_API_URL: https://api.github.com/repos/pietroalbini/rust-toolstate/issues
TOOLSTATE_PUBLISH: 1
# AWS_SECRET_ACCESS_KEYs are stored in GitHub's secrets storage, named
# AWS_SECRET_ACCESS_KEY_<keyid>. Including the key id in the name allows to
# rotate them in a single branch while keeping the old key in another
# branch, which wouldn't be possible if the key was named with the kind
# (caches, artifacts...).
CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZOMUQATD5
ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZH5AYXDVF
CACHE_DOMAIN: ci-caches-gha.rust-lang.org
- &base-job
env: {}
- &job-linux-xl
os: ubuntu-latest-xl
<<: *base-job
- &job-macos-xl
os: macos-latest # We don't have an XL builder for this
<<: *base-job
- &job-windows-xl
os: windows-latest-xl
<<: *base-job
- &step
if: success() && !env.SKIP_JOB
- &base-ci-job
timeout-minutes: 600
runs-on: "${{ matrix.os }}"
env: *shared-ci-variables
steps:
- name: disable git crlf conversion
run: git config --global core.autocrlf false
shell: bash
- name: checkout the source code
uses: actions/checkout@v1
with:
fetch-depth: 2
- name: configure GitHub Actions to kill the build when outdated
uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
github_token: "${{ secrets.github_token }}"
if: success() && !env.SKIP_JOB && github.ref != 'refs/heads/try'
<<: *step
- name: add extra environment variables
run: src/ci/scripts/setup-environment.sh
env:
# Since it's not possible to merge `${{ matrix.env }}` with the other
# variables in `job.<name>.env`, the variables defined in the matrix
# are passed to the `setup-environment.sh` script encoded in JSON,
# which then uses log commands to actually set them.
EXTRA_VARIABLES: ${{ toJson(matrix.env) }}
<<: *step
- name: decide whether to skip this job
run: src/ci/scripts/should-skip-this.sh
<<: *step
- name: collect CPU statistics
run: src/ci/scripts/collect-cpu-stats.sh
<<: *step
- name: show the current environment
run: src/ci/scripts/dump-environment.sh
<<: *step
- name: install awscli
run: src/ci/scripts/install-awscli.sh
<<: *step
- name: install sccache
run: src/ci/scripts/install-sccache.sh
<<: *step
- name: install clang
run: src/ci/scripts/install-clang.sh
<<: *step
- name: install WIX
run: src/ci/scripts/install-wix.sh
<<: *step
- name: install InnoSetup
run: src/ci/scripts/install-innosetup.sh
<<: *step
- name: ensure the build happens on a partition with enough space
run: src/ci/scripts/symlink-build-dir.sh
<<: *step
- name: disable git crlf conversion
run: src/ci/scripts/disable-git-crlf-conversion.sh
<<: *step
- name: install MSYS2
run: src/ci/scripts/install-msys2.sh
<<: *step
- name: install MSYS2 packages
run: src/ci/scripts/install-msys2-packages.sh
<<: *step
- name: install MinGW
run: src/ci/scripts/install-mingw.sh
<<: *step
- name: install ninja
run: src/ci/scripts/install-ninja.sh
<<: *step
- name: enable ipv6 on Docker
run: src/ci/scripts/enable-docker-ipv6.sh
<<: *step
# Disable automatic line ending conversion (again). On Windows, when we're
# installing dependencies, something switches the git configuration directory or
# re-enables autocrlf. We've not tracked down the exact cause -- and there may
# be multiple -- but this should ensure submodules are checked out with the
# appropriate line endings.
- name: disable git crlf conversion
run: src/ci/scripts/disable-git-crlf-conversion.sh
<<: *step
- name: checkout submodules
run: src/ci/scripts/checkout-submodules.sh
<<: *step
- name: ensure line endings are correct
run: src/ci/scripts/verify-line-endings.sh
<<: *step
- name: run the build
run: src/ci/scripts/run-build-from-ci.sh
env:
AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}
TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
<<: *step
- name: upload artifacts to S3
run: src/ci/scripts/upload-artifacts.sh
env:
AWS_ACCESS_KEY_ID: ${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}
# Adding a condition on DEPLOY=1 or DEPLOY_ALT=1 is not needed as all deploy
# builders *should* have the AWS credentials available. Still, explicitly
# adding the condition is helpful as this way CI will not silently skip
# deploying artifacts from a dist builder if the variables are misconfigured,
# erroring about invalid credentials instead.
if: success() && !env.SKIP_JOB && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')
<<: *step
# These snippets are used by the try-success, try-failure, auto-success and auto-failure jobs.
# Check out their documentation for more information on why they're needed.
- &base-outcome-job
name: bors build finished
runs-on: ubuntu-latest
- &base-success-job
steps:
- name: mark the job as a success
run: exit 0
shell: bash
<<: *base-outcome-job
- &base-failure-job
steps:
- name: mark the job as a failure
run: exit 1
shell: bash
<<: *base-outcome-job
###########################
# Builders definition #
###########################
name: CI
on:
push:
branches:
- auto
- try
- master
pull_request:
branches:
- "**"
defaults:
run:
# While on Linux and macOS builders it just forwards the arguments to the
# system bash, this wrapper allows switching from the host's bash.exe to
# the one we install along with MSYS2 mid-build on Windows.
#
# Once the step to install MSYS2 is executed, the CI_OVERRIDE_SHELL
# environment variable is set pointing to our MSYS2's bash.exe. From that
# moment the host's bash.exe will not be called anymore.
#
# This is needed because we can't launch our own bash.exe from the host
# bash.exe, as that would load two different cygwin1.dll in memory, causing
# "cygwin heap mismatch" errors.
shell: python src/ci/exec-with-shell.py {0}
jobs:
pr:
<<: *base-ci-job
name: PR
env:
<<: [*shared-ci-variables, *public-variables]
if: github.event_name == 'pull_request'
strategy:
matrix:
include:
- name: mingw-check
<<: *job-linux-xl
- name: x86_64-gnu-llvm-8
<<: *job-linux-xl
- name: x86_64-gnu-tools
env:
CI_ONLY_WHEN_SUBMODULES_CHANGED: 1
<<: *job-linux-xl
try:
<<: *base-ci-job
name: try
env:
<<: [*shared-ci-variables, *prod-variables]
if: github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'
strategy:
matrix:
include:
- name: dist-x86_64-linux
<<: *job-linux-xl
- name: dist-x86_64-linux-alt
env:
IMAGE: dist-x86_64-linux
<<: *job-linux-xl
auto:
<<: *base-ci-job
name: auto
env:
<<: [*shared-ci-variables, *prod-variables]
if: github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'
strategy:
matrix:
include:
#############################
# Linux/Docker builders #
#############################
- name: arm-android
<<: *job-linux-xl
- name: armhf-gnu
<<: *job-linux-xl
- name: dist-aarch64-linux
<<: *job-linux-xl
- name: dist-android
<<: *job-linux-xl
- name: dist-arm-linux
<<: *job-linux-xl
- name: dist-armhf-linux
<<: *job-linux-xl
- name: dist-armv7-linux
<<: *job-linux-xl
- name: dist-i586-gnu-i586-i686-musl
<<: *job-linux-xl
- name: dist-i686-freebsd
<<: *job-linux-xl
- name: dist-i686-linux
<<: *job-linux-xl
- name: dist-mips-linux
<<: *job-linux-xl
- name: dist-mips64-linux
<<: *job-linux-xl
- name: dist-mips64el-linux
<<: *job-linux-xl
- name: dist-mipsel-linux
<<: *job-linux-xl
- name: dist-powerpc-linux
<<: *job-linux-xl
- name: dist-powerpc64-linux
<<: *job-linux-xl
- name: dist-powerpc64le-linux
<<: *job-linux-xl
- name: dist-s390x-linux
<<: *job-linux-xl
- name: dist-various-1
<<: *job-linux-xl
- name: dist-various-2
<<: *job-linux-xl
- name: dist-x86_64-freebsd
<<: *job-linux-xl
- name: dist-x86_64-linux
<<: *job-linux-xl
- name: dist-x86_64-linux-alt
env:
IMAGE: dist-x86_64-linux
<<: *job-linux-xl
- name: dist-x86_64-musl
<<: *job-linux-xl
- name: dist-x86_64-netbsd
<<: *job-linux-xl
- name: i686-gnu
<<: *job-linux-xl
- name: i686-gnu-nopt
<<: *job-linux-xl
- name: mingw-check
<<: *job-linux-xl
- name: test-various
<<: *job-linux-xl
- name: wasm32
<<: *job-linux-xl
- name: x86_64-gnu
<<: *job-linux-xl
- name: x86_64-gnu-aux
<<: *job-linux-xl
- name: x86_64-gnu-debug
<<: *job-linux-xl
- name: x86_64-gnu-distcheck
<<: *job-linux-xl
- name: x86_64-gnu-full-bootstrap
<<: *job-linux-xl
- name: x86_64-gnu-llvm-8
env:
RUST_BACKTRACE: 1
<<: *job-linux-xl
- name: x86_64-gnu-nopt
<<: *job-linux-xl
- name: x86_64-gnu-tools
env:
DEPLOY_TOOLSTATES_JSON: toolstates-linux.json
<<: *job-linux-xl
####################
# macOS Builders #
####################
- name: dist-x86_64-apple
env:
SCRIPT: ./x.py dist
RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.7
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
DIST_REQUIRE_ALL_TOOLS: 1
<<: *job-macos-xl
- name: dist-x86_64-apple-alt
env:
SCRIPT: ./x.py dist
RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.7
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
<<: *job-macos-xl
- name: x86_64-apple
env:
SCRIPT: ./x.py test
RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
MACOSX_DEPLOYMENT_TARGET: 10.8
MACOSX_STD_DEPLOYMENT_TARGET: 10.7
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
<<: *job-macos-xl
######################
# Windows Builders #
######################
- name: x86_64-msvc-1
env:
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
SCRIPT: make ci-subset-1
# FIXME(#59637)
NO_DEBUG_ASSERTIONS: 1
NO_LLVM_ASSERTIONS: 1
<<: *job-windows-xl
- name: x86_64-msvc-2
env:
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
SCRIPT: make ci-subset-2
<<: *job-windows-xl
- name: i686-msvc-1
env:
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
SCRIPT: make ci-subset-1
# FIXME(#59637)
NO_DEBUG_ASSERTIONS: 1
NO_LLVM_ASSERTIONS: 1
<<: *job-windows-xl
- name: i686-msvc-2
env:
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
SCRIPT: make ci-subset-2
# FIXME(#59637)
NO_DEBUG_ASSERTIONS: 1
NO_LLVM_ASSERTIONS: 1
<<: *job-windows-xl
- name: x86_64-msvc-aux
env:
RUST_CHECK_TARGET: check-aux EXCLUDE_CARGO=1
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
<<: *job-windows-xl
- name: x86_64-msvc-cargo
env:
SCRIPT: python x.py test src/tools/cargotest src/tools/cargo
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
VCVARS_BAT: vcvars64.bat
# FIXME(#59637)
NO_DEBUG_ASSERTIONS: 1
NO_LLVM_ASSERTIONS: 1
<<: *job-windows-xl
- name: x86_64-msvc-tools
env:
SCRIPT: src/ci/docker/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstate/toolstates.json
<<: *job-windows-xl
# 32/64-bit MinGW builds.
#
# We are using MinGW with posix threads since LLVM does not compile with
# the win32 threads version due to missing support for C++'s std::thread.
#
# Instead of relying on the MinGW version installed on appveryor we download
# and install one ourselves so we won't be surprised by changes to appveyor's
# build image.
#
# Finally, note that the downloads below are all in the `rust-lang-ci` S3
# bucket, but they cleraly didn't originate there! The downloads originally
# came from the mingw-w64 SourceForge download site. Unfortunately
# SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
- name: i686-mingw-1
env:
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
SCRIPT: make ci-mingw-subset-1
CUSTOM_MINGW: 1
# FIXME(#59637)
NO_DEBUG_ASSERTIONS: 1
NO_LLVM_ASSERTIONS: 1
<<: *job-windows-xl
- name: i686-mingw-2
env:
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
SCRIPT: make ci-mingw-subset-2
CUSTOM_MINGW: 1
<<: *job-windows-xl
- name: x86_64-mingw-1
env:
SCRIPT: make ci-mingw-subset-1
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
CUSTOM_MINGW: 1
# FIXME(#59637)
NO_DEBUG_ASSERTIONS: 1
NO_LLVM_ASSERTIONS: 1
<<: *job-windows-xl
- name: x86_64-mingw-2
env:
SCRIPT: make ci-mingw-subset-2
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
CUSTOM_MINGW: 1
<<: *job-windows-xl
- name: dist-x86_64-msvc
env:
RUST_CONFIGURE_ARGS: >-
--build=x86_64-pc-windows-msvc
--target=x86_64-pc-windows-msvc,aarch64-pc-windows-msvc
--enable-full-tools
--enable-profiler
SCRIPT: python x.py dist
DIST_REQUIRE_ALL_TOOLS: 1
<<: *job-windows-xl
- name: dist-i686-msvc
env:
RUST_CONFIGURE_ARGS: >-
--build=i686-pc-windows-msvc
--target=i586-pc-windows-msvc
--enable-full-tools
--enable-profiler
SCRIPT: python x.py dist
DIST_REQUIRE_ALL_TOOLS: 1
<<: *job-windows-xl
- name: dist-i686-mingw
env:
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools --enable-profiler
SCRIPT: python x.py dist
CUSTOM_MINGW: 1
DIST_REQUIRE_ALL_TOOLS: 1
<<: *job-windows-xl
- name: dist-x86_64-mingw
env:
SCRIPT: python x.py dist
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler
CUSTOM_MINGW: 1
DIST_REQUIRE_ALL_TOOLS: 1
<<: *job-windows-xl
- name: dist-x86_64-msvc-alt
env:
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
SCRIPT: python x.py dist
<<: *job-windows-xl
master:
name: master
runs-on: ubuntu-latest
env:
<<: [*prod-variables]
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'
steps:
- name: checkout the source code
uses: actions/checkout@v1
with:
fetch-depth: 2
- name: publish toolstate
run: src/ci/publish_toolstate.sh
env:
TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
<<: *step
# These jobs don't actually test anything, but they're used to tell bors the
# build completed, as there is no practical way to detect when a workflow is
# successful listening to webhooks only.
try-success:
needs: [try]
if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'"
<<: *base-success-job
try-failure:
needs: [try]
if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/try' && github.repository == 'rust-lang-ci/rust'"
<<: *base-failure-job
auto-success:
needs: [auto]
if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
<<: *base-success-job
auto-failure:
needs: [auto]
if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
<<: *base-failure-job