CI: cache Android SDK/NDK, Gradle, and npm across APK builds
Persist three Docker volumes into the build job (android-sdk, gradle home, npm cache) and enable the Gradle build cache, so repeat builds skip the ~2GB NDK download, Maven dependency resolution, and unchanged native/Kotlin compilation — cutting builds from ~1h to a few minutes after the first run. The runner must whitelist these volumes via config.yaml (container.valid_volumes); deploy-runner.sh now writes that config, pre-creates the volumes, and starts the daemon with --config. Requires re-running deploy-runner.sh on the runner host before the next tag. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
1ca2c38fbf
commit
3583c2e15f
5 changed files with 89 additions and 12 deletions
|
|
@ -61,6 +61,24 @@ mkdir -p "$INSTALL_DIR/data"
|
|||
# The runner image runs as uid/gid 1000 and must own its config dir.
|
||||
chown -R 1000:1000 "$INSTALL_DIR/data"
|
||||
|
||||
# Runner config: allow the build workflow to mount the persistent cache volumes
|
||||
# (Android SDK/NDK, Gradle home, npm cache) so APK builds don't redownload and
|
||||
# recompile everything each run. Without valid_volumes listed, the runner
|
||||
# rejects the workflow's `volumes:` and the job fails.
|
||||
cat > "$INSTALL_DIR/config.yaml" <<'CONFIG'
|
||||
container:
|
||||
valid_volumes:
|
||||
- camptickets-android-sdk
|
||||
- camptickets-gradle
|
||||
- camptickets-npm
|
||||
CONFIG
|
||||
chown 1000:1000 "$INSTALL_DIR/config.yaml"
|
||||
|
||||
# Pre-create the named cache volumes (idempotent).
|
||||
docker volume create camptickets-android-sdk >/dev/null
|
||||
docker volume create camptickets-gradle >/dev/null
|
||||
docker volume create camptickets-npm >/dev/null
|
||||
|
||||
cat > "$INSTALL_DIR/docker-compose.yml" <<COMPOSE
|
||||
services:
|
||||
runner:
|
||||
|
|
@ -72,6 +90,7 @@ services:
|
|||
- "\${DOCKER_GID}"
|
||||
volumes:
|
||||
- ./data:/data
|
||||
- ./config.yaml:/data/config.yaml:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
env_file: .env
|
||||
command:
|
||||
|
|
@ -86,7 +105,7 @@ services:
|
|||
--name "\${RUNNER_NAME}" \\
|
||||
--labels "${JOB_LABEL}"
|
||||
fi
|
||||
exec forgejo-runner daemon
|
||||
exec forgejo-runner daemon --config /data/config.yaml
|
||||
COMPOSE
|
||||
|
||||
# Preserve an existing token line if re-running without a new token.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue