ci: bump setup-gradle to v6 and cache apt xvfb debs
Match the ci-cache-optimize PR: v6 understands cache-provider; cache apt debs for xvfb alongside Gradle home.
This commit is contained in:
1 parent
b34fd02650
commit
7be9d56e66
2 files changed
+39
-9
No files matched your search
@@ -35,11 +35,11 @@ jobs:
|
||||
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.
|
||||
# Nest mirrors github.com/gradle/actions as actions/gradle-actions (also as gradle/actions).
|
||||
# v5 rejects cache-provider; v6 supports it. Default on v6 is "enhanced" (commercial) —
|
||||
# on Gitea use external and cache Gradle home with actions/cache below (org IC2/Forestry pattern).
|
||||
- name: Setup Gradle
|
||||
uses: actions/gradle-actions/setup-gradle@v5
|
||||
uses: actions/gradle-actions/setup-gradle@v6
|
||||
with:
|
||||
cache-cleanup: never
|
||||
cache-provider: ${{ github.server_url == 'https://github.com' && 'basic' || 'external' }}
|
||||
@@ -56,12 +56,27 @@ jobs:
|
||||
restore-keys: |
|
||||
gradle-home-${{ runner.os }}-
|
||||
|
||||
# xvfb apt debs — avoids apt-get update+download on every cold container when Actions cache works.
|
||||
- name: Cache apt packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/apt-cache
|
||||
key: apt-xvfb-${{ runner.os }}-${{ runner.arch }}
|
||||
|
||||
- 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 \
|
||||
if command -v xvfb-run >/dev/null; then
|
||||
exit 0
|
||||
fi
|
||||
sudo mkdir -p /var/cache/apt/archives/partial
|
||||
if [ -d "${HOME}/apt-cache" ] && [ -n "$(ls -A "${HOME}/apt-cache" 2>/dev/null)" ]; then
|
||||
sudo cp -a "${HOME}/apt-cache/." /var/cache/apt/archives/
|
||||
fi
|
||||
# Prefer offline/cached debs first; only refresh the index when that fails.
|
||||
sudo apt-get install -y --no-install-recommends xvfb \
|
||||
|| { sudo apt-get update && sudo apt-get install -y --no-install-recommends xvfb; }
|
||||
mkdir -p "${HOME}/apt-cache"
|
||||
cp -a /var/cache/apt/archives/*.deb "${HOME}/apt-cache/" 2>/dev/null || true
|
||||
|
||||
# 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.
|
||||
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
cache-jdk: true
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: actions/gradle-actions/setup-gradle@v5
|
||||
uses: actions/gradle-actions/setup-gradle@v6
|
||||
with:
|
||||
cache-cleanup: never
|
||||
cache-provider: ${{ github.server_url == 'https://github.com' && 'basic' || 'external' }}
|
||||
@@ -71,10 +71,25 @@ jobs:
|
||||
restore-keys: |
|
||||
gradle-home-${{ runner.os }}-
|
||||
|
||||
- name: Cache apt packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/apt-cache
|
||||
key: apt-xvfb-${{ runner.os }}-${{ runner.arch }}
|
||||
|
||||
- name: Install Xvfb
|
||||
run: |
|
||||
command -v xvfb-run >/dev/null || sudo apt-get install -y --no-install-recommends xvfb \
|
||||
if command -v xvfb-run >/dev/null; then
|
||||
exit 0
|
||||
fi
|
||||
sudo mkdir -p /var/cache/apt/archives/partial
|
||||
if [ -d "${HOME}/apt-cache" ] && [ -n "$(ls -A "${HOME}/apt-cache" 2>/dev/null)" ]; then
|
||||
sudo cp -a "${HOME}/apt-cache/." /var/cache/apt/archives/
|
||||
fi
|
||||
sudo apt-get install -y --no-install-recommends xvfb \
|
||||
|| { sudo apt-get update && sudo apt-get install -y --no-install-recommends xvfb; }
|
||||
mkdir -p "${HOME}/apt-cache"
|
||||
cp -a /var/cache/apt/archives/*.deb "${HOME}/apt-cache/" 2>/dev/null || true
|
||||
|
||||
- name: Build executables
|
||||
run: xvfb-run --auto-servernum ./gradlew :HMCL:makeExecutables --no-daemon --parallel
|
||||
|
||||
Reference in new issue
Block a user