fix(ci): reduce workflow cache churn

- GitHub Actions caching:
  - replace implicit setup-java cache writes with explicit Gradle cache restore/save steps
  - only persist the shared Gradle cache from long-lived develop and release workflows
  - remove the unnecessary QEMU setup from the single-arch smoke build
  - disable QEMU image caching in multi-arch publish workflows to stop repeated binfmt cache entries
- CodeQL workflow:
  - replace the generated advanced template with a pinned repo-owned CodeQL workflow
  - add per-ref concurrency to cancel superseded CodeQL runs before they create more caches
  - restrict dependency caching to Java, using restore-only on pull requests and full caching on long-lived runs
  - disable trap caching and turn off PR overlay database caching to avoid repetitive low-value CodeQL caches
- Validation:
  - validated the edited workflow YAML with yq
  - did not execute the workflows locally
This commit is contained in:
James Cox
2026-04-22 17:26:38 -04:00
committed by Zach Yale
parent 2ad937a761
commit 3f9d3e0d8a
6 changed files with 67 additions and 86 deletions
+25 -1
View File
@@ -12,6 +12,11 @@ on:
required: false
type: boolean
default: true
save_gradle_cache:
description: 'Whether this run should persist the shared Gradle cache'
required: false
type: boolean
default: false
jobs:
backend-tests:
@@ -39,7 +44,17 @@ jobs:
with:
java-version: '25'
distribution: 'temurin'
cache: gradle
- name: Restore Gradle Cache
id: restore_gradle_cache
uses: actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('booklore-api/**/*.gradle*', 'booklore-api/settings.gradle*', 'booklore-api/gradle.properties', 'booklore-api/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
gradle-${{ runner.os }}-
- name: Execute Backend Tests
id: backend_tests
@@ -65,6 +80,15 @@ jobs:
booklore-api/build/test-results/
retention-days: 30
- name: Save Gradle Cache
if: ${{ always() && inputs.save_gradle_cache }}
uses: actions/cache/save@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ steps.restore_gradle_cache.outputs.cache-primary-key }}
- name: Validate Backend Test Results
if: steps.backend_tests.outcome == 'failure'
run: |