Rewrite the launcher in MoonBit (old code moves to legacy/) #1
No files matched your search
@@ -46,8 +46,12 @@ jobs:
|
|||||||
needs: test
|
needs: test
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
runs-on: ubuntu-latest
|
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:
|
container:
|
||||||
image: node:22-bookworm
|
image: git.site.latha.org/cluster-services/android-sdk:latest
|
||||||
timeout-minutes: 40
|
timeout-minutes: 40
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- 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
|
## 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.
|
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)}"
|
COMMIT="${GITHUB_SHA:-$(git rev-parse HEAD)}"
|
||||||
|
|
||||||
echo "== tools"
|
echo "== tools"
|
||||||
apt-get update -qq
|
# In the cluster's android-sdk image the JDK, SDK and common tools are already there; on a bare
|
||||||
apt-get install -y -qq --no-install-recommends openjdk-17-jdk-headless unzip zip curl ca-certificates git >/dev/null
|
# image (the documented fallback, e.g. node:22-bookworm) they are installed below.
|
||||||
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
|
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"
|
export PATH="$HOME/.moon/bin:$PATH"
|
||||||
moon update
|
moon update
|
||||||
|
|
||||||
echo "== Android SDK (build-tools and the platform jar only)"
|
SDK="${ANDROID_SDK_ROOT:-${ANDROID_HOME:-/opt/android-sdk}}"
|
||||||
export ANDROID_SDK_ROOT=/opt/android-sdk
|
if [ -f "$SDK/platforms/android-35/android.jar" ] && ls -d "$SDK"/build-tools/35* >/dev/null 2>&1; then
|
||||||
mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools"
|
echo "== Android SDK from the image ($SDK)"
|
||||||
curl -fsSL -o /tmp/cmdline.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
|
else
|
||||||
unzip -q /tmp/cmdline.zip -d "$ANDROID_SDK_ROOT/cmdline-tools"
|
echo "== Android SDK fallback (build-tools and the platform jar only)"
|
||||||
mv "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools" "$ANDROID_SDK_ROOT/cmdline-tools/latest"
|
SDK=/opt/android-sdk
|
||||||
yes | "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" --licenses >/dev/null || true
|
mkdir -p "$SDK/cmdline-tools"
|
||||||
"$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" --install "build-tools;35.0.0" >/dev/null
|
curl -fsSL -o /tmp/cmdline.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
|
||||||
# Only android.jar is needed from the platform: unzipping the whole thing (sdkmanager) is slow.
|
unzip -q /tmp/cmdline.zip -d "$SDK/cmdline-tools"
|
||||||
curl -fsSL -o /tmp/platform.zip https://dl.google.com/android/repository/platform-35_r02.zip
|
mv "$SDK/cmdline-tools/cmdline-tools" "$SDK/cmdline-tools/latest"
|
||||||
mkdir -p "$ANDROID_SDK_ROOT/platforms" && unzip -q /tmp/platform.zip 'android-35/android.jar' -d "$ANDROID_SDK_ROOT/platforms"
|
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)"
|
echo "== build (versionCode $VERSION_CODE)"
|
||||||
android/build.sh ultra-launcher.apk
|
android/build.sh ultra-launcher.apk
|
||||||
|
|||||||
Reference in new issue
Block a user