Compare commits
19
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a5a01dc97 | ||
|
|
01dcb4705d | ||
|
|
6508dfa8a7 | ||
|
|
ac4a267d30 | ||
|
|
b4afa40c19 | ||
|
|
96a0334a71 | ||
|
|
56fea16f7b | ||
|
|
2f51f3e0a2 | ||
|
|
9d1d60d170 | ||
|
|
158b4ffa56 | ||
|
|
0ecfe2cc68 | ||
|
|
96aa647cf9 | ||
|
|
b725d4730e | ||
|
|
eb47eba676 | ||
|
|
273035ab02 | ||
|
|
d3fc18dbec | ||
|
|
93bf64c61d | ||
|
|
56fe95dbd4 | ||
|
|
1046a1fe71 |
+147
-11
@@ -9,6 +9,7 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
env:
|
||||
KEY_JKS: ${{ secrets.PIXEL10_KEY_JKS }}
|
||||
KEY_PATH: ${{ github.workspace }}/apps/weblibre/pixel10-release.jks
|
||||
@@ -17,6 +18,39 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install runner prerequisites
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
required_commands=(jq unzip zip xz readelf python3)
|
||||
missing_command=false
|
||||
for command_name in "${required_commands[@]}"; do
|
||||
if ! command -v "$command_name" >/dev/null 2>&1; then
|
||||
missing_command=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [[ "$missing_command" == "true" ]]; then
|
||||
sudo_command=()
|
||||
if [[ "$EUID" -ne 0 ]]; then
|
||||
sudo_command=(sudo)
|
||||
fi
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
"${sudo_command[@]}" apt-get update
|
||||
"${sudo_command[@]}" apt-get install -y --no-install-recommends \
|
||||
jq unzip zip xz-utils binutils python3
|
||||
fi
|
||||
|
||||
- name: Validate signing configuration
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -n "$KEY_JKS"
|
||||
test -n "$KEY_PASSWORD"
|
||||
test -n "$KEY_ALIAS"
|
||||
printf '%s' "$KEY_JKS" | base64 -d > "$KEY_PATH"
|
||||
chmod 600 "$KEY_PATH"
|
||||
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
@@ -26,23 +60,53 @@ jobs:
|
||||
with:
|
||||
go-version: 1.25.x
|
||||
|
||||
- name: Set up Rust Android toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: aarch64-linux-android
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
- name: Set up Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: stable
|
||||
flutter-version: 3.44.5
|
||||
cache: true
|
||||
# The act_runner cache endpoint is not reachable from job containers
|
||||
# in this setup and otherwise adds two ~5 minute timeouts per run.
|
||||
cache: false
|
||||
|
||||
- name: Install Android NDK
|
||||
- name: Trust Flutter SDK checkout
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
flutter_sdk="$(dirname "$(dirname "$(command -v flutter)")")"
|
||||
git config --global --add safe.directory "$flutter_sdk"
|
||||
|
||||
- name: Install Android SDK platform and NDK
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
android_api="$(sed -n 's/^[[:space:]]*compileSdkVersion[[:space:]]*=[[:space:]]*//p' apps/weblibre/android/build.gradle | head -n 1)"
|
||||
android_platform="$android_api.0"
|
||||
ndk_version="$(sed -n 's/^weblibre\.ndkVersion[[:space:]]*=[[:space:]]*//p' apps/weblibre/android/gradle.properties)"
|
||||
test -n "$android_api"
|
||||
test -n "$ndk_version"
|
||||
yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --install "ndk;$ndk_version" || test "${PIPESTATUS[1]}" -eq 0
|
||||
yes | sdkmanager --channel=3 --install \
|
||||
"platforms;android-24" \
|
||||
"platforms;android-$android_platform" \
|
||||
"build-tools;36.0.0" \
|
||||
"cmake;3.22.1" \
|
||||
"ndk;$ndk_version" || test "${PIPESTATUS[1]}" -eq 0
|
||||
test -f "$ANDROID_HOME/platforms/android-24/android.jar"
|
||||
test -f "$ANDROID_HOME/platforms/android-$android_platform/android.jar"
|
||||
test -f "$ANDROID_HOME/build-tools/36.0.0/aapt2"
|
||||
test -x "$ANDROID_HOME/cmake/3.22.1/bin/cmake"
|
||||
test -f "$ANDROID_HOME/ndk/$ndk_version/source.properties"
|
||||
{
|
||||
echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/$ndk_version"
|
||||
echo "ANDROID_NDK_ROOT=$ANDROID_HOME/ndk/$ndk_version"
|
||||
@@ -76,23 +140,95 @@ jobs:
|
||||
env:
|
||||
SING_BOX_SOURCE: ${{ runner.temp }}/sing-box
|
||||
IPTPROXY_SOURCE: ${{ runner.temp }}/IPtProxy
|
||||
run: melos run build-go-runtime --no-select
|
||||
|
||||
- name: Create release key
|
||||
# Pixel 10 is ARM64-only. Avoid building and storing three unused ABIs.
|
||||
TARGET: android/arm64
|
||||
# Go writes verbose compiler progress to stderr. Gitea's act runner
|
||||
# otherwise labels every one of those harmless lines as "ERROR".
|
||||
run: melos run build-go-runtime --no-select 2>&1
|
||||
- name: Reclaim disk before Android build
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -n "$KEY_JKS"
|
||||
printf '%s' "$KEY_JKS" | base64 -d > "$KEY_PATH"
|
||||
chmod 600 "$KEY_PATH"
|
||||
|
||||
# These inputs and compiler caches are only needed to create the AAR
|
||||
# installed by the previous step. Cargokit, Gradle and artifact upload
|
||||
# need the reclaimed space later in the same job container.
|
||||
rm -rf \
|
||||
"$RUNNER_TEMP/sing-box" \
|
||||
"$RUNNER_TEMP/IPtProxy" \
|
||||
native/go_mobile_runtime/.work/android
|
||||
go clean -cache -modcache
|
||||
|
||||
available_kib="$(df -Pk / | awk 'NR == 2 { print $4 }')"
|
||||
minimum_kib=$((8 * 1024 * 1024))
|
||||
df -h /
|
||||
if (( available_kib < minimum_kib )); then
|
||||
echo "At least 8 GiB of free runner disk is required before the Android build; only $((available_kib / 1024 / 1024)) GiB is available." >&2
|
||||
exit 1
|
||||
fi
|
||||
- name: Build and verify Pixel 10 APK
|
||||
run: melos run build-browser-pixel10 --no-select
|
||||
env:
|
||||
CARGO_BUILD_JOBS: "2"
|
||||
CARGO_INCREMENTAL: "0"
|
||||
# The previous measured run kept about 16 GiB RAM free. GeckoView's
|
||||
# Jetifier transform needs more than a 1 GiB heap, while two workers
|
||||
# still leave ample headroom for the colocated Gitea instance.
|
||||
JAVA_TOOL_OPTIONS: -XX:ActiveProcessorCount=2
|
||||
GRADLE_OPTS: >-
|
||||
-Dorg.gradle.jvmargs=-Xmx4G
|
||||
-Dorg.gradle.workers.max=2
|
||||
-Dorg.gradle.parallel=false
|
||||
-Dorg.gradle.daemon=false
|
||||
-Dkotlin.compiler.execution.strategy=in-process
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
# A deadlocked native build used to stay alive until act_runner's
|
||||
# three-hour job container expired. Keep a hard local deadline and
|
||||
# emit a heartbeat so a stalled or disk-starved build is obvious.
|
||||
timeout --foreground --signal=TERM --kill-after=1m 30m \
|
||||
melos run build-browser-pixel10 --no-select &
|
||||
build_pid=$!
|
||||
|
||||
monitor_resources() {
|
||||
while kill -0 "$build_pid" 2>/dev/null; do
|
||||
sleep 60
|
||||
kill -0 "$build_pid" 2>/dev/null || return 0
|
||||
|
||||
available_kib="$(df -Pk / | awk 'NR == 2 { print $4 }')"
|
||||
echo "Pixel 10 build heartbeat: $((available_kib / 1024 / 1024)) GiB disk available"
|
||||
awk '/MemAvailable:/ { printf "Memory available: %.1f GiB\n", $2 / 1024 / 1024 }' /proc/meminfo
|
||||
|
||||
if (( available_kib < 2 * 1024 * 1024 )); then
|
||||
echo "Stopping Android build before the runner disk is exhausted." >&2
|
||||
kill -TERM "$build_pid" 2>/dev/null || true
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
monitor_resources &
|
||||
monitor_pid=$!
|
||||
cleanup_monitor() {
|
||||
kill "$monitor_pid" 2>/dev/null || true
|
||||
wait "$monitor_pid" 2>/dev/null || true
|
||||
}
|
||||
trap cleanup_monitor EXIT
|
||||
|
||||
set +e
|
||||
wait "$build_pid"
|
||||
build_status=$?
|
||||
set -e
|
||||
exit "$build_status"
|
||||
|
||||
# Gitea's artifact service implements the v3 protocol. The v4 action
|
||||
# rejects non-GitHub servers with GHESNotSupportedError before upload.
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: mrbweblibre-pixel10
|
||||
path: apps/weblibre/build/app/outputs/flutter-apk/app-pixel10-release.apk
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Remove release key
|
||||
if: always()
|
||||
|
||||
+29
-1
@@ -32,7 +32,8 @@ the generated assets and native runtime, then run:
|
||||
melos run build-browser-pixel10 --no-select
|
||||
```
|
||||
|
||||
The command produces:
|
||||
The command asks Flutter for a split ARM64 artifact, verifies that no other
|
||||
ABI is packaged, and publishes it under the stable path:
|
||||
|
||||
```text
|
||||
apps/weblibre/build/app/outputs/flutter-apk/app-pixel10-release.apk
|
||||
@@ -41,6 +42,33 @@ apps/weblibre/build/app/outputs/flutter-apk/app-pixel10-release.apk
|
||||
Release builds require the same signing environment variables as upstream:
|
||||
`KEY_PATH`, `KEY_ALIAS`, and `KEY_PASSWORD`.
|
||||
|
||||
## Gitea Actions
|
||||
|
||||
The workflow at `.gitea/workflows/pixel10.yml` runs on every push to the
|
||||
`pixel10` branch and can also be started manually. It needs an Actions runner
|
||||
with the `ubuntu-latest` label and these repository secrets:
|
||||
|
||||
| Secret | Value |
|
||||
| --- | --- |
|
||||
| `PIXEL10_KEY_JKS` | Base64-encoded Android signing keystore |
|
||||
| `PIXEL10_KEY_ALIAS` | Alias of the signing key |
|
||||
| `PIXEL10_KEY_PASSWORD` | Keystore and key password |
|
||||
|
||||
Create a dedicated key once and keep both the keystore and password backed up.
|
||||
Losing the signing key makes it impossible to install future updates over an
|
||||
existing MrbWebLibre installation.
|
||||
|
||||
```bash
|
||||
keytool -genkeypair -v \
|
||||
-keystore pixel10-release.jks \
|
||||
-alias mrbweblibre \
|
||||
-keyalg RSA -keysize 4096 -validity 10000
|
||||
base64 -w 0 pixel10-release.jks
|
||||
```
|
||||
|
||||
Add the resulting one-line Base64 value as `PIXEL10_KEY_JKS`; do not commit the
|
||||
keystore itself. The workflow removes the decoded file even when a build fails.
|
||||
|
||||
## Verify an existing APK
|
||||
|
||||
```bash
|
||||
|
||||
@@ -74,17 +74,15 @@ android {
|
||||
manifestPlaceholders = [appName: "WebLibre Alpha (Legacy)", enableImpeller: "false"]
|
||||
}
|
||||
// Pixel 10 devices are 64-bit only and ship a 120 Hz display. Keep a
|
||||
// separate, side-by-side installable identity for the optimized fork,
|
||||
// retain Impeller, and prevent transitive dependencies from packaging
|
||||
// unused 32-bit native libraries.
|
||||
// separate, side-by-side installable identity for the optimized fork
|
||||
// and retain Impeller. The Pixel 10 build script selects android-arm64
|
||||
// with Flutter's ABI split; Gradle forbids combining that split with a
|
||||
// second ndk.abiFilters declaration here.
|
||||
pixel10 {
|
||||
dimension "track"
|
||||
applicationId "cc.mrblake.mrbweblibre"
|
||||
versionNameSuffix "-pixel10"
|
||||
manifestPlaceholders = [appName: "MrbWebLibre", enableImpeller: "true"]
|
||||
ndk {
|
||||
abiFilters "arm64-v8a"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -111,5 +111,8 @@ melos:
|
||||
run: |
|
||||
set -e
|
||||
cd apps/weblibre
|
||||
flutter build apk --release --flavor pixel10 --target-platform android-arm64 --no-tree-shake-icons
|
||||
flutter build apk --release --flavor pixel10 --target-platform android-arm64 --split-per-abi --no-tree-shake-icons
|
||||
arm64_apk="$(find build/app/outputs/flutter-apk -maxdepth 1 -type f -name '*pixel10*' -name '*arm64-v8a*' -name '*release.apk' -print -quit)"
|
||||
test -n "$arm64_apk"
|
||||
mv "$arm64_apk" build/app/outputs/flutter-apk/app-pixel10-release.apk
|
||||
../../scripts/verify-pixel10-apk.sh build/app/outputs/flutter-apk/app-pixel10-release.apk
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import sqlite3
|
||||
|
||||
Reference in New Issue
Block a user