Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e27af29

Browse files
committedApr 29, 2024
Auto merge of #124332 - Kobzol:toolstate-auto-build, r=pietroalbini
CI: remove `master` job It only had one job (pun intended), to publish the toolstate. We could probably do that at the end of `auto` builds instead, which is what is done in this PR. r? `@pietroalbini`
2 parents 7a58674 + a700897 commit e27af29

File tree

2 files changed

+125
-231
lines changed

2 files changed

+125
-231
lines changed
 

‎.github/workflows/ci.yml

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ name: CI
2222
- try
2323
- try-perf
2424
- automation/bors/try
25-
- master
2625
pull_request:
2726
branches:
2827
- "**"
@@ -35,6 +34,8 @@ defaults:
3534
concurrency:
3635
group: "${{ github.workflow }}-${{ ((github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.sha) || github.ref }}"
3736
cancel-in-progress: true
37+
env:
38+
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"
3839
jobs:
3940
calculate_matrix:
4041
name: Calculate job matrix
@@ -51,24 +52,23 @@ jobs:
5152
name: "${{ matrix.name }}"
5253
needs:
5354
- calculate_matrix
55+
runs-on: "${{ matrix.os }}"
56+
defaults:
57+
run:
58+
shell: "${{ contains(matrix.os, 'windows') && 'msys2 {0}' || 'bash' }}"
59+
timeout-minutes: 600
5460
env:
5561
CI_JOB_NAME: "${{ matrix.image }}"
5662
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
5763
HEAD_SHA: "${{ github.event.pull_request.head.sha || github.sha }}"
5864
DOCKER_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
5965
SCCACHE_BUCKET: rust-lang-ci-sccache2
60-
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"
6166
CACHE_DOMAIN: ci-caches.rust-lang.org
6267
continue-on-error: "${{ matrix.continue_on_error || false }}"
6368
strategy:
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/setup-msys2@v2.22.0
@@ -152,30 +152,6 @@ jobs:
152152
AWS_ACCESS_KEY_ID: "${{ env.ARTIFACTS_AWS_ACCESS_KEY_ID }}"
153153
AWS_SECRET_ACCESS_KEY: "${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.ARTIFACTS_AWS_ACCESS_KEY_ID)] }}"
154154
if: "success() && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')"
155-
master:
156-
name: master
157-
runs-on: ubuntu-latest
158-
env:
159-
SCCACHE_BUCKET: rust-lang-ci-sccache2
160-
DEPLOY_BUCKET: rust-lang-ci2
161-
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"
162-
TOOLSTATE_ISSUES_API_URL: "https://api.github.com/repos/rust-lang/rust/issues"
163-
TOOLSTATE_PUBLISH: 1
164-
CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZI5DHEBFL
165-
ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZN24CBO55
166-
AWS_REGION: us-west-1
167-
CACHE_DOMAIN: ci-caches.rust-lang.org
168-
if: "github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'"
169-
steps:
170-
- name: checkout the source code
171-
uses: actions/checkout@v4
172-
with:
173-
fetch-depth: 2
174-
- name: publish toolstate
175-
run: src/ci/publish_toolstate.sh
176-
shell: bash
177-
env:
178-
TOOLSTATE_REPO_ACCESS_TOKEN: "${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}"
179155
try-success:
180156
needs:
181157
- job
@@ -201,9 +177,15 @@ jobs:
201177
- job
202178
if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
203179
steps:
204-
- name: mark the job as a success
205-
run: exit 0
180+
- name: checkout the source code
181+
uses: actions/checkout@v4
182+
with:
183+
fetch-depth: 2
184+
- name: publish toolstate
185+
run: src/ci/publish_toolstate.sh
206186
shell: bash
187+
env:
188+
TOOLSTATE_REPO_ACCESS_TOKEN: "${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}"
207189
name: bors build finished
208190
runs-on: ubuntu-latest
209191
auto-failure:

‎src/ci/github-actions/ci.yml

