CI: build the APK in the cluster's android-sdk image
apk job uses git.site.latha.org/cluster-services/android-sdk:latest; gitea-apk.sh uses the image's JDK/SDK when present and falls back to installing them (documented, for use with node:22-bookworm until the image is built). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
67b6b58c94
commit
a8ce535f37
3 files changed
+30
-16
No files matched your search
@@ -46,8 +46,12 @@ jobs:
|
||||
needs: test
|
||||
if: github.event_name != 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
# JDK 17 + Android SDK (platforms;android-35, build-tools 35.0.0, NDK) prebuilt by
|
||||
# charts/android-sdk in nandi/cluster, so no per-run SDK download. Fallback until that image
|
||||
# is built and pullable: use `node:22-bookworm` here; ci/gitea-apk.sh then installs the JDK
|
||||
# and downloads the SDK pieces itself.
|
||||
container:
|
||||
image: node:22-bookworm
|
||||
image: git.site.latha.org/cluster-services/android-sdk:latest
|
||||
timeout-minutes: 40
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -80,7 +80,7 @@ To try the page in a desktop browser: `scripts/build-web.sh --demo && python3 -m
|
||||
|
||||
## CI and releases
|
||||
|
||||
`.gitea/workflows/launcher.yml`: a `test` job (MoonBit installed like in identicons-web, inside `node:22-bookworm`; `moon test` on js and wasm-gc, then the Playwright tests) and, on push to `main`, an `apk` job running `ci/gitea-apk.sh`, which builds the APK and publishes a Gitea release `build-<versionCode>` holding `ultra-launcher.apk` and `version.json` (a draft first, published once both files are up). The installed app compares that `versionCode` with its own and installs the newer APK. No `actions/setup-node`, no docker, every job has a `timeout-minutes`.
|
||||
`.gitea/workflows/launcher.yml`: a `test` job (MoonBit installed like in identicons-web, inside `node:22-bookworm`; `moon test` on js and wasm-gc, then the Playwright tests) and, on push to `main`, an `apk` job (container `git.site.latha.org/cluster-services/android-sdk:latest` from `charts/android-sdk` in nandi/cluster: JDK 17 + SDK 35, no per-run download; swap in `node:22-bookworm` as a fallback until it exists, the script then downloads the SDK itself) running `ci/gitea-apk.sh`, which builds the APK and publishes a Gitea release `build-<versionCode>` holding `ultra-launcher.apk` and `version.json` (a draft first, published once both files are up). The installed app compares that `versionCode` with its own and installs the newer APK. No `actions/setup-node`, no docker, every job has a `timeout-minutes`.
|
||||
|
||||
Releases of the app's version are managed with [sweet](https://github.com/chattocorp/sweet-release): `.sweet.config.yml` (feature → minor, fix/performance → patch, chore/refactor → none) and `.sweet.yml` (`moon.mod`'s `version` line is annotated `// sweet-version`). The Android `versionName` is read from `moon.mod` by the build, so that is the one file that carries the version.
|
||||
|
||||
|
||||
+24
-14
@@ -13,23 +13,33 @@ export VERSION_CODE=$(( $(date +%s) / 60 ))
|
||||
COMMIT="${GITHUB_SHA:-$(git rev-parse HEAD)}"
|
||||
|
||||
echo "== tools"
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq --no-install-recommends openjdk-17-jdk-headless unzip zip curl ca-certificates git >/dev/null
|
||||
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
|
||||
# In the cluster's android-sdk image the JDK, SDK and common tools are already there; on a bare
|
||||
# image (the documented fallback, e.g. node:22-bookworm) they are installed below.
|
||||
if ! command -v javac >/dev/null || ! command -v zip >/dev/null || ! command -v curl >/dev/null; then
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq --no-install-recommends openjdk-17-jdk-headless unzip zip curl ca-certificates git >/dev/null
|
||||
fi
|
||||
command -v moon >/dev/null || [ -x "$HOME/.moon/bin/moon" ] || curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
|
||||
export PATH="$HOME/.moon/bin:$PATH"
|
||||
moon update
|
||||
|
||||
echo "== Android SDK (build-tools and the platform jar only)"
|
||||
export ANDROID_SDK_ROOT=/opt/android-sdk
|
||||
mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools"
|
||||
curl -fsSL -o /tmp/cmdline.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
|
||||
unzip -q /tmp/cmdline.zip -d "$ANDROID_SDK_ROOT/cmdline-tools"
|
||||
mv "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools" "$ANDROID_SDK_ROOT/cmdline-tools/latest"
|
||||
yes | "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" --licenses >/dev/null || true
|
||||
"$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" --install "build-tools;35.0.0" >/dev/null
|
||||
# Only android.jar is needed from the platform: unzipping the whole thing (sdkmanager) is slow.
|
||||
curl -fsSL -o /tmp/platform.zip https://dl.google.com/android/repository/platform-35_r02.zip
|
||||
mkdir -p "$ANDROID_SDK_ROOT/platforms" && unzip -q /tmp/platform.zip 'android-35/android.jar' -d "$ANDROID_SDK_ROOT/platforms"
|
||||
SDK="${ANDROID_SDK_ROOT:-${ANDROID_HOME:-/opt/android-sdk}}"
|
||||
if [ -f "$SDK/platforms/android-35/android.jar" ] && ls -d "$SDK"/build-tools/35* >/dev/null 2>&1; then
|
||||
echo "== Android SDK from the image ($SDK)"
|
||||
else
|
||||
echo "== Android SDK fallback (build-tools and the platform jar only)"
|
||||
SDK=/opt/android-sdk
|
||||
mkdir -p "$SDK/cmdline-tools"
|
||||
curl -fsSL -o /tmp/cmdline.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
|
||||
unzip -q /tmp/cmdline.zip -d "$SDK/cmdline-tools"
|
||||
mv "$SDK/cmdline-tools/cmdline-tools" "$SDK/cmdline-tools/latest"
|
||||
yes | "$SDK/cmdline-tools/latest/bin/sdkmanager" --licenses >/dev/null || true
|
||||
"$SDK/cmdline-tools/latest/bin/sdkmanager" --install "build-tools;35.0.0" >/dev/null
|
||||
# Only android.jar is needed from the platform: unzipping the whole thing (sdkmanager) is slow.
|
||||
curl -fsSL -o /tmp/platform.zip https://dl.google.com/android/repository/platform-35_r02.zip
|
||||
mkdir -p "$SDK/platforms" && unzip -q /tmp/platform.zip 'android-35/android.jar' -d "$SDK/platforms"
|
||||
fi
|
||||
export ANDROID_SDK_ROOT="$SDK"
|
||||
|
||||
echo "== build (versionCode $VERSION_CODE)"
|
||||
android/build.sh ultra-launcher.apk
|
||||
|
||||
Reference in new issue
Block a user