From 9b59bc6b0df5a717b72976fe7262c5adb76c0f2a Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 23 Oct 2026 04:50:29 -0700 Subject: [PATCH] ci: build test binaries once, share them across shard jobs (#11981) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ci: build test binaries once, share them across shard jobs 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> * ci: preserve binary paths through the artifact round-trip upload-artifact stores single files flat, so weed/weed would come back at the workspace root and the consumers' expected paths break. Pack the binaries in a tar before upload and extract on download. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> * ci: extract the shared test binaries in the rust go-test shards The download step leaves rust-test-binaries.tar at the workspace root; without untarring it the chmod fails on missing files and every shard fails before running a test. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../workflows/rust-volume-server-tests.yml | 126 ++++++++++-------- .../volume-server-integration-tests.yml | 53 ++++++-- 2 files changed, 119 insertions(+), 60 deletions(-) diff --git a/.github/workflows/rust-volume-server-tests.yml b/.github/workflows/rust-volume-server-tests.yml index b88a245876..7bcdbaf112 100644 --- a/.github/workflows/rust-volume-server-tests.yml +++ b/.github/workflows/rust-volume-server-tests.yml @@ -52,6 +52,63 @@ 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: Package binaries + run: tar cf rust-test-binaries.tar weed/weed seaweed-volume/target/release/weed-volume + + - name: Upload test binaries + uses: actions/upload-artifact@v7 + with: + # archive layout mirrors the workspace: weed/weed and + # seaweed-volume/target/release/weed-volume + name: rust-test-binaries + if-no-files-found: error + retention-days: 1 + path: rust-test-binaries.tar + rust-unit-tests: name: Rust Unit Tests runs-on: ubuntu-22.04 @@ -154,6 +211,7 @@ jobs: name: Rust Integration Tests runs-on: ubuntu-22.04 timeout-minutes: 30 + needs: [build-test-binaries] steps: - name: Checkout code @@ -164,35 +222,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 binaries 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 + tar xf rust-test-binaries.tar + chmod +x weed/weed seaweed-volume/target/release/weed-volume + ./weed/weed version - name: Run integration tests env: @@ -228,6 +267,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 +286,17 @@ 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 binaries 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 + tar xf rust-test-binaries.tar + 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 9bea478215..a1f98648e6 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,48 @@ jobs: chmod +x weed ./weed version + - name: Package binary + run: tar cf weed-binary.tar weed/weed + + - name: Upload binary + uses: actions/upload-artifact@v7 + with: + name: weed-binary + if-no-files-found: error + retention-days: 1 + path: weed-binary.tar + + 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 + run: | + tar xf weed-binary.tar + 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.