Skip to content

Commit 744dc2a

Browse files
committed
Inline base-ci-job YAML anchor and remove unused anchors
1 parent 144bdf5 commit 744dc2a

File tree

2 files changed

+102
-184
lines changed

2 files changed

+102
-184
lines changed

.github/workflows/ci.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ jobs:
5151
name: "${{ matrix.name }}"
5252
needs:
5353
- calculate_matrix
54+
runs-on: "${{ matrix.os }}"
55+
defaults:
56+
run:
57+
shell: "${{ contains(matrix.os, 'windows') && 'msys2 {0}' || 'bash' }}"
58+
timeout-minutes: 600
5459
env:
5560
CI_JOB_NAME: "${{ matrix.image }}"
5661
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
@@ -64,11 +69,6 @@ jobs:
6469
matrix:
6570
include: "${{ fromJSON(needs.calculate_matrix.outputs.jobs) }}"
6671
if: "fromJSON(needs.calculate_matrix.outputs.jobs)[0] != null"
67-
defaults:
68-
run:
69-
shell: "${{ contains(matrix.os, 'windows') && 'msys2 {0}' || 'bash' }}"
70-
timeout-minutes: 600
71-
runs-on: "${{ matrix.os }}"
7272
steps:
7373
- if: "contains(matrix.os, 'windows')"
7474
uses: msys2/[email protected]

src/ci/github-actions/ci.yml

