From eeba9e4cd6054ecb08a72c56c454191c52bb51ca Mon Sep 17 00:00:00 2001 From: StandingMan Date: Sat, 25 Jul 2026 09:49:31 +0800 Subject: [PATCH 1/2] ci(rust): skip unnecessary setup steps --- .github/actions/rust/pre-merge/action.yml | 6 ++ .../utils/setup-rust-with-cache/action.yml | 14 ++- .github/workflows/benchmark-rust-setup.yml | 93 +++++++++++++++++++ .github/workflows/coverage-baseline.yml | 1 + scripts/ci/sync-python-interpreter-version.sh | 2 +- 5 files changed, 112 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/benchmark-rust-setup.yml diff --git a/.github/actions/rust/pre-merge/action.yml b/.github/actions/rust/pre-merge/action.yml index 536e3056e0..40c0dafce2 100644 --- a/.github/actions/rust/pre-merge/action.yml +++ b/.github/actions/rust/pre-merge/action.yml @@ -33,6 +33,12 @@ runs: - name: Setup Rust with cache uses: ./.github/actions/utils/setup-rust-with-cache with: + # Only test jobs execute nextest. Avoid downloading it in lint, metadata, + # and cross-build jobs. + install-nextest: ${{ startsWith(inputs.task, 'test-') }} + # These tasks do not compile workspace crates and need no native + # libraries. All compiling tasks keep the existing dependency setup. + install-system-dependencies: ${{ inputs.task != 'fmt' && inputs.task != 'sort' && inputs.task != 'machete' }} # Miri builds against a nightly toolchain with a separate `target/miri` # subtree; isolate its cache from the stable `dev` namespace so the # two don't evict each other. diff --git a/.github/actions/utils/setup-rust-with-cache/action.yml b/.github/actions/utils/setup-rust-with-cache/action.yml index e01ce81f8d..6c3bf16fb4 100644 --- a/.github/actions/utils/setup-rust-with-cache/action.yml +++ b/.github/actions/utils/setup-rust-with-cache/action.yml @@ -19,6 +19,14 @@ name: setup-rust-with-cache description: Setup Rust toolchain with Swatinem/rust-cache inputs: + install-nextest: + description: "Whether to install cargo-nextest" + required: false + default: "false" + install-system-dependencies: + description: "Whether to install system packages required by Rust builds" + required: false + default: "true" read-cache: description: "Whether to read from cache" required: false @@ -55,14 +63,14 @@ runs: aggressive: ${{ inputs.free-disk-space-aggressive }} - name: Install system dependencies (Linux) - if: runner.os == 'Linux' + if: runner.os == 'Linux' && inputs.install-system-dependencies == 'true' run: | sudo apt-get update sudo apt-get install -y libhwloc-dev pkg-config libudev-dev shell: bash - name: Install system dependencies (macOS) - if: runner.os == 'macOS' + if: runner.os == 'macOS' && inputs.install-system-dependencies == 'true' run: | # Pin version of hwloc to 2.12.2_1 # brew extract doesn't have this version, so we fetch the formula directly @@ -117,7 +125,7 @@ runs: shell: bash - name: Install cargo-nextest - if: runner.os == 'Linux' + if: runner.os == 'Linux' && inputs.install-nextest == 'true' run: | if command -v cargo-nextest &> /dev/null; then echo "cargo-nextest already installed" diff --git a/.github/workflows/benchmark-rust-setup.yml b/.github/workflows/benchmark-rust-setup.yml new file mode 100644 index 0000000000..569179fffe --- /dev/null +++ b/.github/workflows/benchmark-rust-setup.yml @@ -0,0 +1,93 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Benchmark Rust setup + +on: + pull_request: + paths: + - ".github/actions/utils/setup-rust-with-cache/action.yml" + - ".github/workflows/benchmark-rust-setup.yml" + +permissions: + contents: read + +jobs: + benchmark: + name: ${{ matrix.profile }} / run-${{ matrix.repetition }} + runs-on: ubuntu-latest + + strategy: + fail-fast: false + max-parallel: 1 + matrix: + profile: + - baseline + - optimized + repetition: + - 1 + - 2 + - 3 + + steps: + - name: Checkout + uses: actions/checkout@v7.0.0 + + - name: Record start time + id: clock + run: echo "started_at=$(date +%s)" >> "$GITHUB_OUTPUT" + + - name: Setup Rust + uses: ./.github/actions/utils/setup-rust-with-cache + with: + install-nextest: ${{ matrix.profile == 'baseline' }} + install-system-dependencies: ${{ matrix.profile == 'baseline' }} + + read-cache: "false" + free-disk-space: "false" + + - name: Verify setup + env: + PROFILE: ${{ matrix.profile }} + run: | + cargo --version + + if [[ "$PROFILE" == "baseline" ]]; then + command -v cargo-nextest + cargo nextest --version + fi + + cargo fmt --all -- --check + + - name: Report duration + env: + STARTED_AT: ${{ steps.clock.outputs.started_at }} + PROFILE: ${{ matrix.profile }} + REPETITION: ${{ matrix.repetition }} + run: | + finished_at=$(date +%s) + elapsed=$((finished_at - STARTED_AT)) + + echo "::notice title=Rust setup benchmark::${PROFILE} run ${REPETITION}: ${elapsed}s" + + { + echo "## Rust setup benchmark" + echo "" + echo "| Profile | Repetition | Duration |" + echo "| --- | ---: | ---: |" + echo "| ${PROFILE} | ${REPETITION} | ${elapsed}s |" + } >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/workflows/coverage-baseline.yml b/.github/workflows/coverage-baseline.yml index 1f580db3d6..af0e5e13ba 100644 --- a/.github/workflows/coverage-baseline.yml +++ b/.github/workflows/coverage-baseline.yml @@ -52,6 +52,7 @@ jobs: - name: Setup Rust with cache uses: ./.github/actions/utils/setup-rust-with-cache with: + install-nextest: "true" # Also warms the GitHub Actions build cache for subsequent PR builds save-cache: "true" # llvm-cov instrumentation roughly doubles object sizes; the light diff --git a/scripts/ci/sync-python-interpreter-version.sh b/scripts/ci/sync-python-interpreter-version.sh index bc6a2de293..4c71c3ef2f 100755 --- a/scripts/ci/sync-python-interpreter-version.sh +++ b/scripts/ci/sync-python-interpreter-version.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information From dd209c02f1caa55bd8ee923a9ddf5d6988c97129 Mon Sep 17 00:00:00 2001 From: StandingMan Date: Mon, 3 Aug 2026 22:01:53 +0800 Subject: [PATCH 2/2] fix(ci): unify shebangs across CI scripts Signed-off-by: StandingMan --- .github/workflows/benchmark-rust-setup.yml | 93 ---------------------- scripts/ci/python-sdk-version-sync.sh | 2 +- scripts/ci/sync-rustc-version.sh | 2 +- scripts/ci/third-party-licenses.sh | 2 +- scripts/ci/uv-lock-check.sh | 2 +- 5 files changed, 4 insertions(+), 97 deletions(-) delete mode 100644 .github/workflows/benchmark-rust-setup.yml diff --git a/.github/workflows/benchmark-rust-setup.yml b/.github/workflows/benchmark-rust-setup.yml deleted file mode 100644 index 569179fffe..0000000000 --- a/.github/workflows/benchmark-rust-setup.yml +++ /dev/null @@ -1,93 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -name: Benchmark Rust setup - -on: - pull_request: - paths: - - ".github/actions/utils/setup-rust-with-cache/action.yml" - - ".github/workflows/benchmark-rust-setup.yml" - -permissions: - contents: read - -jobs: - benchmark: - name: ${{ matrix.profile }} / run-${{ matrix.repetition }} - runs-on: ubuntu-latest - - strategy: - fail-fast: false - max-parallel: 1 - matrix: - profile: - - baseline - - optimized - repetition: - - 1 - - 2 - - 3 - - steps: - - name: Checkout - uses: actions/checkout@v7.0.0 - - - name: Record start time - id: clock - run: echo "started_at=$(date +%s)" >> "$GITHUB_OUTPUT" - - - name: Setup Rust - uses: ./.github/actions/utils/setup-rust-with-cache - with: - install-nextest: ${{ matrix.profile == 'baseline' }} - install-system-dependencies: ${{ matrix.profile == 'baseline' }} - - read-cache: "false" - free-disk-space: "false" - - - name: Verify setup - env: - PROFILE: ${{ matrix.profile }} - run: | - cargo --version - - if [[ "$PROFILE" == "baseline" ]]; then - command -v cargo-nextest - cargo nextest --version - fi - - cargo fmt --all -- --check - - - name: Report duration - env: - STARTED_AT: ${{ steps.clock.outputs.started_at }} - PROFILE: ${{ matrix.profile }} - REPETITION: ${{ matrix.repetition }} - run: | - finished_at=$(date +%s) - elapsed=$((finished_at - STARTED_AT)) - - echo "::notice title=Rust setup benchmark::${PROFILE} run ${REPETITION}: ${elapsed}s" - - { - echo "## Rust setup benchmark" - echo "" - echo "| Profile | Repetition | Duration |" - echo "| --- | ---: | ---: |" - echo "| ${PROFILE} | ${REPETITION} | ${elapsed}s |" - } >> "$GITHUB_STEP_SUMMARY" diff --git a/scripts/ci/python-sdk-version-sync.sh b/scripts/ci/python-sdk-version-sync.sh index 3788573bc4..591f68edb8 100755 --- a/scripts/ci/python-sdk-version-sync.sh +++ b/scripts/ci/python-sdk-version-sync.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information diff --git a/scripts/ci/sync-rustc-version.sh b/scripts/ci/sync-rustc-version.sh index 1d25027f69..cc494dabd3 100755 --- a/scripts/ci/sync-rustc-version.sh +++ b/scripts/ci/sync-rustc-version.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information diff --git a/scripts/ci/third-party-licenses.sh b/scripts/ci/third-party-licenses.sh index 8c86b253a8..e2304b26dd 100755 --- a/scripts/ci/third-party-licenses.sh +++ b/scripts/ci/third-party-licenses.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information diff --git a/scripts/ci/uv-lock-check.sh b/scripts/ci/uv-lock-check.sh index 643ca3d858..de76ad7bfe 100755 --- a/scripts/ci/uv-lock-check.sh +++ b/scripts/ci/uv-lock-check.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information