Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/scripts/check-release-apk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ expected=$(tr -d '\r\n' < "$certificate_file")
aapt=$(find "$ANDROID_HOME/build-tools" -name aapt -type f | sort -V | tail -n 1)
apksigner=$(find "$ANDROID_HOME/build-tools" -name apksigner -type f | sort -V | tail -n 1)
test -n "$aapt" && test -n "$apksigner" || { echo "Android build tools missing" >&2; exit 1; }
metadata=$("$aapt" dump badging "$candidate" | sed -n '1p')
if [[ "$metadata" != *"name='com.gothwad.computer'"* || "$metadata" != *"versionCode='$expected_code'"* ]]; then
badging=$("$aapt" dump badging "$candidate")
metadata=$(printf '%s\n' "$badging" | sed -n '1p')
if [[ "$metadata" != *"name='com.bansify.computer'"* || "$metadata" != *"versionCode='$expected_code'"* ]]; then
echo "Candidate package or version code is incorrect" >&2
exit 1
fi
if ! grep -Fxq "application-label:'Bansify Computer'" <<< "$badging"; then
echo "Candidate application label is not Bansify Computer" >&2
exit 1
fi
if ! output=$("$apksigner" verify --print-certs "$candidate" 2>&1); then
echo "APK signature verification failed: $output" >&2
exit 1
Expand Down
81 changes: 81 additions & 0 deletions .github/scripts/release-home-smoke.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/usr/bin/env bash
# Runs only inside a disposable GitHub emulator; not for an owner's device.
set -euo pipefail
./gradlew :app:assembleRelease -PlocalSign -PversionCode=21 -PversionName=1.0.21 --no-daemon --no-configuration-cache
apk=$(find app/build/outputs/apk/release -name '*.apk' -type f -print -quit)
test -n "$apk"
mkdir -p old-release
# Test the exact published APK as evidence, separately from the new candidate.
old_available=0
if gh release download v1.0.21 --pattern 'GothwadComputer-v1.0.21-Release.apk' --dir old-release; then
old_available=1
else
echo '::warning::Could not download the published v1.0.21 APK for comparison; candidate testing is still required.'
fi

inspect_home() {
local package=$1 label=$2 level=$3 app_id=$4 ready=0 attempt
adb install "$package" || { echo "::${level}::${label}: APK installation failed"; return 1; }
adb shell am force-stop "$app_id" || { echo "::${level}::${label}: force-stop failed"; return 1; }
adb logcat -c
adb shell input keyevent KEYCODE_WAKEUP || true
adb shell wm dismiss-keyguard || true
adb shell am start -W -n "$app_id/.MainActivity"
capture_screen() {
adb shell rm -f /data/local/tmp/gothwad-window.xml
timeout 20s adb shell uiautomator dump /data/local/tmp/gothwad-window.xml > "release-dump-${label}.log" 2>&1 || true
adb exec-out cat /data/local/tmp/gothwad-window.xml > "release-ui-${label}.xml" 2>/dev/null || true
# Android 10 uiautomator may never become idle; dumpsys can inspect a live view tree.
if ! grep -q '<hierarchy' "release-ui-${label}.xml"; then
adb shell dumpsys activity top > "release-top-${label}.log" 2>&1 || true
cat "release-top-${label}.log" > "release-ui-${label}.xml"
fi
}
for attempt in $(seq 1 8); do
capture_screen
if grep -q 'id/safe_retry' "release-ui-${label}.xml"; then
echo "::${level}::${label}: Recovery appeared instead of the normal desktop."
break
fi
if grep -q 'id/btn_start' "release-ui-${label}.xml"; then
ready=1
break
fi
sleep 1
done
if [ "$ready" -eq 1 ]; then
# A frame appearing once is not proof that startup remains healthy.
sleep 8
capture_screen
if ! grep -q 'id/btn_start' "release-ui-${label}.xml" || grep -q 'id/safe_retry' "release-ui-${label}.xml"; then
ready=0
fi
fi
adb logcat -d -v brief > "release-logcat-${label}.log"
adb uninstall "$app_id" >/dev/null || { echo "::error::Could not clean up emulator installation"; exit 1; }
if [ "$ready" -ne 1 ]; then
LEVEL="$level" LABEL="$label" APP_ID="$app_id" python3 - <<'PY'
import os
from pathlib import Path
label, level = os.environ['LABEL'], os.environ['LEVEL']
text = Path(f'release-logcat-{label}.log').read_text(errors='replace').splitlines()
selected = [line for line in text if any(x in line for x in ('FATAL EXCEPTION', 'Desktop startup failed', 'MainActivity', 'GothwadApplication', 'Caused by:', os.environ['APP_ID']))]
message = '\n'.join(selected[-60:])[:10000].replace('%', '%25').replace('\r', '%0D').replace('\n', '%0A')
print(f'::{level}::{label} did not reach a stable desktop. {message}')
ui = Path(f'release-ui-{label}.xml').read_text(errors='replace')
interesting = '\n'.join(line for line in ui.splitlines() if any(item in line for item in ('View Hierarchy', 'btn_start', 'safe_retry', 'MainActivity')))[:4000] or ui[:4000]
print(f'::{level}::UI hierarchy: ' + interesting.replace('%', '%25').replace('\r', '%0D').replace('\n', '%0A'))
print(f'::{level}::UI dump command: ' + Path(f'release-dump-{label}.log').read_text(errors='replace')[:2000].replace('%', '%25').replace('\r', '%0D').replace('\n', '%0A'))
PY
return 1
fi
echo "$label: desktop visible after startup."
}

