From ff2fbfc6be45cdb77d836d2af81b3965b92d98dc Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 23 Oct 2026 03:41:32 -0700 Subject: [PATCH] ci: build test binaries once, share them across shard jobs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each of the 6 rust-volume-go-tests shards, the rust-integration-tests job, and the 6 volume-server-integration-tests shards rebuilt the same weed and weed-volume binaries — 13 duplicate builds per run. A build-test-binaries / build-weed job now compiles them once under the existing cargo cache and publishes them as artifacts; the consumers download and chmod them instead of building. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../workflows/rust-volume-server-tests.yml | 122 ++++++++++-------- .../volume-server-integration-tests.yml | 47 +++++-- 2 files changed, 109 insertions(+), 60 deletions(-) diff --git a/.github/workflows/rust-volume-server-tests.yml b/.github/workflows/rust-volume-server-tests.yml index fd68db1a5d..f377e1d25e 100644 --- a/.github/workflows/rust-volume-server-tests.yml +++ b/.github/workflows/rust-volume-server-tests.yml @@ -52,6 +52,60 @@ jobs: - 'seaweed-volume/**' - '.github/workflows/rust-volume-server-tests.yml' + build-test-binaries: + name: Build Test Binaries + runs-on: ubuntu-22.04 + timeout-minutes: 30 + + steps: + - name: Checkout code + uses: actions/checkout@v7 + + - name: Set up Go + uses: actions/setup-go@v7 + with: + go-version-file: 'go.mod' + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + + # cargo tracks its own inputs but not the runner's C toolchain, so a cached + # target/ can carry C objects built against a different glibc than we link against. + - name: Fingerprint build toolchain + id: toolchain + run: echo "fingerprint=$(getconf GNU_LIBC_VERSION | tr ' ' '-')-rustc-$(rustc -V | awk '{print $2}')" >> "$GITHUB_OUTPUT" + + - name: Cache cargo registry and target + uses: actions/cache@v6 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + seaweed-volume/target + key: rust-${{ steps.toolchain.outputs.fingerprint }}-${{ hashFiles('seaweed-volume/Cargo.lock', 'seaweed-common/Cargo.lock') }} + restore-keys: | + rust-${{ steps.toolchain.outputs.fingerprint }}- + + - name: Build Go weed binary + run: | + cd weed + go build -tags 5BytesOffset -o weed . + chmod +x weed + ./weed version + + - name: Build Rust volume binary + run: cd seaweed-volume && cargo build --release + + - name: Upload test binaries + uses: actions/upload-artifact@v7 + with: + name: rust-test-binaries + if-no-files-found: error + retention-days: 1 + path: | + weed/weed + seaweed-volume/target/release/weed-volume + rust-unit-tests: name: Rust Unit Tests runs-on: ubuntu-22.04 @@ -154,6 +208,7 @@ jobs: name: Rust Integration Tests runs-on: ubuntu-22.04 timeout-minutes: 30 + needs: [build-test-binaries] steps: - name: Checkout code @@ -164,35 +219,16 @@ jobs: with: go-version-file: 'go.mod' - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable - - # cargo tracks its own inputs but not the runner's C toolchain, so a cached - # target/ can carry C objects built against a different glibc than we link against. - - name: Fingerprint build toolchain - id: toolchain - run: echo "fingerprint=$(getconf GNU_LIBC_VERSION | tr ' ' '-')-rustc-$(rustc -V | awk '{print $2}')" >> "$GITHUB_OUTPUT" - - - name: Cache cargo registry and target - uses: actions/cache@v6 + - name: Download test binaries + uses: actions/download-artifact@v7 with: - path: | - ~/.cargo/registry - ~/.cargo/git - seaweed-volume/target - key: rust-${{ steps.toolchain.outputs.fingerprint }}-${{ hashFiles('seaweed-volume/Cargo.lock', 'seaweed-common/Cargo.lock') }} - restore-keys: | - rust-${{ steps.toolchain.outputs.fingerprint }}- + name: rust-test-binaries - - name: Build Go weed binary + - name: Restore binary permissions run: | - cd weed - go build -tags 5BytesOffset -o weed . - chmod +x weed - ./weed version - - - name: Build Rust volume binary - run: cd seaweed-volume && cargo build --release + chmod +x weed/weed seaweed-volume/target/release/weed-volume + ./weed/weed version + ./seaweed-volume/target/release/weed-volume --help >/dev/null || true - name: Run integration tests env: @@ -228,6 +264,7 @@ jobs: name: Go Tests with Rust Volume (${{ matrix.test-type }} - Shard ${{ matrix.shard }}) runs-on: ubuntu-22.04 timeout-minutes: 45 + needs: [build-test-binaries] env: # Keep in step with the length of matrix.shard below. SHARD_COUNT: 3 @@ -246,35 +283,16 @@ jobs: with: go-version-file: 'go.mod' - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable - - # cargo tracks its own inputs but not the runner's C toolchain, so a cached - # target/ can carry C objects built against a different glibc than we link against. - - name: Fingerprint build toolchain - id: toolchain - run: echo "fingerprint=$(getconf GNU_LIBC_VERSION | tr ' ' '-')-rustc-$(rustc -V | awk '{print $2}')" >> "$GITHUB_OUTPUT" - - - name: Cache cargo registry and target - uses: actions/cache@v6 + - name: Download test binaries + uses: actions/download-artifact@v7 with: - path: | - ~/.cargo/registry - ~/.cargo/git - seaweed-volume/target - key: rust-${{ steps.toolchain.outputs.fingerprint }}-${{ hashFiles('seaweed-volume/Cargo.lock', 'seaweed-common/Cargo.lock') }} - restore-keys: | - rust-${{ steps.toolchain.outputs.fingerprint }}- + name: rust-test-binaries - - name: Build Go weed binary + - name: Restore binary permissions run: | - cd weed - go build -tags 5BytesOffset -o weed . - chmod +x weed - ./weed version - - - name: Build Rust volume binary - run: cd seaweed-volume && cargo build --release + chmod +x weed/weed seaweed-volume/target/release/weed-volume + ./weed/weed version + ./seaweed-volume/target/release/weed-volume --help >/dev/null || true # Dealing the listed tests out one by one keeps the shards even. Bucketing # them by first letter did not: names cluster, so ^Test[I-S] drew 50 of diff --git a/.github/workflows/volume-server-integration-tests.yml b/.github/workflows/volume-server-integration-tests.yml index c1874fa198..de14c3d423 100644 --- a/.github/workflows/volume-server-integration-tests.yml +++ b/.github/workflows/volume-server-integration-tests.yml @@ -33,15 +33,10 @@ env: SHARD_COUNT: 3 jobs: - volume-server-integration-tests: - name: Volume Server Integration Tests (${{ matrix.test-type }} - Shard ${{ matrix.shard }}) + build-weed: + name: Build SeaweedFS Binary runs-on: ubuntu-22.04 - timeout-minutes: 45 - strategy: - fail-fast: false - matrix: - test-type: [grpc, http] - shard: [1, 2, 3] + timeout-minutes: 15 steps: - name: Checkout code @@ -59,6 +54,42 @@ jobs: chmod +x weed ./weed version + - name: Upload binary + uses: actions/upload-artifact@v7 + with: + name: weed-binary + if-no-files-found: error + retention-days: 1 + path: weed/weed + + volume-server-integration-tests: + name: Volume Server Integration Tests (${{ matrix.test-type }} - Shard ${{ matrix.shard }}) + runs-on: ubuntu-22.04 + timeout-minutes: 45 + needs: [build-weed] + strategy: + fail-fast: false + matrix: + test-type: [grpc, http] + shard: [1, 2, 3] + + steps: + - name: Checkout code + uses: actions/checkout@v7 + + - name: Set up Go + uses: actions/setup-go@v7 + with: + go-version-file: 'go.mod' + + - name: Download binary + uses: actions/download-artifact@v7 + with: + name: weed-binary + + - name: Restore binary permissions + run: chmod +x weed/weed && ./weed/weed version + # Dealing the listed tests out one by one keeps the shards even. Bucketing # them by first letter did not: names cluster, so ^Test[I-S] drew 50 of # the 114 grpc tests and ran nearly twice as long as the other two shards.