Skip to content

Commit d59363a

Browse files
committed
Auto merge of #111660 - Kobzol:try-build-skip-docs, r=mark-simulacrum
Do not build docs in try builds This PR adds a new environment variable to the optimized build Python script, which causes it to ignore certain parts of the final `dist` build (mainly docs) in try builds. This reduces the duration of try builds by ~10 minutes.
2 parents 789dd0b + db113b1 commit d59363a

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ jobs:
578578
actions: write
579579
name: "try - ${{ matrix.name }}"
580580
env:
581+
DIST_TRY_BUILD: 1
581582
CI_JOB_NAME: "${{ matrix.name }}"
582583
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
583584
SCCACHE_BUCKET: rust-lang-ci-sccache2

src/ci/docker/run.sh

+1
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ docker \
264264
--env RUST_CI_OVERRIDE_RELEASE_CHANNEL \
265265
--env CI_JOB_NAME="${CI_JOB_NAME-$IMAGE}" \
266266
--env BASE_COMMIT="$BASE_COMMIT" \
267+
--env DIST_TRY_BUILD \
267268
--init \
268269
--rm \
269270
rust-ci \

src/ci/github-actions/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,7 @@ jobs:
757757
<<: *base-ci-job
758758
name: try - ${{ matrix.name }}
759759
env:
760+
DIST_TRY_BUILD: 1
760761
<<: [*shared-ci-variables, *prod-variables]
761762
if: github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'
762763
strategy:

src/ci/stage-build.py

+13
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@
4848

4949
LLVM_BOLT_CRATES = LLVM_PGO_CRATES
5050

51+
52+
def is_try_build() -> bool:
53+
return os.environ.get("DIST_TRY_BUILD", "0") != "0"
54+
55+
5156
class Pipeline:
5257
# Paths
5358
def checkout_path(self) -> Path:
@@ -851,6 +856,13 @@ def run(runner: BenchmarkRunner):
851856

852857
build_args = sys.argv[1:]
853858

859+
# Skip components that are not needed for try builds to speed them up
860+
if is_try_build():
861+
LOGGER.info("Skipping building of unimportant components for a try build")
862+
for target in ("rust-docs", "rustc-docs", "rust-docs-json", "rust-analyzer",
863+
"rustc-src", "clippy", "miri", "rustfmt"):
864+
build_args.extend(["--exclude", target])
865+
854866
timer = Timer()
855867
pipeline = create_pipeline()
856868

@@ -865,6 +877,7 @@ def run(runner: BenchmarkRunner):
865877

866878
print_binary_sizes(pipeline)
867879

880+
868881
if __name__ == "__main__":
869882
runner = DefaultBenchmarkRunner()
870883
run(runner)

0 commit comments

Comments
 (0)