# A known old failure is reported as a warning but must not conceal a new failure.
if [ "$old_available" -eq 1 ]; then
if ! inspect_home old-release/GothwadComputer-v1.0.21-Release.apk published warning com.gothwad.computer; then
echo 'Published v1.0.21 did not pass this emulator smoke test.'
fi
fi
inspect_home "$apk" candidate error com.bansify.computer
8 changes: 5 additions & 3 deletions .github/scripts/tests/test_release_apk.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def setUp(self):
tools = root / 'sdk' / 'build-tools' / '35.0.0'
tools.mkdir(parents=True)
for name, body in {
'aapt': 'printf "%s\\n" "$FAKE_BADGING"',
'aapt': 'printf "%s\\n" "$FAKE_BADGING" "$FAKE_LABEL"',
'apksigner': 'printf "%s\\n" "$FAKE_CERT"; exit "${FAKE_VERIFY_EXIT:-0}"',
}.items():
tool = tools / name
Expand All @@ -27,7 +27,8 @@ def setUp(self):
self.pin = root / 'pin.txt'
self.pin.write_text(PIN + '\n')
self.env = dict(os.environ, ANDROID_HOME=str(root / 'sdk'),
FAKE_BADGING="package: name='com.gothwad.computer' versionCode='21' versionName='1.0.21'",
FAKE_BADGING="package: name='com.bansify.computer' versionCode='21' versionName='1.0.21'",
FAKE_LABEL="application-label:'Bansify Computer'",
FAKE_CERT=f'V3.0 Signer: certificate SHA-256 digest: {PIN}')

def run_check(self, **updates):
Expand All @@ -47,7 +48,8 @@ def test_rejects_other_or_missing_certificates(self):

def test_rejects_wrong_package_version_and_pin(self):
self.assertNotEqual(self.run_check(FAKE_BADGING="package: name='other' versionCode='21'").returncode, 0)
self.assertNotEqual(self.run_check(FAKE_BADGING="package: name='com.gothwad.computer' versionCode='20'").returncode, 0)
self.assertNotEqual(self.run_check(FAKE_BADGING="package: name='com.bansify.computer' versionCode='20'").returncode, 0)
self.assertNotEqual(self.run_check(FAKE_LABEL="application-label:'Wrong Name'").returncode, 0)
self.pin.write_text('invalid\n')
self.assertNotEqual(self.run_check().returncode, 0)

