From b6e1781ef5f137ae88c9ff0bedb546b46dfbaf64 Mon Sep 17 00:00:00 2001 From: Marty Pitt Date: Fri, 7 Aug 2026 06:20:22 +0100 Subject: [PATCH] CI: keep the Maven cache warm so builds stop re-downloading Central The repo often goes quiet for longer than the 7-day Actions cache eviction window, so every build started cold and re-downloaded the full dependency tree. Add a twice-weekly cache-warmer job to keep the cache alive, drop the redundant second cache step (setup-java's cache:maven already covers ~/.m2/repository), parallelise artifact downloads for the cold case, and allow manual builds via workflow_dispatch. Co-Authored-By: Claude Fable 5 --- .github/workflows/build.yml | 10 +++----- .github/workflows/warm-maven-cache.yml | 32 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/warm-maven-cache.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3777ca3..49c5e82 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,8 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + # Manual runs: on main this publishes orbitalhq/nebula:next, same as a push build + workflow_dispatch: jobs: build-jvm: @@ -18,14 +20,8 @@ jobs: java-version: '21' distribution: 'temurin' cache: maven - - name: Cache Maven packages - uses: actions/cache@v4 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - name: Deploy with Maven - run: mvn clean deploy --settings .mvn/settings.xml + run: mvn clean deploy -B -ntp -Dmaven.artifact.threads=16 --settings .mvn/settings.xml env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/warm-maven-cache.yml b/.github/workflows/warm-maven-cache.yml new file mode 100644 index 0000000..8ea5291 --- /dev/null +++ b/.github/workflows/warm-maven-cache.yml @@ -0,0 +1,32 @@ +name: Warm Maven cache + +# GitHub evicts any Actions cache that hasn't been accessed for 7 days. +# This repo often goes quiet for weeks at a time, so builds routinely start +# with a cold cache and re-download every artifact from Maven Central. +# This job touches the cache twice a week (and rebuilds it when poms change), +# keeping it inside the eviction window so real builds restore it instead. +# +# Note: GitHub auto-disables scheduled workflows after 60 days without repo +# activity - re-enable it from the Actions tab if the repo has been dormant. + +on: + schedule: + - cron: '17 5 * * 1,4' # Mon + Thu, comfortably inside the 7-day window + workflow_dispatch: + +jobs: + warm-cache: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: maven + - name: Resolve dependencies + run: mvn -B -ntp -Dmaven.artifact.threads=16 dependency:go-offline --settings .mvn/settings.xml + env: + JOOQ_REPO_USERNAME: ${{ secrets.JOOQ_REPO_USERNAME }} + JOOQ_REPO_PASSWORD: ${{ secrets.JOOQ_REPO_PASSWORD }}