+97-179
Original file line numberDiff line numberDiff line change
@@ -29,91 +29,107 @@
2929
# The expand-yaml-anchors tool will automatically remove this block from the
3030
# output YAML file.
3131
x--expand-yaml-anchors--remove:
32-
- &shared-ci-variables
33-
CI_JOB_NAME: ${{ matrix.name }}
34-
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
35-
# commit of PR sha or commit sha. `GITHUB_SHA` is not accurate for PRs.
36-
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
37-
DOCKER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38-
39-
- &public-variables
40-
SCCACHE_BUCKET: rust-lang-ci-sccache2
41-
TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
42-
CACHE_DOMAIN: ci-caches.rust-lang.org
43-
44-
- &prod-variables
45-
SCCACHE_BUCKET: rust-lang-ci-sccache2
46-
DEPLOY_BUCKET: rust-lang-ci2
47-
TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
48-
TOOLSTATE_ISSUES_API_URL: https://api.github.com/repos/rust-lang/rust/issues
49-
TOOLSTATE_PUBLISH: 1
50-
# AWS_SECRET_ACCESS_KEYs are stored in GitHub's secrets storage, named
51-
# AWS_SECRET_ACCESS_KEY_<keyid>. Including the key id in the name allows to
52-
# rotate them in a single branch while keeping the old key in another
53-
# branch, which wouldn't be possible if the key was named with the kind
54-
# (caches, artifacts...).
55-
CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZI5DHEBFL
56-
ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZN24CBO55
57-
AWS_REGION: us-west-1
58-
CACHE_DOMAIN: ci-caches.rust-lang.org
59-
60-
- &dummy-variables
61-
SCCACHE_BUCKET: rust-lang-gha-caches
62-
DEPLOY_BUCKET: rust-lang-gha
63-
TOOLSTATE_REPO: https://github.com/pietroalbini/rust-toolstate
64-
TOOLSTATE_ISSUES_API_URL: https://api.github.com/repos/pietroalbini/rust-toolstate/issues
65-
TOOLSTATE_PUBLISH: 1
66-
# AWS_SECRET_ACCESS_KEYs are stored in GitHub's secrets storage, named
67-
# AWS_SECRET_ACCESS_KEY_<keyid>. Including the key id in the name allows to
68-
# rotate them in a single branch while keeping the old key in another
69-
# branch, which wouldn't be possible if the key was named with the kind
70-
# (caches, artifacts...).
71-
CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZOMUQATD5
72-
ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZH5AYXDVF
73-
AWS_REGION: us-west-1
74-
CACHE_DOMAIN: ci-caches-gha.rust-lang.org
75-
76-
- &base-job
77-
env: {}
78-
79-
- &job-linux-4c
80-
os: ubuntu-20.04-4core-16gb
81-
<<: *base-job
82-
83-
- &job-linux-8c
84-
os: ubuntu-20.04-8core-32gb
85-
<<: *base-job
86-
87-
- &job-linux-16c
88-
os: ubuntu-20.04-16core-64gb
89-
<<: *base-job
90-
91-
- &job-macos-xl
92-
os: macos-13 # We use the standard runner for now
93-
<<: *base-job
94-
95-
- &job-macos-m1
96-
os: macos-14
97-
<<: *base-job
98-
99-
- &job-windows-8c
100-
os: windows-2019-8core-32gb
101-
<<: *base-job
102-
103-
- &job-windows-16c
104-
os: windows-2019-16core-64gb
105-
<<: *base-job
106-
107-
- &job-aarch64-linux
108-
os: [self-hosted, ARM64, linux]
109-
110-
- &base-ci-job
32+
# These snippets are used by the try-success, try-failure, auto-success and auto-failure jobs.
33+
# Check out their documentation for more information on why they're needed.
34+
35+
- &base-outcome-job
36+
name: bors build finished
37+
runs-on: ubuntu-latest
38+
39+
- &base-success-job
40+
steps:
41+
- name: mark the job as a success
42+
run: exit 0
43+
shell: bash
44+
<<: *base-outcome-job
45+
46+
- &base-failure-job
47+
steps:
48+
- name: mark the job as a failure
49+
run: exit 1
50+
shell: bash
51+
<<: *base-outcome-job
52+
53+
###########################
54+
# Builders definition #
55+
###########################
56+
57+
name: CI
58+
on:
59+
push:
60+
branches:
61+
- auto
62+
- try
63+
- try-perf
64+
- automation/bors/try
65+
- master
66+
pull_request:
67+
branches:
68+
- "**"
69+
70+
permissions:
71+
contents: read
72+
packages: write
73+
74+
defaults:
75+
run:
76+
# On Linux, macOS, and Windows, use the system-provided bash as the default
77+
# shell. (This should only make a difference on Windows, where the default
78+
# shell is PowerShell.)
79+
shell: bash
80+
81+
concurrency:
82+
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch.
83+
# We add an exception for try builds (try branch) and unrolled rollup builds (try-perf), which
84+
# are all triggered on the same branch, but which should be able to run concurrently.
85+
group: ${{ github.workflow }}-${{ ((github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.sha) || github.ref }}
86+
cancel-in-progress: true
87+
88+
jobs:
89+
# The job matrix for `calculate_matrix` is defined in src/ci/github-actions/jobs.yml.
90+
# It calculates which jobs should be executed, based on the data of the ${{ github }} context.
91+
# If you want to modify CI jobs, take a look at src/ci/github-actions/jobs.yml.
92+
calculate_matrix:
93+
name: Calculate job matrix
94+
runs-on: ubuntu-latest
95+
outputs:
96+
jobs: ${{ steps.jobs.outputs.jobs }}
97+
steps:
98+
- name: Checkout the source code
99+
uses: actions/checkout@v4
100+
- name: Calculate the CI job matrix
101+
run: python3 src/ci/github-actions/calculate-job-matrix.py >> $GITHUB_OUTPUT
102+
id: jobs
103+
job:
104+
name: ${{ matrix.name }}
105+
needs: [ calculate_matrix ]
106+
runs-on: "${{ matrix.os }}"
111107
defaults:
112108
run:
113109
shell: ${{ contains(matrix.os, 'windows') && 'msys2 {0}' || 'bash' }}
114110
timeout-minutes: 600
115-
runs-on: "${{ matrix.os }}"
116-
env: *shared-ci-variables
111+
env:
112+
CI_JOB_NAME: ${{ matrix.image }}
113+
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
114+
# commit of PR sha or commit sha. `GITHUB_SHA` is not accurate for PRs.
115+
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
116+
DOCKER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117+
SCCACHE_BUCKET: rust-lang-ci-sccache2
118+
TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
119+
CACHE_DOMAIN: ci-caches.rust-lang.org
120+
continue-on-error: ${{ matrix.continue_on_error || false }}
121+
strategy:
122+
matrix:
123+
# Check the `calculate_matrix` job to see how is the matrix defined.
124+
include: ${{ fromJSON(needs.calculate_matrix.outputs.jobs) }}
125+
# GitHub Actions fails the workflow if an empty list of jobs is provided to
126+
# the workflow, so we need to skip this job if nothing was produced by
127+
# the Python script.
128+
#
129+
# Unfortunately checking whether a list is empty is not possible in a nice
130+
# way due to GitHub Actions expressions limits.
131+
# This hack is taken from https://github.com/ferrocene/ferrocene/blob/d43edc6b7697cf1719ec1c17c54904ab94825763/.github/workflows/release.yml#L75-L82
132+
if: fromJSON(needs.calculate_matrix.outputs.jobs)[0] != null
117133
steps:
118134
- if: contains(matrix.os, 'windows')
119135
uses: msys2/[email protected]
@@ -253,104 +269,6 @@ x--expand-yaml-anchors--remove:
253269
# erroring about invalid credentials instead.
254270
if: success() && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')
255271

256-
# These snippets are used by the try-success, try-failure, auto-success and auto-failure jobs.
257-
# Check out their documentation for more information on why they're needed.
258-
259-
- &base-outcome-job
260-
name: bors build finished
261-
runs-on: ubuntu-latest
262-
263-
- &base-success-job
264-
steps:
265-
- name: mark the job as a success
266-
run: exit 0
267-
shell: bash
268-
<<: *base-outcome-job
269-
270-
- &base-failure-job
271-
steps:
272-
- name: mark the job as a failure
273-
run: exit 1
274-
shell: bash
275-
<<: *base-outcome-job
276-
277-
###########################
278-
# Builders definition #
279-
###########################
280-
281-
name: CI
282-
on:
283-
push:
284-
branches:
285-
- auto
286-
- try
287-
- try-perf
288-
- automation/bors/try
289-
- master
290-
pull_request:
291-
branches:
292-
- "**"
293-
294-
permissions:
295-
contents: read
296-
packages: write
297-
298-
defaults:
299-
run:
300-
# On Linux, macOS, and Windows, use the system-provided bash as the default
301-
# shell. (This should only make a difference on Windows, where the default
302-
# shell is PowerShell.)
303-
shell: bash
304-
305-
concurrency:
306-
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch.
307-
# We add an exception for try builds (try branch) and unrolled rollup builds (try-perf), which
308-
# are all triggered on the same branch, but which should be able to run concurrently.
309-
group: ${{ github.workflow }}-${{ ((github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.sha) || github.ref }}
310-
cancel-in-progress: true
311-
312-
jobs:
313-
# The job matrix for `calculate_matrix` is defined in src/ci/github-actions/jobs.yml.
314-
# It calculates which jobs should be executed, based on the data of the ${{ github }} context.
315-
# If you want to modify CI jobs, take a look at src/ci/github-actions/jobs.yml.
316-
calculate_matrix:
317-
name: Calculate job matrix
318-
runs-on: ubuntu-latest
319-
outputs:
320-
jobs: ${{ steps.jobs.outputs.jobs }}
321-
steps:
322-
- name: Checkout the source code
323-
uses: actions/checkout@v4
324-
- name: Calculate the CI job matrix
325-
run: python3 src/ci/github-actions/calculate-job-matrix.py >> $GITHUB_OUTPUT
326-
id: jobs
327-
job:
328-
<<: *base-ci-job
329-
name: ${{ matrix.name }}
330-
needs: [ calculate_matrix ]
331-
env:
332-
CI_JOB_NAME: ${{ matrix.image }}
333-
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
334-
# commit of PR sha or commit sha. `GITHUB_SHA` is not accurate for PRs.
335-
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
336-
DOCKER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
337-
SCCACHE_BUCKET: rust-lang-ci-sccache2
338-
TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
339-
CACHE_DOMAIN: ci-caches.rust-lang.org
340-
continue-on-error: ${{ matrix.continue_on_error || false }}
341-
strategy:
342-
matrix:
343-
# Check the `calculate_matrix` job to see how is the matrix defined.
344-
include: ${{ fromJSON(needs.calculate_matrix.outputs.jobs) }}
345-
# GitHub Actions fails the workflow if an empty list of jobs is provided to
346-
# the workflow, so we need to skip this job if nothing was produced by
347-
# the Python script.
348-
#
349-
# Unfortunately checking whether a list is empty is not possible in a nice
350-
# way due to GitHub Actions expressions limits.
351-
# This hack is taken from https://github.com/ferrocene/ferrocene/blob/d43edc6b7697cf1719ec1c17c54904ab94825763/.github/workflows/release.yml#L75-L82
352-
if: fromJSON(needs.calculate_matrix.outputs.jobs)[0] != null
353-
354272
# These jobs don't actually test anything, but they're used to tell bors the
355273
# build completed, as there is no practical way to detect when a workflow is
356274
# successful listening to webhooks only.

0 commit comments

Comments
 (0)