ci: apply org-style JDK/Gradle caching to publish-tdlm
Mirror Repository / Mirror to CNB (push) Skipped
Mirror Repository / Mirror to Gitee (push) Skipped
Publish TDLM launcher / publish (push) Skipped
Publish TDLM launcher / noop (push) Successful in 3s
Java CI / build (pull_request) Canceled after 41m50s

cache-jdk, Gitea-safe cache-provider external, and expanded Gradle
home cache — same as ForestryMC/IC2 and the ci-cache-optimize PR.
This commit is contained in:
layue13 committed 2026-11-09 17:31:40 +00:00
1 parent 2dc8f69483
commit b34fd02650
2 files changed
+31 -9

No files matched your search

+23 -7
View File
@@ -21,37 +21,48 @@ jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- uses: actions/checkout@v6
# Same pattern as TDLM ForestryMC/IndustrialCraft2 setup-build: cache the JDK toolchain.
- name: Set up JDK 17
uses: actions/setup-java@v6
with:
distribution: 'liberica'
java-version: '17'
java-package: 'jdk+fx'
cache-jdk: true
# Nest hosts github.com/gradle/actions as actions/gradle-actions.
# On Gitea, setup-gradle's default GitHub Actions cache hits ECONNREFUSED; org repos
# (ForestryMC/IC2) use cache-provider external off github.com and cache Gradle home below.
- name: Setup Gradle
# Nest hosts this under actions/gradle-actions (mirror of github.com/gradle/actions).
# uses: gradle/actions/... makes act clone git.nest…/gradle/actions which is not seeded.
uses: actions/gradle-actions/setup-gradle@v5
with:
cache-cleanup: never
# Only main writes the dependency cache; pull requests read it.
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
# The repository's wrapper downloads Gradle itself, so cache that download too.
- name: Cache Gradle distribution
cache-provider: ${{ github.server_url == 'https://github.com' && 'basic' || 'external' }}
# Cache wrapper + dependency/build caches (covers what setup-gradle skips under external).
- name: Cache Gradle home
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
.gradle/wrapper-neo
key: gradle-dist-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'gradle/wrapper/GradleWrapperNeo.java') }}
key: gradle-home-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'gradle/wrapper/GradleWrapperNeo.java', '**/libs.versions.toml', '**/*.gradle.kts', '**/*.gradle') }}
restore-keys: |
gradle-home-${{ runner.os }}-
- name: Install Xvfb
run: |
# Installing is the slowest setup step, so skip it when the runner already has xvfb, and
# only refresh the package index when a plain install fails.
command -v xvfb-run >/dev/null || sudo apt-get install -y --no-install-recommends xvfb \
|| { sudo apt-get update && sudo apt-get install -y --no-install-recommends xvfb; }
# One Gradle run builds, tests and runs the code and translation checks, so the
# project is configured and compiled once instead of in two workflows.
- name: Build and check with Gradle
@@ -60,26 +71,31 @@ jobs:
JAVA_TOOL_OPTIONS: -Djava.awt.headless=true
MICROSOFT_AUTH_ID: ${{ secrets.MICROSOFT_AUTH_ID }}
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }}
- name: Get short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Upload JAR
uses: actions/upload-artifact@v7
with:
name: HMCL-${{ env.SHORT_SHA }}-jar
path: HMCL/build/libs/HMCL-*.jar
archive: false
- name: Upload EXE
uses: actions/upload-artifact@v7
with:
name: HMCL-${{ env.SHORT_SHA }}-exe
path: HMCL/build/libs/HMCL-*.exe
archive: false
- name: Upload SH
uses: actions/upload-artifact@v7
with:
name: HMCL-${{ env.SHORT_SHA }}-sh
path: HMCL/build/libs/HMCL-*.sh
archive: false
- name: Upload DEB
uses: actions/upload-artifact@v7
with:
+8 -2
View File
@@ -45,25 +45,31 @@ jobs:
steps:
- uses: actions/checkout@v6
# Same caching pattern as gradle.yml / TDLM ForestryMC+IC2 setup-build.
- name: Set up JDK 17 + JavaFX
uses: actions/setup-java@v6
with:
distribution: 'liberica'
java-version: '17'
java-package: 'jdk+fx'
cache-jdk: true
- name: Setup Gradle
uses: actions/gradle-actions/setup-gradle@v5
with:
cache-cleanup: never
cache-provider: ${{ github.server_url == 'https://github.com' && 'basic' || 'external' }}
- name: Cache Gradle distribution
- name: Cache Gradle home
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
.gradle/wrapper-neo
key: gradle-dist-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'gradle/wrapper/GradleWrapperNeo.java') }}
key: gradle-home-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'gradle/wrapper/GradleWrapperNeo.java', '**/libs.versions.toml', '**/*.gradle.kts', '**/*.gradle') }}
restore-keys: |
gradle-home-${{ runner.os }}-
- name: Install Xvfb
run: |