Skip to content

Commit 1cecef4

Browse files
ci(e2e): cache the Rust build of the E2E suite bundles
build-e2e-bundles restores a Rust target cache, and Rust Cache saves it on main, where Branch E2E never runs. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
1 parent c0263e4 commit 1cecef4

2 files changed

Lines changed: 46 additions & 5 deletions

File tree

‎.github/workflows/branch-e2e.yml‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ jobs:
212212
# openshell-conformance, built once per run instead of in every row (see
213213
# e2e-suites.yml). The rows only run on amd64, so only the x86_64 guest
214214
# target is built. Each bundle holds its whole family; a row picks its
215-
# package at run time.
215+
# package at run time. Rust Cache (rust-cache.yml) saves the cache on main;
216+
# keep the env and build commands aligned with its e2e-bundles job.
216217
build-e2e-bundles:
217218
name: E2E suite bundles (x86_64-unknown-linux-musl)
218219
needs: [pr_metadata]
@@ -228,11 +229,16 @@ jobs:
228229
ref: ${{ github.sha }}
229230
- uses: ./.github/actions/setup-nix
230231
with:
232+
prepare-shell: "true"
231233
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
234+
- uses: ./.github/actions/setup-rust
235+
with:
236+
cache-key: e2e-bundles-v1-x86_64-unknown-linux-musl
232237
- name: Build the bundles
233238
env:
234239
# One target directory for every family, so later families reuse
235-
# testkit-ready and the dependencies the first one built.
240+
# testkit-ready and the dependencies the first one built. It is the
241+
# root target directory, which setup-rust caches.
236242
CARGO_TARGET_DIR: ${{ github.workspace }}/target
237243
# Every row downloads the bundles. Line tables keep backtraces
238244
# readable at a third of the size of full debuginfo.

‎.github/workflows/rust-cache.yml‎

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33

44
name: Rust Cache
55

6-
# Branch Checks never runs on main, so this saves the rust-checks cache that PR
7-
# mirrors and merge groups restore. Keep env and build commands aligned with
8-
# the Branch Checks rust-test job so the cache keys and contents match.
6+
# Branch Checks and Branch E2E never run on main, so this saves the Rust
7+
# caches that PR mirrors and merge groups restore. Keep each job's env and
8+
# build commands aligned with the job that restores its cache, so the cache
9+
# keys and contents match.
910
on:
1011
push:
1112
branches:
@@ -65,3 +66,37 @@ jobs:
6566
cargo nextest run --locked --profile ci --workspace --features openshell-server/test-support --no-run
6667
cargo nextest run --locked --config-file .config/nextest.toml --profile ci --manifest-path examples/supervisor-middleware-content-guard/Cargo.toml --no-run
6768
cargo nextest run --locked --config-file .config/nextest.toml --profile ci --manifest-path tests/testkit/Cargo.toml --no-run
69+
70+
# Restored by build-e2e-bundles in branch-e2e.yml.
71+
e2e-bundles:
72+
name: E2E suite bundles cache (x86_64-unknown-linux-musl)
73+
runs-on: linux-amd64-cpu8
74+
timeout-minutes: 60
75+
steps:
76+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
77+
with:
78+
persist-credentials: false
79+
80+
- uses: ./.github/actions/setup-nix
81+
with:
82+
prepare-shell: "true"
83+
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
84+
85+
- id: rust
86+
uses: ./.github/actions/setup-rust
87+
with:
88+
cache-key: e2e-bundles-v1-x86_64-unknown-linux-musl
89+
save-cache: "true"
90+
91+
- name: Build the bundles
92+
if: steps.rust.outputs.cache-hit != 'true'
93+
env:
94+
CARGO_TARGET_DIR: ${{ github.workspace }}/target
95+
CARGO_PROFILE_DEV_DEBUG: line-tables-only
96+
run: |
97+
set -euo pipefail
98+
nix build --no-link .#openshell-test-runner || nix build --no-link .#openshell-test-runner
99+
for family in features drivers/podman; do
100+
nix run .#openshell-test-runner -- build \
101+
--family "$family" --out "$RUNNER_TEMP/e2e-bundles/${family//\//-}"
102+
done

0 commit comments

Comments
 (0)