Expand Down
41 changes: 27 additions & 14 deletions .github/workflows/build_apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ jobs:
permissions:
contents: read

release_home:
if: github.event_name != 'workflow_dispatch' || github.ref == 'refs/heads/main' || inputs.dry_run
uses: ./.github/workflows/release-home-smoke.yml
permissions:
contents: read

build:
name: Build & Sign APK & AAB
needs: validate
needs: [validate, release_home]
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -106,8 +112,8 @@ jobs:

# 0. Copy Debug APK directly (already signed with debug keystore)
if [ -n "$DEBUG_APK" ]; then
cp "$DEBUG_APK" "output_release/GothwadComputer-v${V_NAME}-Debug.apk"
echo "Successfully included Debug APK: output_release/GothwadComputer-v${V_NAME}-Debug.apk"
cp "$DEBUG_APK" "output_release/BansifyComputer-v${V_NAME}-Debug.apk"
echo "Successfully included Debug APK: output_release/BansifyComputer-v${V_NAME}-Debug.apk"
fi

if [ -z "$KEYSTORE_BASE64" ]; then
Expand Down Expand Up @@ -159,22 +165,22 @@ jobs:
--ks-key-alias "$ACTUAL_ALIAS" \
--ks-pass "pass:$KEYSTORE_PASS" \
--key-pass "pass:$KEY_PASS" \
--out "output_release/GothwadComputer-v${V_NAME}-Release.apk" \
--out "output_release/BansifyComputer-v${V_NAME}-Release.apk" \
"$UNALIGNED_TEMP"

"$APKSIGNER" verify --verbose "output_release/GothwadComputer-v${V_NAME}-Release.apk"
"$APKSIGNER" verify --verbose "output_release/BansifyComputer-v${V_NAME}-Release.apk"
rm -f "$UNALIGNED_TEMP"
fi

# 2. Sign Play Store AAB Bundle using jarsigner
if [ -n "$UNSIGNED_AAB" ]; then
cp "$UNSIGNED_AAB" "output_release/GothwadComputer-v${V_NAME}-PlayStore.aab"
cp "$UNSIGNED_AAB" "output_release/BansifyComputer-v${V_NAME}-PlayStore.aab"
jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA-256 \
-keystore "$KS_PATH" \
-storepass "$KEYSTORE_PASS" -keypass "$KEY_PASS" \
"output_release/GothwadComputer-v${V_NAME}-PlayStore.aab" \
"output_release/BansifyComputer-v${V_NAME}-PlayStore.aab" \
"$ACTUAL_ALIAS"
jarsigner -verify "output_release/GothwadComputer-v${V_NAME}-PlayStore.aab"
jarsigner -verify "output_release/BansifyComputer-v${V_NAME}-PlayStore.aab"
echo "Successfully signed Play Store AAB!"
fi

Expand All @@ -187,14 +193,21 @@ jobs:
V_NAME: ${{ steps.versioning.outputs.v_name }}
V_CODE: ${{ steps.versioning.outputs.v_code }}
run: |
bash .github/scripts/check-release-apk.sh "output_release/GothwadComputer-v${V_NAME}-Release.apk" "$V_CODE" .github/release-signing-sha256.txt
bash .github/scripts/check-release-apk.sh "output_release/BansifyComputer-v${V_NAME}-Release.apk" "$V_CODE" .github/release-signing-sha256.txt

- name: Upload Signed Release APK, Debug APK & AAB Artifacts
uses: actions/upload-artifact@v7
with:
name: Gothwad-Computer-v${{ steps.versioning.outputs.v_name }}-Build${{ steps.versioning.outputs.v_code }}
name: Bansify-Computer-v${{ steps.versioning.outputs.v_name }}-Build${{ steps.versioning.outputs.v_code }}
path: output_release/

- name: Upload release crash symbol mapping
uses: actions/upload-artifact@v7
with:
name: release-r8-mapping-${{ github.run_id }}
path: app/build/outputs/mapping/release/mapping.txt
if-no-files-found: error

