Compare commits

...
3 Commits
9 changed files with 170 additions and 40 deletions

No files matched your search

+11 -4
View File
@@ -67,7 +67,9 @@ jobs:
sh update_version.sh
git diff --exit-code -- version.json
- name: Run the game and asset tests
run: sh tests/run_local.sh
run: |
python3 tests/android_release_test.py
sh tests/run_local.sh
- name: Exercise the app on its own private display
run: python3 tests/private_ui_test.py
- name: Build and exercise the shared account interface
@@ -95,7 +97,9 @@ jobs:
PY
- name: Build both ARM architectures in one production APK
run: python3 tools/build_android.py --release --abi universal
- name: Sign and verify the standard and F-Droid-style downloads
- name: Build the separate Google Play APK
run: python3 tools/build_android.py --release --abi universal --edition gplay
- name: Sign and verify the Google-free downloads and Google Play APK
env:
KEYSTORE: ${{ secrets.WURM_ANDROID_KEYSTORE }}
PASSWORD: ${{ secrets.WURM_ANDROID_KEYSTORE_PASSWORD }}
@@ -108,14 +112,17 @@ jobs:
printf '%s\n' "$PASSWORD" > "$RUNNER_TEMP/wurm-password"
python3 tools/android_release.py sign build/android/Apfelwurm-universal-release-unsigned.apk \
--keystore "$RUNNER_TEMP/wurm-release.p12" --password-file "$RUNNER_TEMP/wurm-password"
python3 tools/android_release.py sign build/android/Apfelwurm-universal-gplay-release-unsigned.apk --edition gplay \
--keystore "$RUNNER_TEMP/wurm-release.p12" --password-file "$RUNNER_TEMP/wurm-password"
# Publish from this verified workspace: GitHub Actions artifact storage
# is account-wide and must not block the owner's release downloads.
- name: Require both download names and extract release notes
- name: Require all download editions and extract release notes
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
test -f "build/downloads/wurm-v$VERSION.apk"
test -f "build/downloads/wurm-$VERSION-fdroid.apk"
test -f "build/downloads/wurm-v$VERSION-gplay.apk"
test -f "build/downloads/wurm-web-v$VERSION.zip"
cmp "build/downloads/wurm-v$VERSION.apk" "build/downloads/wurm-$VERSION-fdroid.apk"
python3 - <<'PY' > build/release-notes.md
@@ -142,7 +149,7 @@ jobs:
if [ "$state" = missing ]; then
gh release create "$tag" --draft --target "$GITHUB_SHA" --title "Apfelwurm $VERSION" --notes-file build/release-notes.md
fi
gh release upload "$tag" "build/downloads/wurm-v$VERSION.apk" "build/downloads/wurm-$VERSION-fdroid.apk" "build/downloads/wurm-web-v$VERSION.zip" --clobber
gh release upload "$tag" "build/downloads/wurm-v$VERSION.apk" "build/downloads/wurm-$VERSION-fdroid.apk" "build/downloads/wurm-v$VERSION-gplay.apk" "build/downloads/wurm-web-v$VERSION.zip" --clobber
gh release edit "$tag" --draft=false --latest
- name: Install itch.io Butler
run: |
+8
View File
@@ -1,5 +1,13 @@
# Changelog
## [0.2.12] - 2026-10-28
- Download the Google Play edition as a separate `-gplay.apk`. The standard and F-Droid APKs exclude Google libraries and keep Monero top-ups.
## [0.2.11] - 2026-10-28
- Buy a small 10 Dew pack in the Google Play edition and see each larger pack’s savings per Dew.
## [0.2.10] - 2026-10-28
- Keep signed-in progress and unfinished runs after closing or updating Apfelwurm inside Arcade and Breeze.
+4
View File
@@ -21,6 +21,10 @@ acoustic soundtrack and controls that respond while your finger stays down.
Free to play. All 200 levels can be unlocked through play. No ads. An optional account keeps your
progress and character choices in sync, with cosmetic skins available for Dew.
The standard Android APK and the `-fdroid.apk` download exclude Google libraries.
Choose the separate `-gplay.apk` for Google Play Billing. The standard and
F-Droid editions use Monero for Dew top-ups.
## Five landscapes. Forty levels each.
- **Meadow:** find your rhythm among grass, hedges and orchard paths, with a slower opening pace.
+16 -3
View File
@@ -174,12 +174,25 @@ Signing uses the preserved private key in ignored `backup/android-signing/`.
Only its public certificate is tracked in `packaging/android/certificate.pem`.
The signing tool verifies the package, version, certificate, both ARM native
libraries, 16 KB ZIP alignment and current game assets. It produces identical
signed `wurm-v<VERSION>.apk` and `wurm-<VERSION>-fdroid.apk` downloads, following
Shovey's naming format. The F-Droid filename is a source-build distribution
signed `wurm-v<VERSION>.apk` and `wurm-<VERSION>-fdroid.apk` downloads. Both exclude
Google libraries, and verification rejects Google or Play Billing classes and
the Play Billing permission in these APKs. The F-Droid filename is a source-build distribution
artifact; it does not imply a listing or approval in the F-Droid catalog.
Build and sign the separate Google Play APK with:
```sh
python3 tools/build_android.py --release --abi universal --edition gplay
python3 tools/android_release.py sign build/android/Apfelwurm-universal-gplay-release-unsigned.apk --edition gplay
```
This produces `wurm-v<VERSION>-gplay.apk`, with Play Billing for Dew purchases.
It never replaces either Google-free download. `--bundle` still builds the
Google Play App Bundle; the separate Google Play bundle workflow signs it for
upload to the Play Console.
On every push to master, the Downloads workflow runs the game and private
display tests, builds a production APK and signs both names using repository
display tests, builds both Android editions and signs all three names using repository
secrets `WURM_ANDROID_KEYSTORE` and `WURM_ANDROID_KEYSTORE_PASSWORD`. A new
changelog version is published only after those jobs succeed. Tags are created
by that workflow. Publishing uploads directly from the verified build to
+59
View File
@@ -0,0 +1,59 @@
#!/usr/bin/env python3
"""Local tests for the Google-free and Google Play release boundary."""
import io
from pathlib import Path
import sys
import unittest
import zipfile
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'tools'))
from android_release import verify_edition
class AndroidEditionTest(unittest.TestCase):
def verify(self, files, edition='direct', bundle=False):
output = io.BytesIO()
with zipfile.ZipFile(output, 'w') as archive:
for name, data in files.items():
archive.writestr(name, data)
output.seek(0)
with zipfile.ZipFile(output) as archive:
verify_edition(archive, edition, bundle)
def test_google_free_apk(self):
self.verify({'classes.dex': b'Lxyz/waozi/wurm/MainActivity;'})
def test_google_code_in_any_dex_is_rejected(self):
for marker in (b'Lcom/google/android/gms/', b'Lcom/android/billingclient/api/BillingClient;',
b'Lcom/android/vending/', b'Lorg/kryonlabs/play/PlayBilling;'):
with self.subTest(marker=marker), self.assertRaisesRegex(AssertionError, 'exclude Google libraries'):
self.verify({'classes.dex': b'Lxyz/waozi/wurm/MainActivity;', 'classes2.dex': marker})
def test_marker_crossing_read_boundary_is_rejected(self):
with self.assertRaisesRegex(AssertionError, 'exclude Google libraries'):
self.verify({'classes.dex': b'\0' * (1024 * 1024 - 4) + b'Lcom/google/android/gms/'})
def test_play_apk_requires_both_billing_and_bridge(self):
for code in (b'Lcom/android/billingclient/api/BillingClient;', b'Lorg/kryonlabs/play/PlayBilling;'):
with self.subTest(code=code), self.assertRaisesRegex(AssertionError, 'must include Play Billing'):
self.verify({'classes.dex': code}, 'gplay')
def test_play_apk_supports_multidex(self):
self.verify({'classes.dex': b'Lorg/kryonlabs/play/PlayBilling;',
'classes2.dex': b'Lcom/android/billingclient/api/BillingClient;'}, 'gplay')
def test_play_bundle(self):
self.verify({'base/dex/classes.dex': b'Lorg/kryonlabs/play/PlayBilling;',
'base/dex/classes2.dex': b'Lcom/android/billingclient/api/BillingClient;'}, 'gplay', True)
def test_missing_dex_is_rejected(self):
with self.assertRaisesRegex(AssertionError, 'must include DEX'):
self.verify({'assets/readme': b'No code'})
def test_asset_text_does_not_count_as_google_code(self):
self.verify({'classes.dex': b'Lxyz/waozi/wurm/MainActivity;',
'assets/readme': b'Lcom/google/android/gms/'})
if __name__ == '__main__':
unittest.main()
+48 -14
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Sign and verify both Apfelwurm Android download names and the Google Play bundle, as Shovey does."""
"""Sign and verify Google-free Android downloads and the separate Google Play APK and bundle."""
import argparse
import hashlib
import json
@@ -22,7 +22,34 @@ def build_tools():
return tools
def verify(apk):
def verify_edition(archive, edition, bundle=False):
"""Inspect every DEX, including multidex, without loading the whole archive."""
markers = {
'Google': b'Lcom/google/',
'Play Billing': b'Lcom/android/billingclient/',
'Play Store': b'Lcom/android/vending/',
'Play bridge': b'Lorg/kryonlabs/play/PlayBilling;',
}
found = set()
overlap = max(map(len, markers.values())) - 1
pattern = r'base/dex/classes(?:\d+)?\.dex' if bundle else r'classes(?:\d+)?\.dex'
dex_names = [name for name in archive.namelist() if re.fullmatch(pattern, name)]
assert dex_names, 'Android releases must include DEX code'
for name in dex_names:
tail = b''
with archive.open(name) as dex:
while chunk := dex.read(1024 * 1024):
data = tail + chunk
found.update(label for label, marker in markers.items() if marker in data)
tail = data[-overlap:]
if edition == 'gplay':
assert {'Play Billing', 'Play bridge'} <= found, 'The Google Play edition must include Play Billing and its bridge'
else:
assert edition == 'direct', 'Unknown Android edition'
assert not found, 'Standard and F-Droid APKs must exclude Google libraries: ' + ', '.join(sorted(found))
def verify(apk, edition='direct'):
version = json.loads((ROOT / 'version.json').read_text())
tools = build_tools()
badging = subprocess.check_output([str(tools / 'aapt'), 'dump', 'badging', str(apk)], text=True)
@@ -31,6 +58,7 @@ def verify(apk):
assert int(package[2]) == version['version_code']
assert 'application-debuggable' not in badging, 'A debug APK cannot be released'
assert 'android.permission.INTERNET' in badging, 'Optional account sync and Dew require network access'
assert ('com.android.vending.BILLING' in badging) == (edition == 'gplay'), 'Play Billing permission must match the edition'
certificate = subprocess.check_output(['openssl', 'x509', '-in', str(ROOT / 'packaging/android/certificate.pem'), '-outform', 'DER'])
expected = hashlib.sha256(certificate).hexdigest()
signature = subprocess.check_output([str(tools / 'apksigner'), 'verify', '--verbose', '--print-certs', str(apk)], text=True)
@@ -38,6 +66,7 @@ def verify(apk):
assert 'Number of signers: 1' in signature and set(actual) == {expected}, 'Unexpected release certificate'
subprocess.run([str(tools / 'zipalign'), '-c', '-P', '16', '4', str(apk)], check=True, capture_output=True)
with zipfile.ZipFile(apk) as archive:
verify_edition(archive, edition)
abis = sorted(p.split('/')[1] for p in archive.namelist() if re.fullmatch(r'lib/[^/]+/libmain\.so', p))
assert abis == ['arm64-v8a', 'armeabi-v7a'], 'Both ARM architectures are required'
with tempfile.TemporaryDirectory(dir=ROOT / 'build') as directory:
@@ -63,7 +92,7 @@ def verify(apk):
assert archive.read('assets/' + name) == (ROOT / name).read_bytes(), name
assert archive.read('assets/assets/sounds/garden.pcm') == (ROOT / 'assets/sounds/garden.pcm').read_bytes()
assert archive.read('assets/assets/entity.zx') == (ROOT / 'build/profile/entity.zx').read_bytes(), 'The shared Profile must be packaged'
return dict(version=version['version'], version_code=version['version_code'], package=package[1], abis=abis,
return dict(version=version['version'], version_code=version['version_code'], edition=edition, package=package[1], abis=abis,
sha256=hashlib.sha256(apk.read_bytes()).hexdigest(), certificate_sha256=expected)
@@ -102,8 +131,7 @@ def verify_bundle(bundle, bundletool):
assert archive.read('base/assets/assets/art/' + name) == (ROOT / 'assets/art' / name).read_bytes(), name
assert not any(name.startswith('base/assets/assets/campaign-levels/') for name in archive.namelist()), 'Personal campaign edits must stay private'
assert archive.read('base/assets/assets/entity.zx') == (ROOT / 'build/profile/entity.zx').read_bytes(), 'The shared Profile must be packaged'
dex = b''.join(archive.read(name) for name in archive.namelist() if name.startswith('base/dex/'))
assert b'Lorg/kryonlabs/play/PlayBilling;' in dex, 'The Google Play edition must include Play Billing'
verify_edition(archive, 'gplay', bundle=True)
return dict(version=version['version'], version_code=version['version_code'], package='xyz.waozi.wurm', abis=abis,
sha256=hashlib.sha256(bundle.read_bytes()).hexdigest(), certificate_sha256=expected)
@@ -116,8 +144,11 @@ def main():
parser.add_argument('--password-file', type=Path, default=ROOT / 'backup/android-signing/password')
parser.add_argument('--output', type=Path, default=ROOT / 'build/downloads')
parser.add_argument('--bundletool', type=Path, help='Google bundletool JAR, required for .aab files')
parser.add_argument('--edition', choices=('direct', 'gplay'),
help='direct (default for APKs) or gplay; App Bundles always use gplay')
args = parser.parse_args()
if args.apk.suffix == '.aab':
assert args.edition != 'direct', 'App Bundles require the gplay edition'
assert args.bundletool, '--bundletool is required for a Google Play bundle'
bundle = args.apk.resolve(strict=True)
if args.action == 'sign':
@@ -141,32 +172,35 @@ def main():
print(f'Apfelwurm {result["version"]} ({result["version_code"]}): Google Play bundle identity, version, '
'both ARM architectures, upload signature, alignment and current assets verified.')
return
edition = args.edition or 'direct'
if args.action == 'verify':
verify(args.apk)
verify(args.apk, edition)
else:
args.output.mkdir(parents=True, exist_ok=True)
version = json.loads((ROOT / 'version.json').read_text())['version']
tools = build_tools()
aligned = args.output / 'aligned-unsigned.apk'
temporary = args.output / 'wurm.new.apk'
target = args.output / f'wurm-v{version}.apk'
suffix = '-gplay' if edition == 'gplay' else ''
aligned = args.output / f'aligned{suffix}-unsigned.apk'
temporary = args.output / f'wurm{suffix}.new.apk'
target = args.output / f'wurm-v{version}{suffix}.apk'
fdroid = args.output / f'wurm-{version}-fdroid.apk'
try:
subprocess.run([str(tools / 'zipalign'), '-P', '16', '-f', '4', str(args.apk.resolve()), str(aligned)], check=True)
subprocess.run([str(tools / 'apksigner'), 'sign', '--alignment-preserved', '--ks', str(args.keystore.resolve(strict=True)),
'--ks-key-alias', 'wurm', '--ks-pass', 'file:' + str(args.password_file.resolve(strict=True)),
'--out', str(temporary), str(aligned)], check=True)
result = verify(temporary)
result = verify(temporary, edition)
temporary.replace(target)
shutil.copyfile(target, fdroid)
assert verify(fdroid) == result
if edition == 'direct':
shutil.copyfile(target, fdroid)
assert verify(fdroid) == result
records = ROOT / 'backup/android-release'
records.mkdir(parents=True, exist_ok=True)
(records / 'verification.json').write_text(json.dumps(result, indent=2) + '\n')
(records / ('gplay-verification.json' if edition == 'gplay' else 'verification.json')).write_text(json.dumps(result, indent=2) + '\n')
finally:
aligned.unlink(missing_ok=True)
temporary.unlink(missing_ok=True)
print('Apfelwurm release APK: identity, version, both ARM architectures, signature, alignment and current assets verified.')
print(f'Apfelwurm {edition} release APK: edition, identity, version, both ARM architectures, signature, alignment and current assets verified.')
if __name__ == '__main__':
+9 -4
View File
@@ -26,9 +26,14 @@ def main():
parser.add_argument('--release', action='store_true', help='build the unsigned production APK for signing')
parser.add_argument('--bundle', action='store_true',
help="build the unsigned Google Play edition's App Bundle for signing")
parser.add_argument('--edition', choices=('direct', 'gplay'),
help='direct (default) excludes Google libraries; gplay includes Play Billing')
parser.add_argument('--verification', action='store_true',
help='build a separate test install without replacing the normal game')
args = parser.parse_args()
edition = args.edition or ('gplay' if args.bundle else 'direct')
if args.bundle and edition != 'gplay':
parser.error('--bundle requires the gplay edition')
version = json.loads((ROOT / 'version.json').read_text())
current = re.search(r'^## \[([0-9.]+)\]', (ROOT / 'CHANGELOG.md').read_text(), re.M)
assert current and current[1] == version['version'], 'Run update_version.sh first'
@@ -104,11 +109,11 @@ target_link_libraries(main oqs)
task = 'bundleRelease' if args.bundle else 'assembleRelease' if args.release else 'assembleDebug'
command = ['sh', 'droid/gradlew', '-p', 'droid', '--no-daemon', '--max-workers=1', task,
'-Pkryon.dir=' + str(kryon), '-Pziran.dir=' + str(ziran), '-Praylib.dir=' + str(raylib / 'src'),
'-Papp.abis=' + abis, '-Papp.minSdk=21', '-Papp.codegen=c99',
'-Papp.abis=' + abis, '-Papp.minSdk=21', '-Papp.codegen=c99', '-Papp.edition=' + edition,
'-Pandroid.aapt2FromMavenOverride=' + str(aapt)]
# Kryon's Google Play edition adds Play Billing, so Dew is bought through Play.
if args.bundle:
command += ['-Papp.edition=gplay', '-Pandroid.useAndroidX=true']
if edition == 'gplay':
command += ['-Pandroid.useAndroidX=true']
install_id = 'xyz.waozi.wurm.verification' if args.verification else 'xyz.waozi.wurm'
command.append('-Papp.installId=' + install_id)
subprocess.run(command, cwd=ROOT, env=environment, check=True)
@@ -121,7 +126,7 @@ target_link_libraries(main oqs)
label = 'Apfelwurm-verification-' if args.verification else 'Apfelwurm-'
variant = 'release' if args.release else 'debug'
suffix = '-release-unsigned.apk' if args.release else '-debug.apk'
target = ROOT / 'build/android' / (label + args.abi + suffix)
target = ROOT / 'build/android' / (label + args.abi + ('-gplay' if edition == 'gplay' else '') + suffix)
target.parent.mkdir(parents=True, exist_ok=True)
source = 'app-release-unsigned.apk' if args.release else 'app-debug.apk'
shutil.copy2(ROOT / 'droid/app/build/outputs/apk' / variant / source, target)
+2 -2
View File
@@ -1,4 +1,4 @@
{
"version": "0.2.10",
"version_code": 20
"version": "0.2.12",
"version_code": 22
}
+13 -13
View File
@@ -3,7 +3,7 @@
"packages": [
{
"commit": "dc1cfe389905c63c0bb453727d06d72afc1fa0b0",
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "pe41f6b4f7297cb1c"},
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "p7213416dd56f3a5c"},
"id": "p00b93f1ddcd2802f",
"name": "Apps",
"ref": "master",
@@ -18,9 +18,9 @@
"url": "https://github.com/ziranlang/qrcode.git"
},
{
"commit": "2f4b01e4e4a43c30da4f6ecdd1af1ba8936a9380",
"dependencies": {"daochi_client": "p9972fcdd2d5ba999", "kryon": "pe41f6b4f7297cb1c", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
"id": "p52832b02b35a796d",
"commit": "2062597cecba5ce1bf54a20e6d5a2bdda148a06b",
"dependencies": {"daochi_client": "p9972fcdd2d5ba999", "kryon": "p7213416dd56f3a5c", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
"id": "p523d96ecdb68b57a",
"name": "Entity",
"ref": "master",
"url": "https://github.com/waozixyz/entity.git"
@@ -42,6 +42,14 @@
"ref": "master",
"url": "https://github.com/ziranlang/oqs.git"
},
{
"commit": "5b2bfb71fef6111fcbaeb0446ba02ab6b0cd8f89",
"dependencies": {"raylib": "p5a77c9c35110e925"},
"id": "p7213416dd56f3a5c",
"name": "kryon",
"ref": "master",
"url": "https://github.com/kryonlabs/kryon.git"
},
{
"commit": "f5f0a19a5dc6c14a49adb3cd63ea79a60f6ba77b",
"dependencies": {},
@@ -75,14 +83,6 @@
"ref": "master",
"url": "https://github.com/kryonlabs/mingcute.git"
},
{
"commit": "cb10924389a7181a633ddcca6423cd286f0cfa6f",
"dependencies": {"raylib": "p5a77c9c35110e925"},
"id": "pe41f6b4f7297cb1c",
"name": "kryon",
"ref": "master",
"url": "https://github.com/kryonlabs/kryon.git"
},
{
"commit": "4778aa5044bf119c30df54219fa89357080af27f",
"dependencies": {},
@@ -94,7 +94,7 @@
}
],
"root": {
"dependencies": {"apps": "p00b93f1ddcd2802f", "entity": "p52832b02b35a796d", "kryon": "pe41f6b4f7297cb1c", "mingcute": "pe1027b9d16704793"},
"dependencies": {"apps": "p00b93f1ddcd2802f", "entity": "p523d96ecdb68b57a", "kryon": "p7213416dd56f3a5c", "mingcute": "pe1027b9d16704793"},
"name": "Apfelwurm"
},
"toolchain": {