diff --git a/.gitea/actions/setup-java-gradle/action.yml b/.gitea/actions/setup-java-gradle/action.yml index 00aba415..867704df 100644 --- a/.gitea/actions/setup-java-gradle/action.yml +++ b/.gitea/actions/setup-java-gradle/action.yml @@ -11,9 +11,27 @@ description: >- # and a pinned commit SHA, the only immutable action reference. The JDK is the version in # .tool-versions under the name Temurin publishes it (`+10.0.LTS`); setup-java rejects `+10`. +# The JDK comes from the runner's cache when it can. Every job starts in a fresh container, so +# setup-java found an empty tool cache and downloaded the same 190 MB from GitHub in every job (about +# 22 of the 25 seconds a job spent before Gradle, and the step that failed with 504s). setup-java +# looks in the tool cache first, so restoring the directory it installs into is enough. A pull +# request only reads the entry, so code under review cannot put a JDK in it; a push, a schedule or +# a manual run, which only a writer can start, may save it. The key names one Temurin build, so the +# entry is the same whichever branch saves it. setup-gradle below is stricter (main only), because +# a Gradle home differs by branch. runs: using: composite steps: + - if: ${{ github.event_name != 'pull_request' }} + uses: https://github.com/actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # actions/cache@v4.3.0 + with: + path: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk + key: jdk-temurin-21.0.11+10.0.LTS-${{ runner.os }}-${{ runner.arch }} + - if: ${{ github.event_name == 'pull_request' }} + uses: https://github.com/actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # actions/cache/restore@v4.3.0 + with: + path: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk + key: jdk-temurin-21.0.11+10.0.LTS-${{ runner.os }}-${{ runner.arch }} - uses: https://github.com/actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # actions/setup-java@v4.7.1 with: distribution: temurin