Skip to content

Commit 7c792e2

Browse files
committed
Only use DIST_TRY_BUILD for try jobs that were not selected explicitly
1 parent aa95b96 commit 7c792e2

File tree

4 files changed

+24
-19
lines changed

4 files changed

+24
-19
lines changed

src/ci/citool/src/jobs.rs

+14
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,20 @@ fn calculate_jobs(
185185
env.extend(crate::yaml_map_to_json(&job.env));
186186
let full_name = format!("{prefix} - {}", job.name);
187187

188+
// When the default `@bors try` job is executed (which is usually done
189+
// for benchmarking performance, running crater or for downloading the
190+
// built toolchain using `rustup-toolchain-install-master`),
191+
// we inject the `DIST_TRY_BUILD` environment variable to the jobs
192+
// to tell `opt-dist` to make the build faster by skipping certain steps.
193+
if let RunType::TryJob { job_patterns } = run_type {
194+
if job_patterns.is_none() {
195+
env.insert(
196+
"DIST_TRY_BUILD".to_string(),
197+
serde_json::value::Value::Number(1.into()),
198+
);
199+
}
200+
}
201+
188202
GithubActionsJob {
189203
name: job.name,
190204
full_name,

src/ci/citool/tests/jobs.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ fn auto_jobs() {
1414
#[test]
1515
fn try_jobs() {
1616
let stdout = get_matrix("push", "commit", "refs/heads/try");
17-
insta::assert_snapshot!(stdout, @r#"
17+
insta::assert_snapshot!(stdout, @r###"
1818
jobs=[{"name":"dist-x86_64-linux","full_name":"try - dist-x86_64-linux","os":"ubuntu-22.04-16core-64gb","env":{"ARTIFACTS_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZN24CBO55","AWS_REGION":"us-west-1","CACHES_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZI5DHEBFL","CODEGEN_BACKENDS":"llvm,cranelift","DEPLOY_BUCKET":"rust-lang-ci2","DIST_TRY_BUILD":1,"TOOLSTATE_PUBLISH":1}}]
1919
run_type=try
20-
"#);
20+
"###);
2121
}
2222

2323
#[test]
@@ -30,10 +30,10 @@ try-job: aarch64-gnu
3030
try-job: dist-i686-msvc"#,
3131
"refs/heads/try",
3232
);
33-
insta::assert_snapshot!(stdout, @r#"
34-
jobs=[{"name":"aarch64-gnu","full_name":"try - aarch64-gnu","os":"ubuntu-22.04-arm","env":{"ARTIFACTS_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZN24CBO55","AWS_REGION":"us-west-1","CACHES_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZI5DHEBFL","DEPLOY_BUCKET":"rust-lang-ci2","DIST_TRY_BUILD":1,"TOOLSTATE_PUBLISH":1},"free_disk":true},{"name":"dist-i686-msvc","full_name":"try - dist-i686-msvc","os":"windows-2022","env":{"ARTIFACTS_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZN24CBO55","AWS_REGION":"us-west-1","CACHES_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZI5DHEBFL","CODEGEN_BACKENDS":"llvm,cranelift","DEPLOY_BUCKET":"rust-lang-ci2","DIST_REQUIRE_ALL_TOOLS":1,"DIST_TRY_BUILD":1,"RUST_CONFIGURE_ARGS":"--build=i686-pc-windows-msvc --host=i686-pc-windows-msvc --target=i686-pc-windows-msvc,i586-pc-windows-msvc --enable-full-tools --enable-profiler","SCRIPT":"python x.py dist bootstrap --include-default-paths","TOOLSTATE_PUBLISH":1}}]
33+
insta::assert_snapshot!(stdout, @r###"
34+
jobs=[{"name":"aarch64-gnu","full_name":"try - aarch64-gnu","os":"ubuntu-22.04-arm","env":{"ARTIFACTS_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZN24CBO55","AWS_REGION":"us-west-1","CACHES_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZI5DHEBFL","DEPLOY_BUCKET":"rust-lang-ci2","TOOLSTATE_PUBLISH":1},"free_disk":true},{"name":"dist-i686-msvc","full_name":"try - dist-i686-msvc","os":"windows-2022","env":{"ARTIFACTS_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZN24CBO55","AWS_REGION":"us-west-1","CACHES_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZI5DHEBFL","CODEGEN_BACKENDS":"llvm,cranelift","DEPLOY_BUCKET":"rust-lang-ci2","DIST_REQUIRE_ALL_TOOLS":1,"RUST_CONFIGURE_ARGS":"--build=i686-pc-windows-msvc --host=i686-pc-windows-msvc --target=i686-pc-windows-msvc,i586-pc-windows-msvc --enable-full-tools --enable-profiler","SCRIPT":"python x.py dist bootstrap --include-default-paths","TOOLSTATE_PUBLISH":1}}]
3535
run_type=try
36-
"#);
36+
"###);
3737
}
3838

3939
#[test]

src/ci/citool/tests/test-jobs.yml

-7
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,6 @@ envs:
5353

5454
try:
5555
<<: *production
56-
# The following env var activates faster `try` builds in `opt-dist` by, e.g.
57-
# - building only the more commonly useful components (we rarely need e.g. rust-docs in try
58-
# builds)
59-
# - not running `opt-dist`'s post-optimization smoke tests on the resulting toolchain
60-
#
61-
# If you *want* these to happen however, temporarily comment it before triggering a try build.
62-
DIST_TRY_BUILD: 1
6356

6457
auto:
6558
<<: *production

src/ci/github-actions/jobs.yml

+5-7
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,13 @@ envs:
8282
AWS_REGION: us-west-1
8383
TOOLSTATE_PUBLISH: 1
8484

85+
# Try builds started through `@bors try` (without specifying custom jobs
86+
# in the PR description) will be passed the `DIST_TRY_BUILD` environment
87+
# variable by citool.
88+
# This tells the `opt-dist` tool to skip building certain components
89+
# and skip running tests, so that the try build finishes faster.
8590
try:
8691
<<: *production
87-
# The following env var activates faster `try` builds in `opt-dist` by, e.g.
88-
# - building only the more commonly useful components (we rarely need e.g. rust-docs in try
89-
# builds)
90-
# - not running `opt-dist`'s post-optimization smoke tests on the resulting toolchain
91-
#
92-
# If you *want* these to happen however, temporarily comment it before triggering a try build.
93-
DIST_TRY_BUILD: 1
9492

9593
auto:
9694
<<: *production

0 commit comments

Comments
 (0)