diff --git a/.github/workflows/build-check-features-cache.yml b/.github/workflows/build-check-features-cache.yml new file mode 100644 index 000000000..37230ff81 --- /dev/null +++ b/.github/workflows/build-check-features-cache.yml @@ -0,0 +1,79 @@ +name: Build Check Features Cache + +permissions: + contents: read + actions: write + +on: + workflow_dispatch: + push: + branches: + - "main" + paths: + - "src/**" + - "Cargo.toml" + - "Cargo.lock" + - "rust-toolchain.toml" + - "tests/fixtures/**" + - "static/**" + - ".sqlx/**" + +env: + CACHE_CHECK_KEY: check-features-release + CACHE_PATH: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + +jobs: + build_check_features_cache: + name: Build Check Features cache + runs-on: stratus-runner + timeout-minutes: 45 + + concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + + steps: + - name: Checkout code + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + + - name: Set up Rust + run: rustup show + + - name: Rust Cache - Restore check-features cache + uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: ${{ env.CACHE_PATH }} + key: ${{ env.CACHE_CHECK_KEY }}-${{ runner.os }}--${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ env.CACHE_CHECK_KEY }}-${{ runner.os }}-- + + - name: Install libsasl2-dev libssl-dev + run: sudo apt-get update && sudo apt install -y build-essential pkg-config libssl-dev libsasl2-dev + + - name: Set up dependencies + uses: taiki-e/install-action@cfdb446e391c69574ebc316dfb7d7849ec12b940 # v2.68.8 + with: + tool: cargo-hack@0.6.39 + + - name: Set up Just + uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2 + + - name: Prime check-features cache + # Runs the exact same command (`just check-features`) with the same env as the + # PR check-features job, so the `.rmeta` fingerprints produced here are reused + # on cache restore. No coverage flags in either side, so RUSTFLAGS matches by + # inheritance — do not override it here, that would diverge from the consumer. + run: just check-features + env: + CARGO_PROFILE_RELEASE_DEBUG: 0 + RUST_LOG: error + RELEASE: 1 + + - name: Rust Cache - Save check-features cache + uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: ${{ env.CACHE_PATH }} + key: ${{ env.CACHE_CHECK_KEY }}-${{ runner.os }}--${{ hashFiles('**/Cargo.lock') }} diff --git a/.github/workflows/build-debug-cache.yml b/.github/workflows/build-debug-cache.yml index e49afa9ca..183b83e90 100644 --- a/.github/workflows/build-debug-cache.yml +++ b/.github/workflows/build-debug-cache.yml @@ -54,7 +54,7 @@ jobs: - name: Set up dependencies uses: taiki-e/install-action@cfdb446e391c69574ebc316dfb7d7849ec12b940 # v2.68.8 with: - tool: cargo-llvm-cov@0.6.14 + tool: cargo-llvm-cov@0.6.14 cargo-hack@0.6.39 - name: Build Debug binaries for cache # Prime the cache with exactly what consumers need: @@ -68,6 +68,16 @@ jobs: cargo test --no-run cargo build --features dev + - name: Check all features + # Prime the cache with `.rmeta` artifacts for every feature combination the + # check-features job tests (`cargo hack check --each-feature`), so all 11 runs + # hit Fresh on PRs instead of rechecking ~450 crates per combo. Run WITHOUT + # coverage flags — check-features doesn't use them, and RUSTFLAGS is part of the + # fingerprint, so mismatched flags would force a full recheck. + env: + RUSTFLAGS: "" + run: cargo hack check --each-feature --keep-going + - name: Rust Cache - Save shared key uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: diff --git a/.github/workflows/check-features.yml b/.github/workflows/check-features.yml index 65ad5fc37..e10870b17 100644 --- a/.github/workflows/check-features.yml +++ b/.github/workflows/check-features.yml @@ -23,7 +23,7 @@ on: workflow_dispatch: env: - CACHE_SHARED_KEY: stable-release + CACHE_CHECK_KEY: check-features-release CACHE_PATH: | ~/.cargo/registry/index/ ~/.cargo/registry/cache/ @@ -47,12 +47,12 @@ jobs: - name: Set up Rust run: rustup show - - name: Rust Cache - Restore shared key + - name: Rust Cache - Restore check-features cache uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: ${{ env.CACHE_PATH }} - restore-keys: ${{ env.CACHE_SHARED_KEY }} - key: ${{ env.CACHE_SHARED_KEY }} + key: ${{ env.CACHE_CHECK_KEY }}-${{ runner.os }}--${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ env.CACHE_CHECK_KEY }}-${{ runner.os }}-- - name: Install libsasl2-dev libssl-dev run: sudo apt-get update && sudo apt install -y build-essential pkg-config libssl-dev libsasl2-dev