Lines changed: 110 additions & 198 deletions
Original file line numberDiff line numberDiff line change
@@ -29,91 +29,108 @@
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+
pull_request:
66+
branches:
67+
- "**"
68+
69+
permissions:
70+
contents: read
71+
packages: write
72+
73+
defaults:
74+
run:
75+
# On Linux, macOS, and Windows, use the system-provided bash as the default
76+
# shell. (This should only make a difference on Windows, where the default
77+
# shell is PowerShell.)
78+
shell: bash
79+
80+
concurrency:
81+
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch.
82+
# We add an exception for try builds (try branch) and unrolled rollup builds (try-perf), which
83+
# are all triggered on the same branch, but which should be able to run concurrently.
84+
group: ${{ github.workflow }}-${{ ((github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.sha) || github.ref }}
85+
cancel-in-progress: true
86+
87+
env:
88+
TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
89+
90+
jobs:
91+
# The job matrix for `calculate_matrix` is defined in src/ci/github-actions/jobs.yml.
92+
# It calculates which jobs should be executed, based on the data of the ${{ github }} context.
93+
# If you want to modify CI jobs, take a look at src/ci/github-actions/jobs.yml.
94+
calculate_matrix:
95+
name: Calculate job matrix
96+
runs-on: ubuntu-latest
97+
outputs:
98+
jobs: ${{ steps.jobs.outputs.jobs }}
99+
steps:
100+
- name: Checkout the source code
101+
uses: actions/checkout@v4
102+
- name: Calculate the CI job matrix
103+
run: python3 src/ci/github-actions/calculate-job-matrix.py >> $GITHUB_OUTPUT
104+
id: jobs
105+
job:
106+
name: ${{ matrix.name }}
107+
needs: [ calculate_matrix ]
108+
runs-on: "${{ matrix.os }}"
111109
defaults:
112110
run:
113111
shell: ${{ contains(matrix.os, 'windows') && 'msys2 {0}' || 'bash' }}
114112
timeout-minutes: 600
115-
runs-on: "${{ matrix.os }}"
116-
env: *shared-ci-variables
113+
env:
114+
CI_JOB_NAME: ${{ matrix.image }}
115+
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
116+
# commit of PR sha or commit sha. `GITHUB_SHA` is not accurate for PRs.
117+
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
118+
DOCKER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119+
SCCACHE_BUCKET: rust-lang-ci-sccache2
120+
CACHE_DOMAIN: ci-caches.rust-lang.org
121+
continue-on-error: ${{ matrix.continue_on_error || false }}
122+
strategy:
123+
matrix:
124+
# Check the `calculate_matrix` job to see how is the matrix defined.
125+
include: ${{ fromJSON(needs.calculate_matrix.outputs.jobs) }}
126+
# GitHub Actions fails the workflow if an empty list of jobs is provided to
127+
# the workflow, so we need to skip this job if nothing was produced by
128+
# the Python script.
129+
#
130+
# Unfortunately checking whether a list is empty is not possible in a nice
131+
# way due to GitHub Actions expressions limits.
132+
# This hack is taken from https://github.com/ferrocene/ferrocene/blob/d43edc6b7697cf1719ec1c17c54904ab94825763/.github/workflows/release.yml#L75-L82
133+
if: fromJSON(needs.calculate_matrix.outputs.jobs)[0] != null
117134
steps:
118135
- if: contains(matrix.os, 'windows')
119136
uses: msys2/setup-msys2@v2.22.0
@@ -253,122 +270,6 @@ x--expand-yaml-anchors--remove:
253270
# erroring about invalid credentials instead.
254271
if: success() && (github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1')
255272

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-
354-
master:
355-
name: master
356-
runs-on: ubuntu-latest
357-
env:
358-
<<: [*prod-variables]
359-
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'rust-lang-ci/rust'
360-
steps:
361-
- name: checkout the source code
362-
uses: actions/checkout@v4
363-
with:
364-
fetch-depth: 2
365-
366-
- name: publish toolstate
367-
run: src/ci/publish_toolstate.sh
368-
shell: bash
369-
env:
370-
TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
371-
372273
# These jobs don't actually test anything, but they're used to tell bors the
373274
# build completed, as there is no practical way to detect when a workflow is
374275
# successful listening to webhooks only.
@@ -383,7 +284,18 @@ jobs:
383284
auto-success:
384285
needs: [ job ]
385286
if: "success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"
386-
<<: *base-success-job
287+
<<: *base-outcome-job
288+
steps:
289+
- name: checkout the source code
290+
uses: actions/checkout@v4
291+
with:
292+
fetch-depth: 2
293+
- name: publish toolstate
294+
run: src/ci/publish_toolstate.sh
295+
shell: bash
296+
env:
297+
TOOLSTATE_REPO_ACCESS_TOKEN: ${{ secrets.TOOLSTATE_REPO_ACCESS_TOKEN }}
298+
387299
auto-failure:
388300
needs: [ job ]
389301
if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'"

0 commit comments

Comments
 (0)
Please sign in to comment.