Check clean F-Droid builds before publishing and simplify the README

This commit is contained in:
waozi committed 2026-10-22 15:37:08 -03:00
1 parent c57f354fff
commit e5e6856854
12 files changed
+485 -200

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
name: F-Droid
on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
- cron: '23 7 * * *'
workflow_dispatch:
workflow_call:
permissions:
contents: read
jobs:
build:
name: F-Droid security and clean build
runs-on: ubuntu-latest
timeout-minutes: 90
container:
# Official F-Droid buildserver, pinned for repeatable verification.
image: registry.gitlab.com/fdroid/fdroidserver@sha256:1ea8bef1820bff06c2974e31b4fc4c79c364cd24231b86e71fa4b926797e0dac
steps:
- name: Checkout candidate
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
with:
path: build/xyz.waozi.inbe
lfs: true
persist-credentials: false
- name: Install recipe dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends build-essential jimsh libssl-dev python3-fonttools openjdk-21-jdk-headless fdroidserver git-lfs
update-alternatives --set java /usr/lib/jvm/java-21-openjdk-amd64/bin/java
sdkmanager 'platforms;android-36' 'build-tools;34.0.0' 'ndk;28.2.13676358' 'cmake;3.22.1'
- name: Build and scan with F-Droid without cached package sources
run: python3 build/xyz.waozi.inbe/scripts/check-fdroid.py
- name: Preserve APK, exact metadata and scanner evidence
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: fdroid-unsigned
path: |
tmp/*.apk
logs/
metadata/
build/xyz.waozi.inbe/build/outputs/logs/
if-no-files-found: error
retention-days: 7
+37
View File
@@ -143,6 +143,42 @@ jobs:
build/practice-images-ui-test/
retention-days: 7
fdroid:
name: F-Droid
needs: secret-scan
uses: ./.github/workflows/fdroid.yml
verify-fdroid:
name: Verify F-Droid reproducibility
runs-on: ubuntu-latest
needs: [fdroid, build-android]
timeout-minutes: 15
steps:
- name: Download independent F-Droid build
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: fdroid-unsigned
path: fdroid
- name: Download signed Android release
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: release-android
path: signed
- name: Require the rebuilt APK to accept the release signature
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y apksigcopier apksigner
mapfile -t rebuilt < <(find fdroid/tmp -name '*.apk')
mapfile -t signed < <(find signed -name '*-fdroid.apk')
test "${#rebuilt[@]}" -eq 1
test "${#signed[@]}" -eq 1
apksigner verify --print-certs "${signed[0]}" | tee signer.txt
grep -Fx 'Signer #1 certificate SHA-256 digest: 47648dc7665db12a97c3077a4892ce29072c756bb31b5c331b8924493c888475' signer.txt
apksigcopier compare --unsigned "${signed[0]}" "${rebuilt[0]}"
build-web:
name: Build Web
runs-on: ubuntu-latest
@@ -884,6 +920,7 @@ jobs:
- build-linux-flatpak
- build-windows
- build-android
- verify-fdroid
outputs:
tag_pushed: ${{ steps.tag_version.outputs.tag_pushed }}
release_upload: ${{ steps.tag_version.outputs.release_upload }}
+1
View File
@@ -3,6 +3,7 @@
## [2.1.42] - 2026-10-22
- Keep practice animation smooth in the browser.
- Restore clean F-Droid builds.
## [2.1.41] - 2026-10-22
+45 -200
View File
@@ -13,219 +13,64 @@
# Inner Breeze
Inner Breeze brings together free, open-source apps for awareness and personal
growth: breathing, meditation, habits, reflection and everyday intentions.
It works offline, stores data locally in SQLite, and can
optionally sync user-owned data through a Daochi-compatible sync server.
Free, open-source apps for breathing, meditation, habits and everyday life.
Use them offline, keep your data on your device, and optionally connect an
account to sync across devices.
[Account activity](docs/ACCOUNT_ACTIVITY.md) explains persistent Telegram linking,
reopening an authorized installation, and seeing and controlling the running
practice from another device connected to the same account.
[Download the latest release](https://github.com/waozixyz/inbe/releases/latest)
· [What's new](CHANGELOG.md)
## Features
## Make space for yourself
- Lumi, a firefly companion with offline commands and optional online AI chat,
habit completion, practice starts, and optional todo tools
- Guided practice sessions with visual and audio cues
- Mind, Yoga, and Fitness organization for different practice routines
- Customizable breathing sessions, meditation timers, and habit counters
- Habit tracking with session history and linked practice counts
- Local import and export support
- Theme customization with light and dark variants
- Repeat the last completed practice using its current settings
- **Practice:** guided breathing, meditation, Astral Projection, Sun Salutation,
Tai Chi and a 7-Minute Workout, with animated guides and optional narration.
- **Habits:** track daily goals, practices and habits you want to avoid; follow
your history and choose your own rewards.
- **Diary and Photos:** write, reflect and keep pictures together, with shared
photo storage and automatic compression of new uploads.
- **Lists:** organize tasks and share lists with friends, choosing who can
read, edit or manage them.
- **Lumi:** a firefly companion for starting practices, managing habits and
changing your app. Offline commands work without an AI connection.
- **Your apps:** arrange Apps as a list or grid, choose colours and icons,
listen to ambient Radio, and explore Arcade games and achievements.
Lumi starts offline. Online AI requires agreement to the data sharing shown in
the app; you can use Inner Breeze's service or configure your own provider.
See the [privacy policy](site/static/privacy.html) and
[Lumi's connection modes](docs/cells.md#lumi).
## A look inside
For changes and bug reports, see [Contributing](CONTRIBUTING.md).
Report security issues through [Security](SECURITY.md).
<p align="center">
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/01-apps.png" alt="Apps you can arrange and personalize" width="30%">
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/03-practice-home.png" alt="Guided breathing and movement practices" width="30%">
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/04-sun-salutation.png" alt="Animated Sun Salutation practice" width="30%">
</p>
<p align="center"><em>Apps · Practices · Sun Salutation</em></p>
## Build
<p align="center">
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/05-habits.png" alt="Habit goals and daily history" width="30%">
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/07-diary.png" alt="Diary for everyday reflection" width="30%">
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/02-lumi-customize.png" alt="Lumi helping customize Inner Breeze" width="30%">
</p>
<p align="center"><em>Habits · Diary · Lumi</em></p>
The build checks Inbe's laws with the Ziran compiler (`ziran check`); no
separate proof tool is needed. The build host needs Python 3 and the platform's
native build dependencies. See [build laws](docs/build-laws-plan.md) for the
checked behavior.
## Your data and choices
Build commands fetch the dependencies pinned in `ziran.lock`.
Your data is stored locally. Account sync is optional. Lumi starts offline;
connecting an AI provider asks for your agreement to the data sharing shown
in the app. Use Inner Breeze's service or configure your own provider.
Build and run the desktop app:
[Privacy policy](site/static/privacy.html)
· [Account and sync](docs/ACCOUNT_ACTIVITY.md)
· [Appearance](docs/appearance.md)
```bash
## Build and contribute
```sh
make native
make run
```
Run the terminal backend:
```bash
make tui
```
Build Android artifacts:
```bash
make android-debug
PASSWORD=your-keystore-password make android-release
PASSWORD=your-keystore-password make android-bundle
```
Build the web app:
```bash
make web
make site
```
Run the test suite:
[Custom appearance](docs/appearance.md) describes live KSS editing, per-app
customizations, reset, and Lumi's appearance tools.
```bash
make test
make visual-test
```
CI and releases require the visual gate. It uses disposable profiles and
private Xvfb displays to check glyph pixels, every zoom from 50% to 250%,
selected navigation and app cards in all 13 palettes and both color modes,
enlarged Appearance labels, shipped locales, and page interactions. It keeps
screenshots and logs under `build/`; CI uploads them even when a check fails.
Every visual suite runs even if an earlier suite fails. The complete result,
including hashes of the tested binary and bundles, is in
`build/visual-test/results.json`; changing an artifact during the gate fails it.
Its system tools are listed in `.github/apt/test-packages.txt`.
Store captures cover Apps, Lumi, Practices, Habits, Lists, Diary, Appearance,
and supporting pages in phone, 7-inch tablet, 10-inch tablet, and Chromebook
layouts. Capture runs use disposable profiles on private Xvfb displays and
check viewport sizes, nonblank rendering, and expected screen text. They do
not copy images into the store listing until visual review is recorded:
```bash
make native cells PACKAGE_FLAGS=--locked
make screenshot
# Inspect build/screenshots/review-*.jpg and the full-size PNGs.
make screenshot-review REVIEWER="your name"
make screenshot-export
make play-preflight
python3 scripts/upload-play-screenshots.py
```
The scene list in `scripts/screenshot-scenes.json` selects eight store images
per phone/tablet type while retaining all 64 captures for review. Changing
source, scene definitions, Kryon, binaries, bundles, or screenshot bytes
invalidates publishing preflight. A historical capture can still be visually
reviewed and used for a review video; Play requires a fresh capture of the
current locked build. Local Kryon preview builds cannot pass Play preflight.
Preflight checks every dependency against its locked commit and runs a fresh
source check, so reused incremental preview outputs cannot hide missing imports.
Keep credentials in the ignored `.env.play` using `.env.play.example`.
The uploader defaults to validating and discarding its remote edit. After
review, `PLAY_COMMIT=1 python3 scripts/upload-play-screenshots.py` validates
and commits the listing; a failed edit is discarded. This updates listing
assets only. App releases follow the numeric changelog, `update_version.sh`,
and the existing release workflow, which builds and publishes the signed
Google Play AAB and owns release tags. A local build or commit is not a Play
deployment.
`make lumi-promo` renders a narrated portrait review MP4 from the exact
reviewed phone captures and the generated artwork in `design/lumi-promo/`.
Lumi uses eight generated wing-flapping frames, flies to each screen and settles
facing the app while a narrator explains it. Lumi turns with the flight direction
and flips inward after arriving on the right. Wings flap continuously using
distinct poses; each app screen stays in a fixed position without sliding in.
The audio contains speech only, without music or sound effects. Scene timings
expand to fit the complete spoken lines.
`make lumi-narration` generates the stored narrator clips through OpenRouter
using a locally configured `OPENROUTER_API_KEY`; unchanged clips are reused.
The voice, script and provider options are in `design/lumi-promo/narration.json`.
The chat example runs real local theme actions; the surrounding forest and
glow are marketing effects. Inspect `build/lumi-promo/storyboard.jpg` and
`build/lumi-promo/inner-breeze-lumi-review.mp4` before using it publicly.
Google Play's preview video field takes a YouTube URL, so the MP4 needs an
approved public or unlisted YouTube upload with embedding enabled before it can
be added to the listing. Pass `--video-url https://www.youtube.com/watch?v=VIDEO_ID`
to the listing uploader, or configure `PLAY_VIDEO_URL`. To update only the
video, use `PLAY_COMMIT=1 python3 scripts/upload-play-screenshots.py --video-only --video-url URL`.
The [Inner Breeze trailer](https://www.youtube.com/watch?v=GTly6Fu5zPk),
"A Day with Lumi", is public on YouTube and configured in every Google Play
listing language.
`design/promo-film/` holds the trailer's sources: `film.json` (clips, voice
times, app-screen inserts), `narrate.py` (Lumi's voice), `score.py` (music),
`mix.py`, `keyframes.py` and `compose.py`, which renders the cut with the real
app screens into `build/promo-video/`. `mix.py --short` and
`compose.py --short` render the 36-second vertical short from `short.json`,
the portrait keyframes in `keyframes-vertical/` and sections of the same score.
Screenshot publishing still requires the complete current
capture, visual review, export and locked build preflight.
To test sync and recovery against an isolated local server:
```bash
make sync-server-test DAOCHI_BIN=/absolute/path/to/daochi
```
This uses disposable client databases and a loopback server; see
[web and sync test coverage](WEB_RENDERER_TESTS.md) for details.
The Apps picker, independent ZIB packages, update settings, account choices and
publisher setup are described in [app packages](docs/cells.md).
Native binaries are written to `build/bin/<platform>/`. Release artifacts are
written under `build/dist/`.
Dependencies, including Kryon and the Ziran toolchain, are pinned in
`ziran.lock`. `make` fetches them into the Ziran package cache and links them
under `build/packages/`; `sh scripts/packages.sh` does the same by hand.
Builders that supply the sources themselves need no network: put Git checkouts
containing the locked commits (including Kryon's `raylib` submodule) in
`$ZIRAN_PACKAGE_SOURCES`, or declare them as F-Droid srclibs, which are found
in `../srclib` automatically.
To debug Inbe against the root Kryon checkout, map it in an ignored
`ziran.local.toml`:
```toml
[overrides]
kryon = "../../kryonlabs/kryon"
```
Use this only for local debugging. Permanent Kryon fixes should be committed in
the root Kryon repository and then brought into Inbe with `ziran update kryon`.
## Project Layout
- `src/` - app code
- `assets/` - images, fonts, and sounds
- `locales/` - translations
- `droid/` - Android project
- `site/` - website
- `ziran.toml`, `ziran.lock` - pinned Ziran toolchain and dependencies
## Support
Monero:
```text
48ms5LfFrPJ2LUvqP9Mm5BhDSnZnqu14jB8XpAukw3jDBKxRAxYvq3k4fEwXY7kCY3LrtycMUayJZR1YJuyvJHCDCcyw6pA
```
Bitcoin:
```text
bc1qxzcetg50f6epgddc09n82xqn3zswlmk44235y5
```
Lightning:
```text
[email protected]
```
## License
See the [build guide](docs/building.md) for Android, web, dependencies and tests,
the [F-Droid checks](docs/fdroid.md), and
[Contributing](CONTRIBUTING.md) to report bugs or make changes.
[Report security issues privately](SECURITY.md).
BSD 3-Clause. See [LICENSE](LICENSE).
+164
View File
@@ -0,0 +1,164 @@
# Building Inner Breeze
The build checks Inbe's laws with the Ziran compiler (`ziran check`); no
separate proof tool is needed. The build host needs Python 3 and the platform's
native build dependencies. See [build laws](build-laws-plan.md) for the
checked behavior.
Build commands fetch the dependencies pinned in `ziran.lock`.
Build and run the desktop app:
```bash
make native
make run
```
Run the terminal backend:
```bash
make tui
```
Build Android artifacts:
```bash
make android-debug
PASSWORD=your-keystore-password make android-release
PASSWORD=your-keystore-password make android-bundle
```
Build the web app:
```bash
make web
make site
```
Run the test suite:
[Custom appearance](appearance.md) describes live KSS editing, per-app
customizations, reset, and Lumi's appearance tools.
```bash
make test
make visual-test
```
CI and releases require the visual gate. It uses disposable profiles and
private Xvfb displays to check glyph pixels, every zoom from 50% to 250%,
selected navigation and app cards in all 13 palettes and both color modes,
enlarged Appearance labels, shipped locales, and page interactions. It keeps
screenshots and logs under `build/`; CI uploads them even when a check fails.
Every visual suite runs even if an earlier suite fails. The complete result,
including hashes of the tested binary and bundles, is in
`build/visual-test/results.json`; changing an artifact during the gate fails it.
Its system tools are listed in `.github/apt/test-packages.txt`.
Store captures cover Apps, Lumi, Practices, Habits, Lists, Diary, Appearance,
and supporting pages in phone, 7-inch tablet, 10-inch tablet, and Chromebook
layouts. Capture runs use disposable profiles on private Xvfb displays and
check viewport sizes, nonblank rendering, and expected screen text. They do
not copy images into the store listing until visual review is recorded:
```bash
make native cells PACKAGE_FLAGS=--locked
make screenshot
# Inspect build/screenshots/review-*.jpg and the full-size PNGs.
make screenshot-review REVIEWER="your name"
make screenshot-export
make play-preflight
python3 scripts/upload-play-screenshots.py
```
The scene list in `scripts/screenshot-scenes.json` selects eight store images
per phone/tablet type while retaining all 64 captures for review. Changing
source, scene definitions, Kryon, binaries, bundles, or screenshot bytes
invalidates publishing preflight. A historical capture can still be visually
reviewed and used for a review video; Play requires a fresh capture of the
current locked build. Local Kryon preview builds cannot pass Play preflight.
Preflight checks every dependency against its locked commit and runs a fresh
source check, so reused incremental preview outputs cannot hide missing imports.
Keep credentials in the ignored `.env.play` using `.env.play.example`.
The uploader defaults to validating and discarding its remote edit. After
review, `PLAY_COMMIT=1 python3 scripts/upload-play-screenshots.py` validates
and commits the listing; a failed edit is discarded. This updates listing
assets only. App releases follow the numeric changelog, `update_version.sh`,
and the existing release workflow, which builds and publishes the signed
Google Play AAB and owns release tags. A local build or commit is not a Play
deployment.
`make lumi-promo` renders a narrated portrait review MP4 from the exact
reviewed phone captures and the generated artwork in `design/lumi-promo/`.
Lumi uses eight generated wing-flapping frames, flies to each screen and settles
facing the app while a narrator explains it. Lumi turns with the flight direction
and flips inward after arriving on the right. Wings flap continuously using
distinct poses; each app screen stays in a fixed position without sliding in.
The audio contains speech only, without music or sound effects. Scene timings
expand to fit the complete spoken lines.
`make lumi-narration` generates the stored narrator clips through OpenRouter
using a locally configured `OPENROUTER_API_KEY`; unchanged clips are reused.
The voice, script and provider options are in `design/lumi-promo/narration.json`.
The chat example runs real local theme actions; the surrounding forest and
glow are marketing effects. Inspect `build/lumi-promo/storyboard.jpg` and
`build/lumi-promo/inner-breeze-lumi-review.mp4` before using it publicly.
Google Play's preview video field takes a YouTube URL, so the MP4 needs an
approved public or unlisted YouTube upload with embedding enabled before it can
be added to the listing. Pass `--video-url https://www.youtube.com/watch?v=VIDEO_ID`
to the listing uploader, or configure `PLAY_VIDEO_URL`. To update only the
video, use `PLAY_COMMIT=1 python3 scripts/upload-play-screenshots.py --video-only --video-url URL`.
The [Inner Breeze trailer](https://www.youtube.com/watch?v=GTly6Fu5zPk),
"A Day with Lumi", is public on YouTube and configured in every Google Play
listing language.
`design/promo-film/` holds the trailer's sources: `film.json` (clips, voice
times, app-screen inserts), `narrate.py` (Lumi's voice), `score.py` (music),
`mix.py`, `keyframes.py` and `compose.py`, which renders the cut with the real
app screens into `build/promo-video/`. `mix.py --short` and
`compose.py --short` render the 36-second vertical short from `short.json`,
the portrait keyframes in `keyframes-vertical/` and sections of the same score.
Screenshot publishing still requires the complete current
capture, visual review, export and locked build preflight.
To test sync and recovery against an isolated local server:
```bash
make sync-server-test DAOCHI_BIN=/absolute/path/to/daochi
```
This uses disposable client databases and a loopback server; see
[web and sync test coverage](WEB_RENDERER_TESTS.md) for details.
The Apps picker, independent ZIB packages, update settings, account choices and
publisher setup are described in [app packages](cells.md).
Native binaries are written to `build/bin/<platform>/`. Release artifacts are
written under `build/dist/`.
Dependencies, including Kryon and the Ziran toolchain, are pinned in
`ziran.lock`. `make` fetches them into the Ziran package cache and links them
under `build/packages/`; `sh scripts/packages.sh` does the same by hand.
Builders that supply the sources themselves need no network: put Git checkouts
containing the locked commits (including Kryon's `raylib` submodule) in
`$ZIRAN_PACKAGE_SOURCES`, or declare them as F-Droid srclibs, which are found
in `../srclib` automatically.
To debug Inbe against the root Kryon checkout, map it in an ignored
`ziran.local.toml`:
```toml
[overrides]
kryon = "../../kryonlabs/kryon"
```
Use this only for local debugging. Permanent Kryon fixes should be committed in
the root Kryon repository and then brought into Inbe with `ziran update kryon`.
## Project Layout
- `src/` - app code
- `assets/` - images, fonts, and sounds
- `locales/` - translations
- `droid/` - Android project
- `site/` - website
- `ziran.toml`, `ziran.lock` - pinned Ziran toolchain and dependencies
+45
View File
@@ -0,0 +1,45 @@
# F-Droid builds
`F-Droid security and clean build` uses the official F-Droid buildserver
container, the recipe in `packaging/fdroid-build.json`, and the real
`fdroid build --scan-binary` command. It runs on pull requests, master pushes
and a daily schedule. It starts with an empty Ziran source cache, so an
unpublished or unreachable dependency pin fails even if other builders have
an older cached copy.
The generated metadata takes the full source commit, version and Android
versionCode from the current candidate. F-Droid performs its normal source
cleaning, signing-configuration removal, source scan, unsigned universal
release build, APK metadata validation and binary scan. No scanner error is
ignored. The job retains its APK, metadata and logs as `fdroid-unsigned`.
Before the release workflow can publish, `Verify F-Droid reproducibility`
checks the signed F-Droid APK against the allowed signing certificate, then
uses `apksigcopier compare --unsigned` to verify that its signature also
validates the independently rebuilt APK. A mismatch blocks publication.
These checks run without signing credentials. The ordinary Android release
job alone receives the signing key.
## The 2.1.34 failure
[fdroiddata!53430](https://gitlab.com/fdroid/fdroiddata/-/merge_requests/53430)
failed in [the dependency preparation step](https://gitlab.com/fdroid/checkupdates-bot-fdroiddata/-/jobs/17306590795).
Its OQS pin, `5cc7677b290f0448462410f7c7e85f518664b943`, was no longer
reachable from the repository's advertised history after a history rewrite.
A fresh clone failed with `fatal: unable to read tree`, before Gradle ran.
The current lock pins the replacement history. Never rewrite public package
history after an application has released a lock referring to it.
The upstream F-Droid entry must use the full commit of a successfully
published release and its corresponding `inbe-VERSION-fdroid.apk` binary.
A passing GitHub check does not mean F-Droid has merged or distributed that
release; verify its own pipeline and publication separately.
## Local verification
F-Droid resets and cleans the source checkout. Never run it against the
owner's real checkout. `scripts/check-fdroid.py` only accepts a disposable
Actions checkout or a private Podman overlay mounted at
`WORKSPACE/build/xyz.waozi.inbe`. It refuses an ordinary checkout before
running Git or modifying any files.
@@ -1 +1,2 @@
- Keep practice animation smooth in the browser.
- Restore clean F-Droid builds.
+4
View File
@@ -1,5 +1,9 @@
# Source, asset and release tooling checks that make test runs.
.PHONY: fdroid-build-test
fdroid-build-test:
python3 tests/fdroid_build_test.py
.SILENT: package-check test font-bundle-check audio-test-fixture-check embedded-image-assets-check
package-check:
+1
View File
@@ -21,6 +21,7 @@ test: profile-host-test
test: launcher-policy-test launcher-entry-test android-text-selection-test
test: button-api-check
test: version-check version-test
test: fdroid-build-test
test: habit-merge-sql-test sync-restore-sql-test
test: proof-test
test: clean-text-api-check package-check secret-check storage-literals-check font-bundle-check audio-test-fixture-check embedded-image-assets-check icon-sheets-check
+12
View File
@@ -0,0 +1,12 @@
{
"subdir": "droid/app",
"sudo": [
"apt-get update",
"apt-get install -y build-essential jimsh libssl-dev python3-fonttools"
],
"gradle": ["yes"],
"output": "build/outputs/apk/release/app-universal-release-unsigned.apk",
"prebuild": ["bash ../../scripts/copy-android-assets.sh"],
"scandelete": ["build/ziran-bootstrap", "site/static/assets-sqljs-1.12.0"],
"gradleprops": ["fDroidBuild=true"]
}
+77
View File
@@ -0,0 +1,77 @@
#!/usr/bin/env python3
"""Run the real F-Droid build and source scanner in an isolated builder.
The caller supplies this checkout at WORKSPACE/build/xyz.waozi.inbe. F-Droid
cleans and resets it, so this entry point refuses the owner's ordinary checkout.
The local runner must use a private Podman :O mount; Actions uses its disposable
job checkout. Neither the Ziran source cache nor local overrides are reused.
"""
import json
import os
from pathlib import Path
import subprocess
ROOT = Path(__file__).resolve().parents[1]
APP_ID = "xyz.waozi.inbe"
REPO = "https://github.com/waozixyz/inbe.git"
def run(*argv, **kwargs):
return subprocess.run(argv, check=True, text=True, **kwargs)
def main():
workspace = Path.cwd().resolve()
if ROOT != workspace / "build" / APP_ID:
raise SystemExit("Refusing to reset an ordinary checkout; use the isolated F-Droid runner")
if os.environ.get("GITHUB_ACTIONS") != "true":
filesystem = subprocess.check_output(
["stat", "-f", "-c", "%T", ROOT], text=True).strip()
if not Path("/run/.containerenv").exists() or filesystem != "overlayfs":
raise SystemExit("Local F-Droid checks require a private Podman overlay")
for name in ("DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "DBUS_SESSION_BUS_ADDRESS",
"ZIRAN", "ZIRAN_PACKAGE_SOURCES"):
os.environ.pop(name, None)
os.environ["YUE_DESKTOP_RECOVERY"] = "0"
os.environ["XDG_CACHE_HOME"] = str(workspace / "cache")
if (workspace / "cache" / "ziran").exists():
raise SystemExit("F-Droid must start with an empty Ziran source cache")
if (ROOT / "ziran.local.toml").exists():
raise SystemExit("F-Droid must use the committed lock without local overrides")
run("git", "config", "--global", "--add", "safe.directory", str(ROOT))
commit = subprocess.check_output(["git", "-C", ROOT, "rev-parse", "HEAD"], text=True).strip()
version = subprocess.check_output(
["python3", "scripts/check-version.py", "--print-version"], cwd=ROOT, text=True).strip()
# Android's versionCode is synchronized by update_version.sh.
import re
code = int(re.search(r"versionCode\s+(\d+)",
(ROOT / "droid/app/build.gradle").read_text())[1])
recipe = json.loads((ROOT / "packaging/fdroid-build.json").read_text())
build = dict(versionName=version, versionCode=code, commit=commit, **recipe)
metadata = {
"Categories": ["Sports & Health"], "License": "BSD-3-Clause",
"SourceCode": "https://github.com/waozixyz/inbe",
"AutoName": "Inner Breeze", "RepoType": "git", "Repo": REPO,
"Builds": [build], "AutoUpdateMode": "Version", "UpdateCheckMode": "Tags",
"CurrentVersion": version, "CurrentVersionCode": code,
}
from fdroidserver import metadata as fdroid_metadata
folder = workspace / "metadata"
folder.mkdir(exist_ok=True)
fdroid_metadata.write_metadata(folder / (APP_ID + ".yml"), fdroid_metadata.App(metadata))
(workspace / "build" / (".fdroidvcs-" + APP_ID)).write_text("git " + REPO + "\n")
# The already checked-out commit is the exact candidate, which may not
# have been pushed yet. F-Droid still performs its normal reset and clean.
(workspace / "config.yml").write_text(
"sdk_path: /opt/android-sdk\n"
"gradle: /home/vagrant/gradlew-fdroid/gradlew-fdroid\n")
run("fdroid", "build", "--verbose", "--test", "--no-refresh", "--no-tarball",
"--scan-binary", APP_ID + ":" + str(code))
apk = workspace / "tmp" / (APP_ID + "_" + str(code) + ".apk")
if not apk.is_file():
raise SystemExit("F-Droid did not produce the expected unsigned APK")
print("F-Droid source and APK scans and unsigned build passed:", apk, flush=True)
if __name__ == "__main__":
main()
+45
View File
@@ -0,0 +1,45 @@
"""Guard the isolated source scanner and the pre-publication release gate."""
import json
import os
from pathlib import Path
import subprocess
import unittest
ROOT = Path(__file__).resolve().parents[1]
class FDroidBuildTest(unittest.TestCase):
def test_refuses_the_owner_checkout_even_with_ci_environment(self):
for actions in ("false", "true"):
with self.subTest(actions=actions):
result = subprocess.run(
["python3", "scripts/check-fdroid.py"], cwd=ROOT,
env=os.environ | {"GITHUB_ACTIONS": actions},
text=True, capture_output=True)
self.assertNotEqual(result.returncode, 0)
self.assertIn("Refusing to reset an ordinary checkout", result.stderr)
def test_recipe_keeps_source_scanning_and_the_store_variant(self):
recipe = json.loads((ROOT / "packaging/fdroid-build.json").read_text())
self.assertEqual(recipe["gradleprops"], ["fDroidBuild=true"])
self.assertEqual(recipe["gradle"], ["yes"])
self.assertEqual(recipe["output"],
"build/outputs/apk/release/app-universal-release-unsigned.apk")
self.assertNotIn("scanignore", recipe)
self.assertEqual(recipe["scandelete"],
["build/ziran-bootstrap", "site/static/assets-sqljs-1.12.0"])
def test_release_waits_for_independent_signature_verification(self):
# Inspect the actual publication job, rather than a parallel CI result
# that could stay red while the release still publishes.
workflow = (ROOT / ".github/workflows/release.yml").read_text()
release = workflow.split("\n release:\n", 1)[1].split("\n outputs:", 1)[0]
self.assertIn(" - verify-fdroid", release.splitlines())
verifier = workflow.split("\n verify-fdroid:\n", 1)[1].split("\n build-web:\n", 1)[0]
self.assertIn("needs: [fdroid, build-android]", verifier)
self.assertIn("apksigcopier compare --unsigned", verifier)
self.assertIn("apksigner verify --print-certs", verifier)
if __name__ == "__main__":
unittest.main()