- name: Create Automatic GitHub Release
if: github.event_name != 'workflow_dispatch' || !inputs.dry_run
uses: softprops/action-gh-release@v3
Expand All @@ -209,8 +222,8 @@ jobs:
prerelease: false
generate_release_notes: true
body: |
**Signing key change:** This release uses a different signing key from v1.0.20. Android may reject an in-place update from v1.0.20; uninstalling the old app can delete its local data. Back up data first and verify recovery on a test device. Keep an alternate launcher installed.
**New application ID:** Bansify Computer uses `com.bansify.computer`, which Android installs separately from the former `com.gothwad.computer` app. Settings and app data do not automatically transfer. Keep the old app and an alternate Home installed, back up data before any removal, and select the desired default Home in Android settings. The prior v1.0.20 release also used a different signing key.
files: |
output_release/GothwadComputer-v${{ steps.versioning.outputs.v_name }}-Release.apk
output_release/GothwadComputer-v${{ steps.versioning.outputs.v_name }}-Debug.apk
output_release/GothwadComputer-v${{ steps.versioning.outputs.v_name }}-PlayStore.aab
output_release/BansifyComputer-v${{ steps.versioning.outputs.v_name }}-Release.apk
output_release/BansifyComputer-v${{ steps.versioning.outputs.v_name }}-Debug.apk
output_release/BansifyComputer-v${{ steps.versioning.outputs.v_name }}-PlayStore.aab
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
path: |
app/build/reports/
app/build/outputs/lint-results-*.xml
app/build/outputs/mapping/release/mapping.txt
if-no-files-found: ignore
- name: Upload debug APK
if: success()
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/release-home-smoke.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Minified release Home smoke test

on:
push:
branches: ['arena/**']
pull_request:
workflow_dispatch:
workflow_call:

permissions:
contents: read

jobs:
smoke:
name: Release Home ${{ matrix.target }} Android ${{ matrix.api }}
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- { api: 21, target: google_apis, arch: x86_64 }
- { api: 29, target: google_apis, arch: x86_64 }
- { api: 34, target: google_apis, arch: x86_64 }
- { api: 29, target: android-tv, arch: x86 }
- { api: 34, target: android-tv, arch: x86 }
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
- uses: gradle/actions/wrapper-validation@v6
- uses: gradle/actions/setup-gradle@v6
- name: Enable KVM when available
run: |
if [ -e /dev/kvm ]; then
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
fi
- name: Build, install and launch minified release (local debug key)
uses: reactivecircus/android-emulator-runner@v2
env:
GH_TOKEN: ${{ github.token }}
with:
api-level: ${{ matrix.api }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
disable-animations: true
emulator-boot-timeout: 600
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -no-snapshot
script: bash .github/scripts/release-home-smoke.sh
- name: Upload emulator diagnostics
if: always()
uses: actions/upload-artifact@v7
with:
name: release-home-${{ matrix.target }}-${{ matrix.api }}-diagnostics
path: |
release-ui-*.xml
release-logcat-*.log
release-dump-*.log
release-top-*.log
if-no-files-found: ignore
41 changes: 27 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@ jobs:
permissions:
contents: read

release_home:
if: github.event_name != 'workflow_dispatch' || github.ref == 'refs/heads/main'
uses: ./.github/workflows/release-home-smoke.yml
permissions:
contents: read

build_release:
name: Build & Publish Release
needs: validate
needs: [validate, release_home]
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -90,8 +96,8 @@ jobs:
}

if [ -n "$DEBUG_APK" ]; then
cp "$DEBUG_APK" "release_out/GothwadComputer-v${V_NAME}-Debug.apk"
echo "Copied Debug APK: release_out/GothwadComputer-v${V_NAME}-Debug.apk"
cp "$DEBUG_APK" "release_out/BansifyComputer-v${V_NAME}-Debug.apk"
echo "Copied Debug APK: release_out/BansifyComputer-v${V_NAME}-Debug.apk"
fi

