ci: thin CI image, Android SDK packages from actions/cache
build / ci-image (push) Successful in 6m8s
build / build (push) Successful in 30m19s

With the NDKs baked in the CI image was 14 G in grg-runner's 48 G
RAM-backed image store: it filled the store (run 54264, Gradle "No space
left on device") and the runner cleanup evicts such images under
pressure, so it would have been rebuilt most runs.

The image is now Flutter + node + cache paths only (seconds to build);
the SDK packages Gradle installs (NDKs, CMake, build-tools, platform)
are their own actions/cache entry, stored on the runner's disk, keyed by
the Gradle build files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-10-26 10:30:33 +01:00
1 parent 3bdb46c815
commit 05afa912c4
2 files changed
+41 -30

No files matched your search

+16 -22
View File
@@ -1,35 +1,29 @@
# CI image for the `build` job (.gitea/workflows/build.yml): the Flutter image # CI image for the `build` job (.gitea/workflows/build.yml): the Flutter image
# plus everything the release build used to download on EVERY run - the # plus node (actions/cache is a JS action; the image has node 18 only) and
# Android SDK packages Gradle auto-installs (two NDKs, build-tools, platform, # fixed paths for the Gradle and pub caches.
# CMake: ~4 min) and Flutter's Android engine artifacts - and node for JS #
# actions (actions/cache restores the Gradle and pub caches). # Deliberately thin. The big downloads - the Android SDK packages Gradle
# auto-installs (two NDKs, CMake, ~4 min) and Gradle's dependencies - are
# restored by actions/cache, whose store is on the runner's disk. Baking the
# NDKs in made a 14 G image in the runner's 48 G RAM-backed image store
# (grg-runner); its cleanup evicts such images under pressure, so it would be
# rebuilt most runs, and on 2026-10-26 it filled the store (Gradle: "No space
# left on device").
# #
# Built by the `ci-image` job, tagged by a hash of this file, into the local # Built by the `ci-image` job, tagged by a hash of this file, into the local
# Docker of the `big` runner; a Renovate bump of either base digest rebuilds # Docker of the `big` runner; a Renovate bump of either base digest rebuilds
# it. When upstream moves to a different NDK the build still works (Gradle # it (seconds - only node is added on top of the Flutter image).
# installs it), just slower - the "SDK packages" step of the build job warns
# about it, then update the list below.
FROM node:24-trixie-slim@sha256:43b9ba1142b8dcf33fa8f922ca1be85714adc444e0586c7cf7726daaeabc1bea AS node FROM node:24-trixie-slim@sha256:43b9ba1142b8dcf33fa8f922ca1be85714adc444e0586c7cf7726daaeabc1bea AS node
FROM ghcr.io/cirruslabs/flutter:stable@sha256:46691e311715845de03a3ba4753a475476936805b29431b1f00f1816981033f8 FROM ghcr.io/cirruslabs/flutter:stable@sha256:46691e311715845de03a3ba4753a475476936805b29431b1f00f1816981033f8
COPY --from=node /usr/local/bin/node /usr/local/bin/node COPY --from=node /usr/local/bin/node /usr/local/bin/node
# Gradle and pub caches at fixed paths: the build job restores/saves exactly # Fixed cache paths: the build job restores/saves exactly these (HOME inside
# these with actions/cache (HOME inside a job container is not reliably # a job container is not reliably /root, and Gradle takes its home from
# /root, and Gradle takes its home from passwd, not $HOME). Gradle's build # passwd, not $HOME). Gradle's build cache lives in there too.
# cache lives in there too, so unchanged plugin modules are not recompiled.
ENV GRADLE_USER_HOME=/ci-cache/gradle \ ENV GRADLE_USER_HOME=/ci-cache/gradle \
PUB_CACHE=/ci-cache/pub PUB_CACHE=/ci-cache/pub
RUN mkdir -p "$GRADLE_USER_HOME" "$PUB_CACHE" \ RUN mkdir -p "$GRADLE_USER_HOME" "$PUB_CACHE" \
&& echo 'org.gradle.caching=true' >"$GRADLE_USER_HOME/gradle.properties" && echo 'org.gradle.caching=true' >"$GRADLE_USER_HOME/gradle.properties" \
&& node --version
RUN yes | sdkmanager --licenses >/dev/null \
&& sdkmanager --install \
"ndk;29.0.14206865" \
"ndk;28.2.13676358" \
"build-tools;35.0.0" \
"platforms;android-35" \
"cmake;3.22.1" \
&& flutter precache --android \
&& node --version && flutter --version
+25 -8
View File
@@ -41,9 +41,8 @@ defaults:
shell: bash shell: bash
jobs: jobs:
# CI image (.gitea/ci/Dockerfile: Flutter + the Android SDK packages and # CI image (.gitea/ci/Dockerfile: Flutter + node for actions/cache, cache
# engine artifacts every build used to download, ~4 min) tagged by a hash # paths) tagged by a hash of its Dockerfile. Built straight into the Docker of the `big` runner
# of its Dockerfile. Built straight into the Docker of the `big` runner
# (grg-runner, the only one with that label) and never pushed: the job # (grg-runner, the only one with that label) and never pushed: the job
# container below then starts from the local image. If the image is gone # container below then starts from the local image. If the image is gone
# (prune), this job just builds it again. # (prune), this job just builds it again.
@@ -128,6 +127,23 @@ jobs:
echo "needed=true" >>"$GITHUB_OUTPUT" echo "needed=true" >>"$GITHUB_OUTPUT"
fi fi
# Android SDK packages Gradle installs on demand (two NDKs, CMake,
# build-tools, platform: ~4 min of downloads per build). Own cache entry:
# ~5 G that changes only with the NDK pin, not with every pubspec.lock.
# A new package (upstream moved on) is installed by Gradle and saved
# under the new key; the build step warns about it.
- name: Android SDK packages cache
if: steps.rel.outputs.needed == 'true'
uses: actions/cache@v6
with:
path: |
/opt/android-sdk-linux/ndk
/opt/android-sdk-linux/cmake
/opt/android-sdk-linux/build-tools
/opt/android-sdk-linux/platforms
key: android-sdk-${{ hashFiles('android/app/build.gradle.kts', 'android/build.gradle.kts', 'android/settings.gradle.kts') }}
restore-keys: android-sdk-
# Gradle (deps, wrapper, build cache) and pub caches; the paths are set # Gradle (deps, wrapper, build cache) and pub caches; the paths are set
# in .gitea/ci/Dockerfile. Without it Gradle spent ~17 min per build. # in .gitea/ci/Dockerfile. Without it Gradle spent ~17 min per build.
- name: Gradle and pub cache - name: Gradle and pub cache
@@ -138,8 +154,8 @@ jobs:
/ci-cache/gradle/caches /ci-cache/gradle/caches
/ci-cache/gradle/wrapper /ci-cache/gradle/wrapper
/ci-cache/pub /ci-cache/pub
key: android-${{ hashFiles('pubspec.lock', 'android/**/*.gradle.kts', 'android/gradle/wrapper/gradle-wrapper.properties') }} key: gradle-pub-${{ hashFiles('pubspec.lock', 'android/**/*.gradle.kts', 'android/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: android- restore-keys: gradle-pub-
- name: Tests - name: Tests
if: steps.rel.outputs.needed == 'true' if: steps.rel.outputs.needed == 'true'
@@ -187,10 +203,11 @@ jobs:
code=$((($(date -u +%s) - 1767225600) / 60)) code=$((($(date -u +%s) - 1767225600) / 60))
flutter build apk --release --no-pub --target-platform android-arm64 \ flutter build apk --release --no-pub --target-platform android-arm64 \
--build-name "$name" --build-number "$code" 2>&1 | tee "$RUNNER_TEMP/build.log" --build-name "$name" --build-number "$code" 2>&1 | tee "$RUNNER_TEMP/build.log"
# The CI image should already hold every SDK package; an install here # With a warm SDK cache Gradle installs nothing; an install means the
# means upstream moved on (new NDK, ...) - update .gitea/ci/Dockerfile. # cache was cold or upstream moved on (new NDK, ...) - the next run
# restores it from the cache saved by this one.
if grep '^Installing ' "$RUNNER_TEMP/build.log"; then if grep '^Installing ' "$RUNNER_TEMP/build.log"; then
echo "::warning::Gradle installed SDK packages missing from .gitea/ci/Dockerfile (see above)" echo "::warning::Gradle installed Android SDK packages (cold cache or a new pin, see above)"
fi fi
rm -f android/key.properties "$ks" rm -f android/key.properties "$ks"
apk="$RUNNER_TEMP/meshcore-open-$name-arm64.apk" apk="$RUNNER_TEMP/meshcore-open-$name-arm64.apk"