chore(ci): optimize workflow performance with caching and path filters#773
Merged
chore(ci): optimize workflow performance with caching and path filters#773
Conversation
33197ab to
35328b2
Compare
dvgui
previously approved these changes
Dec 19, 2025
nvsriram
reviewed
Dec 19, 2025
679ede1 to
321eeb5
Compare
- Add path filters to all workflows to skip unnecessary CI runs - Add concurrency groups to cancel in-progress runs on new commits - Parallelize EVM and Solana test jobs where possible - Move Solana jobs from tilt-kube-public to ubuntu-latest
- Add Dockerfile.anchor-base with Solana toolchain and Anchor - Add anchor-base.yml reusable workflow to build/cache the image - Image is pushed to ghcr.io and reused across CLI workflow jobs
- Split Solana v1/v2 contract builds into parallel jobs - Cache pre-built .so artifacts between runs using GHA cache - Use fixed test program keypair for reproducible builds - Add Dockerfile.cli-test-evm and Dockerfile.cli-test-solana - Run test-solana directly in container with proper environment - Cache key includes all build dependencies (scripts, Dockerfiles, Anchor.toml)
- Add tilt-images.yml to pre-build Solana/EVM contract images - Make Tilt CI depend on tilt-images for warm Docker cache - Add Docker layer caching for Tilt CI builds - Remove dead devnet/** path filter (directory doesn't exist)
- Add maxRetries parameter (default 60 = 2 minutes) - Throw error after max retries instead of hanging forever - Improve logging with attempt counter
…uild - Upload SBF program artifacts from solana-sbf job - Download pre-built .so files in anchor-test instead of rebuilding - Remove 9+ minute anchor build that duplicated solana-sbf work - Remove unnecessary Cargo toolchain/cache steps from anchor-test - Build only TypeScript SDK (fast) instead of full make sdk
- Add SBF artifact cache keyed on Cargo.lock + source files hash - Skip build step entirely when cache hits (saves ~3.5 min) - Build only runs when Solana source code actually changes - Tests still run every time to verify correctness
Reverts the misguided attempt to share artifacts between solana-sbf and anchor-test jobs. These jobs are designed to run in parallel: - solana-sbf: uses cargo build-sbf, runs cargo test-sbf - anchor-test: uses anchor build (via make sdk), runs anchor test Each job needs to build its own artifacts because: - anchor-test needs IDL files that only anchor build generates - The jobs test different things and should run in parallel Keeps the SBF artifact caching optimization for solana-sbf job which skips the build when Solana source code hasn't changed.
The 'export' stage (FROM scratch) doesn't work for Tilt because Dockerfile.test-validator does COPY --from=ntt-solana-contract and requires the full builder filesystem. Reverting to 'builder' target while keeping cache_from for layer caching benefits.
… build The actions/cache@v4 was caching an empty directory (200 bytes) because it saves/restores in the same step. When the cache "hit", it restored nothing useful, causing tests to fail with "Program file data not available". Fix: - Split into actions/cache/restore@v4 (restore-only) - Add verification step to check for actual .so files - Use verification output for build condition instead of cache-hit - Add separate actions/cache/save@v4 step after successful build
…parameterized script - Merge build-solana-v1.sh and build-solana-v2.sh into build-solana.sh - Script now takes version as argument (e.g., build-solana.sh 1.0.0) - Update CLI workflow to use matrix strategy for parallel builds - Fix artifact naming to match upload/download (solana-v1.0.0-artifacts)
321eeb5 to
092321a
Compare
dvgui
approved these changes
Dec 19, 2025
nvsriram
approved these changes
Dec 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Comprehensive CI optimization to reduce build times and eliminate redundant work across all workflows.
Key Optimizations
Results
Architecture
Files Changed
New Files:
Dockerfile.anchor-base- Pre-compiles Anchor 0.29.0Dockerfile.cli-test-evm- Thin test layer for EVMDockerfile.cli-test-solana- Thin test layer for Solana.github/workflows/anchor-base.yml- Reusable workflow for anchor-base image.github/workflows/tilt-images.yml- Pre-builds Solana/EVM contract imagescli/test/build-solana-v1.sh- Builds v1.0.0 with fixed test program IDcli/test/build-solana-v2.sh- Builds v2.0.0 with fixed test program IDModified:
Dockerfile.cli- Uses pre-built anchor binaries, copies avm wrapper.github/workflows/cli.yml- Registry-based build sharing, anchor-base integration, parallel Solana builds with GHA caching.github/workflows/tilt.yml- Path filters, ghcr.io login for cache.github/workflows/evm.yml- Path filters, parallel lint, concurrency.github/workflows/solana.yml- ubuntu-latest, parallel tests, concurrency, SBF cache validation.github/workflows/sdk.yml- Path filters, concurrency.github/workflows/prettier.yml- Path filters, concurrencyTiltfile- Target builder stage, cache_from for registry cachingcli/test/solana.sh- Uses pre-built artifacts via --binary flag when availablesdk/__tests__/utils.ts- Fixed infinite loop in waitForRelay(), serialized peer registrationBug Fixes
SDK flaky tests (waitForRelay): Fixed infinite loop in
waitForRelay()that caused tests to hang. AddedmaxRetriesparameter (default 60 attempts / 2 minutes).SDK nonce collisions (Tilt CI): Fixed
NONCE_EXPIREDerrors in Tilt CI tests. Thelink()function was registering peers in parallel usingPromise.all. When EVM chains share the same signer, concurrent transactions cause nonce collisions. Changed to sequentialfor...ofloop.Anchor version mismatch: Fixed avm wrapper not being copied from anchor-base. The backpackapp base image ships anchor 0.30.1, and we need to overwrite it with the avm wrapper that delegates to 0.29.0.
Program ID mismatch: Pre-built Solana binaries have program IDs baked in at compile time. Build scripts now patch Anchor.toml and lib.rs with a fixed test program ID before building, and solana.sh uses the corresponding keypair from artifacts.
Tilt image target: Changed Solana Tilt image from
export(scratch) back tobuildertarget. TheDockerfile.test-validatorusesCOPY --from=ntt-solana-contractand requires the full builder filesystem, not a minimal scratch image.SBF cache validation: Fixed empty cache causing test failures.
actions/cache@v4was caching an empty directory (200 bytes) because it saves/restores in the same step. Split intoactions/cache/restore@v4+ verification step +actions/cache/save@v4to ensure we only skip builds when cache contains actual.sofiles.