if [ -z "$KEYSTORE_BASE64" ]; then
Expand Down Expand Up @@ -141,21 +147,21 @@ jobs:
--ks-key-alias "$ACTUAL_ALIAS" \
--ks-pass "pass:$KEYSTORE_PASS" \
--key-pass "pass:$KEY_PASS" \
--out "release_out/GothwadComputer-v${V_NAME}-Release.apk" \
--out "release_out/BansifyComputer-v${V_NAME}-Release.apk" \
"$UNALIGNED_TEMP"

"$APKSIGNER" verify --verbose "release_out/GothwadComputer-v${V_NAME}-Release.apk"
"$APKSIGNER" verify --verbose "release_out/BansifyComputer-v${V_NAME}-Release.apk"
rm -f "$UNALIGNED_TEMP"
fi

if [ -n "$AAB" ]; then
cp "$AAB" "release_out/GothwadComputer-v${V_NAME}-PlayStore.aab"
cp "$AAB" "release_out/BansifyComputer-v${V_NAME}-PlayStore.aab"
jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA-256 \
-keystore "$KS_PATH" \
-storepass "$KEYSTORE_PASS" -keypass "$KEY_PASS" \
"release_out/GothwadComputer-v${V_NAME}-PlayStore.aab" \
"release_out/BansifyComputer-v${V_NAME}-PlayStore.aab" \
"$ACTUAL_ALIAS"
jarsigner -verify "release_out/GothwadComputer-v${V_NAME}-PlayStore.aab"
jarsigner -verify "release_out/BansifyComputer-v${V_NAME}-PlayStore.aab"
echo "Successfully signed Play Store AAB!"
fi

Expand All @@ -168,14 +174,21 @@ jobs:
V_NAME: ${{ steps.versioning.outputs.v_name }}
V_CODE: ${{ steps.versioning.outputs.v_code }}
run: |
bash .github/scripts/check-release-apk.sh "release_out/GothwadComputer-v${V_NAME}-Release.apk" "$V_CODE" .github/release-signing-sha256.txt
bash .github/scripts/check-release-apk.sh "release_out/BansifyComputer-v${V_NAME}-Release.apk" "$V_CODE" .github/release-signing-sha256.txt

- name: Upload Release Artifacts
uses: actions/upload-artifact@v7
with:
name: Gothwad-Computer-v${{ steps.versioning.outputs.v_name }}-Release
name: Bansify-Computer-v${{ steps.versioning.outputs.v_name }}-Release
path: release_out/

- name: Upload release crash symbol mapping
uses: actions/upload-artifact@v7
with:
name: release-r8-mapping-${{ github.run_id }}
path: app/build/outputs/mapping/release/mapping.txt
if-no-files-found: error

- name: Create GitHub Release
uses: softprops/action-gh-release@v3
env:
Expand All @@ -189,8 +202,8 @@ jobs:
prerelease: false
generate_release_notes: true
body: |
**Signing key change:** This release uses a different signing key from v1.0.20. Android may reject an in-place update from v1.0.20; uninstalling the old app can delete its local data. Back up data first and verify recovery on a test device. Keep an alternate launcher installed.
**New application ID:** Bansify Computer uses `com.bansify.computer`, which Android installs separately from the former `com.gothwad.computer` app. Settings and app data do not automatically transfer. Keep the old app and an alternate Home installed, back up data before any removal, and select the desired default Home in Android settings. The prior v1.0.20 release also used a different signing key.
files: |
release_out/GothwadComputer-v${{ steps.versioning.outputs.v_name }}-Release.apk
release_out/GothwadComputer-v${{ steps.versioning.outputs.v_name }}-Debug.apk
release_out/GothwadComputer-v${{ steps.versioning.outputs.v_name }}-PlayStore.aab
release_out/BansifyComputer-v${{ steps.versioning.outputs.v_name }}-Release.apk
release_out/BansifyComputer-v${{ steps.versioning.outputs.v_name }}-Debug.apk
release_out/BansifyComputer-v${{ steps.versioning.outputs.v_name }}-PlayStore.aab
Loading
Loading