Skip to content

Commit 0e9eed1

Browse files
committed
Use a dynamic environment for PR jobs
1 parent 05f3c0a commit 0e9eed1

File tree

14 files changed

+63
-32
lines changed

14 files changed

+63
-32
lines changed

.github/workflows/ci.yml

+3-11
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,13 @@ jobs:
4545
- name: Checkout the source code
4646
uses: actions/checkout@v4
4747
- name: Calculate the CI job matrix
48-
run: python3 src/ci/scripts/calculate-job-matrix.py >> $GITHUB_OUTPUT
48+
run: python3 src/ci/github-actions/calculate-job-matrix.py >> $GITHUB_OUTPUT
4949
id: jobs
5050
pr:
51-
name: "PR - ${{ matrix.name }}"
51+
name: "${{ matrix.name }}"
5252
needs:
5353
- calculate_matrix
54-
env:
55-
PR_CI_JOB: 1
56-
CI_JOB_NAME: "${{ matrix.name }}"
57-
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
58-
HEAD_SHA: "${{ github.event.pull_request.head.sha || github.sha }}"
59-
DOCKER_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
60-
SCCACHE_BUCKET: rust-lang-ci-sccache2
61-
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"
62-
CACHE_DOMAIN: ci-caches.rust-lang.org
54+
env: "${{ matrix.env }}"
6355
if: "github.event_name == 'pull_request'"
6456
continue-on-error: "${{ matrix.name == 'mingw-check-tidy' }}"
6557
strategy:

src/ci/github-actions/ci.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -351,15 +351,13 @@ jobs:
351351
- name: Checkout the source code
352352
uses: actions/checkout@v4
353353
- name: Calculate the CI job matrix
354-
run: python3 src/ci/scripts/calculate-job-matrix.py >> $GITHUB_OUTPUT
354+
run: python3 src/ci/github-actions/calculate-job-matrix.py >> $GITHUB_OUTPUT
355355
id: jobs
356356
pr:
357357
<<: *base-ci-job
358-
name: PR - ${{ matrix.name }}
358+
name: ${{ matrix.name }}
359359
needs: [ calculate_matrix ]
360-
env:
361-
<<: [*shared-ci-variables, *public-variables]
362-
PR_CI_JOB: 1
360+
env: ${{ matrix.env }}
363361
if: github.event_name == 'pull_request'
364362
continue-on-error: ${{ matrix.name == 'mingw-check-tidy' }}
365363
strategy:

src/ci/github-actions/jobs.yml

+46-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,36 @@
22
# dynamically in CI from ci.yml.
33
# You *do not* need to re-run `src/tools/expand-yaml-anchors` when you
44
# modify this file.
5-
shared_defs:
5+
variables:
6+
- &shared-ci-variables
7+
CI_JOB_NAME: ${{ matrix.name }}
8+
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
9+
# commit of PR sha or commit sha. `GITHUB_SHA` is not accurate for PRs.
10+
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
11+
DOCKER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12+
13+
- &public-variables
14+
SCCACHE_BUCKET: rust-lang-ci-sccache2
15+
TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
16+
CACHE_DOMAIN: ci-caches.rust-lang.org
17+
18+
- &prod-variables
19+
SCCACHE_BUCKET: rust-lang-ci-sccache2
20+
DEPLOY_BUCKET: rust-lang-ci2
21+
TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
22+
TOOLSTATE_ISSUES_API_URL: https://api.github.com/repos/rust-lang/rust/issues
23+
TOOLSTATE_PUBLISH: 1
24+
# AWS_SECRET_ACCESS_KEYs are stored in GitHub's secrets storage, named
25+
# AWS_SECRET_ACCESS_KEY_<keyid>. Including the key id in the name allows to
26+
# rotate them in a single branch while keeping the old key in another
27+
# branch, which wouldn't be possible if the key was named with the kind
28+
# (caches, artifacts...).
29+
CACHES_AWS_ACCESS_KEY_ID: AKIA46X5W6CZI5DHEBFL
30+
ARTIFACTS_AWS_ACCESS_KEY_ID: AKIA46X5W6CZN24CBO55
31+
AWS_REGION: us-west-1
32+
CACHE_DOMAIN: ci-caches.rust-lang.org
33+
34+
runners:
635
- &base-job
736
env: { }
837

@@ -37,14 +66,26 @@ shared_defs:
3766
- &job-aarch64-linux
3867
os: [ self-hosted, ARM64, linux ]
3968

69+
envs:
70+
- &pr-env
71+
<<: [ *shared-ci-variables, *public-variables ]
72+
PR_CI_JOB: 1
73+
4074
pr:
41-
- name: mingw-check
75+
- name: PR - mingw-check
76+
env:
77+
<<: *pr-env
4278
<<: *job-linux-4c
43-
- name: mingw-check-tidy
79+
- name: PR - mingw-check-tidy
80+
env:
81+
<<: *pr-env
4482
<<: *job-linux-4c
45-
- name: x86_64-gnu-llvm-17
83+
- name: PR - x86_64-gnu-llvm-17
4684
env:
4785
ENABLE_GCC_CODEGEN: "1"
86+
<<: *pr-env
4887
<<: *job-linux-16c
49-
- name: x86_64-gnu-tools
88+
- name: PR - x86_64-gnu-tools
89+
env:
90+
<<: *pr-env
5091
<<: *job-linux-16c

src/llvm-project

Submodule llvm-project updated 82 files

src/tools/cargo

Submodule cargo updated 307 files

0 commit comments

Comments
 (0)