From db113b1c2bc1b09eb370407e7b217249cd5d263b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Thu, 1 Jun 2023 08:29:19 +0200 Subject: [PATCH] Do not build components unneeded for perf bot in try builds --- .github/workflows/ci.yml | 1 + src/ci/docker/run.sh | 1 + src/ci/github-actions/ci.yml | 1 + src/ci/stage-build.py | 13 +++++++++++++ 4 files changed, 16 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b12a0b855e2e7..210ec72a11e0b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -578,6 +578,7 @@ jobs: actions: write name: "try - ${{ matrix.name }}" env: + DIST_TRY_BUILD: 1 CI_JOB_NAME: "${{ matrix.name }}" CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse SCCACHE_BUCKET: rust-lang-ci-sccache2 diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index 8bea8cd4c878c..2fe3438e0fe8a 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -264,6 +264,7 @@ docker \ --env RUST_CI_OVERRIDE_RELEASE_CHANNEL \ --env CI_JOB_NAME="${CI_JOB_NAME-$IMAGE}" \ --env BASE_COMMIT="$BASE_COMMIT" \ + --env DIST_TRY_BUILD \ --init \ --rm \ rust-ci \ diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index fd619467fc153..d3cb6b6ed5220 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -757,6 +757,7 @@ jobs: <<: *base-ci-job name: try - ${{ matrix.name }} env: + DIST_TRY_BUILD: 1 <<: [*shared-ci-variables, *prod-variables] if: github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust' strategy: diff --git a/src/ci/stage-build.py b/src/ci/stage-build.py index 8d03d3759bf00..bf0ef15f5eacf 100644 --- a/src/ci/stage-build.py +++ b/src/ci/stage-build.py @@ -48,6 +48,11 @@ LLVM_BOLT_CRATES = LLVM_PGO_CRATES + +def is_try_build() -> bool: + return os.environ.get("DIST_TRY_BUILD", "0") != "0" + + class Pipeline: # Paths def checkout_path(self) -> Path: @@ -851,6 +856,13 @@ def run(runner: BenchmarkRunner): build_args = sys.argv[1:] + # Skip components that are not needed for try builds to speed them up + if is_try_build(): + LOGGER.info("Skipping building of unimportant components for a try build") + for target in ("rust-docs", "rustc-docs", "rust-docs-json", "rust-analyzer", + "rustc-src", "clippy", "miri", "rustfmt"): + build_args.extend(["--exclude", target]) + timer = Timer() pipeline = create_pipeline() @@ -865,6 +877,7 @@ def run(runner: BenchmarkRunner): print_binary_sizes(pipeline) + if __name__ == "__main__": runner = DefaultBenchmarkRunner() run(runner)