Move build and releases to the Gitea forge
Launcher / apk (push) Failing after 7s

This commit is contained in:
nandi committed 2026-11-18 19:57:20 +00:00
1 parent c89c6a7e53
commit 72c5f75939
6 files changed
+77 -70

No files matched your search

-19
View File
@@ -1,19 +0,0 @@
#!/usr/bin/env bash
# Builds the WASI launcher component (wasi/) and the wasmtime runtime APK (android-wasm/).
set -euo pipefail
cd /src
export PIXI_HOME=/opt/pixi
curl -fsSL https://pixi.sh/install.sh | bash
export PATH="$PIXI_HOME/bin:$PATH"
pixi run --manifest-path wasi/pixi.toml build
mkdir -p android-wasm/assets
cp wasi/build/launcher.wasm android-wasm/assets/launcher.wasm
curl -fsSL https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal --target aarch64-linux-android
export PATH="$HOME/.cargo/bin:$PATH"
cargo install cargo-apk --version 0.10.0 --locked
bash android-wasm/build.sh
cp android-wasm/target/release/apk/ultra-launcher-wasm.apk ultra-launcher-wasm.apk
+30 -18
View File
@@ -1,19 +1,22 @@
#!/usr/bin/env bash
# Builds the Qt launcher APK (qt/) and publishes it as a forge release: build-<versionCode>,
# holding ultra-launcher.apk and version.json, made a draft first and published once both
# files are up, so releases/latest never lacks them. Runs in .forge/jobs.toml's "apk" job.
# Tests the Qt launcher (qt/), builds its APK and publishes it as a Gitea release:
# build-<versionCode>, holding ultra-launcher.apk and version.json, made a draft first
# and published once both files are up, so the latest release never lacks them.
# Runs in .gitea/workflows/launcher.yml's "apk" job (JDK 17 container, as root).
set -euo pipefail
cd /src
cd "$(dirname "$0")/.."
QT_VERSION=6.8.3
NDK=26.1.10909125
# Minutes since the epoch: always above the GitHub builds' run numbers and always rising.
VERSION_CODE=$(( $(date +%s) / 60 ))
COMMIT="${GITHUB_SHA:-$(git rev-parse HEAD)}"
echo "== tools"
apt-get update -qq
# The host Qt tools (moc, qmlimportscanner, qmlcachegen) need glib, GL and friends.
apt-get install -y -qq --no-install-recommends python3-pip python3-venv ninja-build cmake unzip curl ca-certificates \
# The host Qt tools (moc, qmlimportscanner, qmlcachegen) need glib, GL and friends;
# g++ builds the desktop test and nodejs runs the layout test.
apt-get install -y -qq --no-install-recommends python3-pip python3-venv ninja-build cmake g++ nodejs unzip curl ca-certificates git \
libglib2.0-0t64 libgl1 libegl1 libopengl0 libfontconfig1 libfreetype6 libxkbcommon0 libdbus-1-3 >/dev/null
python3 -m venv /opt/aqt && /opt/aqt/bin/pip install -q aqtinstall
@@ -22,6 +25,12 @@ echo "== Qt $QT_VERSION (android arm64 + host)"
QT_ROOT=/opt/Qt/$QT_VERSION/android_arm64_v8a
QT_HOST=/opt/Qt/$QT_VERSION/gcc_64
echo "== tests (desktop Qt)"
node qt/tests/layout.test.mjs
cmake -S qt -B build-desktop -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$QT_HOST"
cmake --build build-desktop
QT_QPA_PLATFORM=offscreen build-desktop/ultrahome_e2e
echo "== Android SDK + NDK $NDK"
export ANDROID_SDK_ROOT=/opt/android-sdk
mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools"
@@ -33,7 +42,7 @@ export ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/$NDK
echo "== build (versionCode $VERSION_CODE)"
# Signed with the committed key, like every earlier build, so it installs over them.
export QT_ANDROID_KEYSTORE_PATH=/src/android/app/debug.keystore
export QT_ANDROID_KEYSTORE_PATH="$PWD/android/app/debug.keystore"
export QT_ANDROID_KEYSTORE_ALIAS=androiddebugkey
export QT_ANDROID_KEYSTORE_STORE_PASS=android
export QT_ANDROID_KEYSTORE_KEY_PASS=android
@@ -44,17 +53,20 @@ cmake --build build-android --target apk
apk=$(find build-android -name "*-signed.apk" | head -1)
test -n "$apk" || { find build-android -name "*.apk"; exit 1; }
cp "$apk" ultra-launcher.apk
printf '{"versionCode": %s, "commit": "%s"}\n' "$VERSION_CODE" "${FORGE_SHA:-}" > version.json
printf '{"versionCode": %s, "commit": "%s"}\n' "$VERSION_CODE" "$COMMIT" > version.json
echo "== release build-$VERSION_CODE"
api="${FORGE_URL:-https://fileapi.fastapicloud.dev}"
api="${api%/}/api/forge/repos/${FORGE_REPO:-nandi.uk/launcher}/releases"
echo "env: FORGE_REPO=${FORGE_REPO:-} FORGE_URL=${FORGE_URL:-} FORGE_API=${FORGE_API:-}"
auth=(-H "Authorization: Bearer $FORGE_TOKEN")
server="${GITHUB_SERVER_URL:-https://git.site.latha.org}"
repo="${GITHUB_REPOSITORY:-experiments/launcher}"
api="${server%/}/api/v1/repos/$repo"
token="${GITEA_TOKEN:-${GITHUB_TOKEN:-}}"
test -n "$token" || { echo "no GITEA_TOKEN/GITHUB_TOKEN in the environment"; exit 1; }
auth=(-H "Authorization: token $token")
tag="build-$VERSION_CODE"
curl -fsS "${auth[@]}" -H "Content-Type: application/json" -X POST "$api" \
-d "{\"tag\": \"$tag\", \"name\": \"ultra Home build $VERSION_CODE\", \"ref\": \"${FORGE_SHA:-}\", \"draft\": true, \"notes\": \"Qt launcher built from ${FORGE_SHA:-?}.\"}" >/dev/null
curl -fsS "${auth[@]}" -T ultra-launcher.apk "$api/$tag/assets/ultra-launcher.apk" >/dev/null
curl -fsS "${auth[@]}" -T version.json "$api/$tag/assets/version.json" >/dev/null
curl -fsS "${auth[@]}" -H "Content-Type: application/json" -X PATCH "$api/$tag" -d '{"draft": false}' >/dev/null
echo "published $tag"
id=$(curl -fsS "${auth[@]}" -H "Content-Type: application/json" -X POST "$api/releases" \
-d "{\"tag_name\": \"$tag\", \"name\": \"ultra Home build $VERSION_CODE\", \"target_commitish\": \"$COMMIT\", \"draft\": true, \"body\": \"Qt launcher built from $COMMIT.\"}" \
| python3 -c 'import sys, json; print(json.load(sys.stdin)["id"])')
curl -fsS "${auth[@]}" -F "attachment=@ultra-launcher.apk" "$api/releases/$id/assets?name=ultra-launcher.apk" >/dev/null
curl -fsS "${auth[@]}" -F "attachment=@version.json" "$api/releases/$id/assets?name=version.json" >/dev/null
curl -fsS "${auth[@]}" -H "Content-Type: application/json" -X PATCH "$api/releases/$id" -d '{"draft": false}' >/dev/null
echo "published $tag to $server/$repo"