generated from ali/HarmonyTemplate
提交 Haven Android 仓库源码 v5.87.79
This commit is contained in:
+404
@@ -0,0 +1,404 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
# Nightly broad net: full lint, the R8 smoke, and an all-ABI build — the
|
||||
# slow/low-per-commit-signal work pulled off every main push (below) still
|
||||
# runs within 24h, so a lint regression or an x64/armv7-specific breakage
|
||||
# the arm64-only per-push build would miss is caught daily.
|
||||
schedule:
|
||||
- cron: '0 3 * * *' # 03:00 UTC daily
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
# Event-scoped so a main push doesn't cancel an in-flight nightly (both
|
||||
# resolve github.ref to refs/heads/main and would otherwise collide).
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
||||
cancel-in-progress: true
|
||||
|
||||
# Least-privilege floor. Every job here only reads the repo and uploads
|
||||
# artifacts (which use the Actions runtime token, not GITHUB_TOKEN), so a
|
||||
# read-only token is sufficient. Jobs needing more would declare their own.
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
# Fast supply-chain guards — no toolchain, runs in parallel with the build
|
||||
# jobs and fails the run early if hardening regresses.
|
||||
supply-chain:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
submodules: false
|
||||
# Every external action must be pinned to a 40-char commit SHA. A bare
|
||||
# `@v1`/`@main`/`@master` ref is mutable and re-pointable (tj-actions
|
||||
# CVE-2025-30066 class). Local `./.github/actions/*` refs are exempt.
|
||||
- name: Assert external actions are SHA-pinned
|
||||
run: |
|
||||
if grep -rEn 'uses: [^.].+@(v[0-9]|main|master)' .github/workflows .github/actions; then
|
||||
echo "::error::Unpinned external action ref(s) above — pin to a 40-char SHA (# vX.Y.Z)."
|
||||
exit 1
|
||||
fi
|
||||
# A submodule here is not vendored data. settings.gradle.kts pulls
|
||||
# several in with includeBuild(), so their own build.gradle.kts files are
|
||||
# EXECUTED on this runner — the URL in .gitmodules decides whose build
|
||||
# logic runs with CI's privileges.
|
||||
#
|
||||
# Not hypothetical: PR #589 repointed termlib at a contributor's fork so
|
||||
# CI could fetch a review SHA, and every job went green while building
|
||||
# it. The checkmarks vouching for that PR were produced by executing the
|
||||
# unreviewed code they were vouching for. Pinning the SHA keeps the
|
||||
# content honest — git is content-addressed, so nobody can swap what is
|
||||
# at a given commit — but it does not make the source ours.
|
||||
#
|
||||
# The registration is also sticky: `git submodule init` will not
|
||||
# overwrite a URL a checkout already has, so a repoint outlives the
|
||||
# commit that introduced it. That is how #525 froze F-Droid's build
|
||||
# channel for a day while every build of ours stayed green.
|
||||
- name: Assert submodules point at first-party repos
|
||||
run: |
|
||||
foreign=$(git config -f .gitmodules --get-regexp '\.url$' \
|
||||
| grep -vE ' https://github\.com/GlassOnTin/' || true)
|
||||
if [ -n "$foreign" ]; then
|
||||
echo "$foreign"
|
||||
echo "::error::Submodule URL(s) above are not under github.com/GlassOnTin. A submodule's build scripts execute on this runner; merge the commit into our fork and point at that SHA instead."
|
||||
exit 1
|
||||
fi
|
||||
# Validate the gradle-wrapper.jar that CI actually executes against
|
||||
# Gradle's published checksums (wrapper-attack class). Submodule wrappers
|
||||
# aren't executed by CI, so the root jar is the one that matters.
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/actions/wrapper-validation@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
|
||||
|
||||
# rdp-kotlin's Rust suite had no CI step at all, so it was gated by whoever
|
||||
# last remembered to run it by hand. Not hypothetical: the #422 test
|
||||
# asserting an under-declared totalLength must *not* decode kept asserting it
|
||||
# after the IronRDP pin moved to make it decode, and stayed green-by-absence
|
||||
# until someone ran it locally.
|
||||
#
|
||||
# Its own job rather than a step in `test`: that job already runs 14-30m
|
||||
# against a 45m cap and has been stamped `cancelled` once for finishing two
|
||||
# seconds late (see its comment), so it is the wrong place to add minutes.
|
||||
# This needs no submodules, no NDK and no Gradle, so standalone it is cheap
|
||||
# and runs in parallel.
|
||||
rdp-rust-test:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
submodules: false
|
||||
# No toolchain setup step: rdp-kotlin/rust/rust-toolchain.toml pins the
|
||||
# channel and rustup installs it on first use. That file is also why this
|
||||
# runs from the crate directory rather than with --manifest-path from the
|
||||
# root — rustup resolves the toolchain from the working directory, so the
|
||||
# root would silently get the runner's default rustc, which IronRDP's
|
||||
# rust-version then rejects.
|
||||
- name: Run RDP transport Rust tests
|
||||
working-directory: rdp-kotlin/rust
|
||||
run: cargo test
|
||||
|
||||
# Prns C-ABI capsule tests on the host toolchain. Scoped to the detached
|
||||
# abi/c workspace (its own committed Cargo.lock) — the full upstream
|
||||
# workspace carries embedded targets this runner can't build.
|
||||
prns-rust-test:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
submodules: false
|
||||
- name: Checkout prns submodule
|
||||
run: git submodule update --init prns
|
||||
- name: Run Prns capsule tests
|
||||
working-directory: prns/prns-host/abi/c
|
||||
run: cargo test
|
||||
|
||||
# Host-built proot exercising the link2symlink emulation: refcounts,
|
||||
# PROOT_L2S_DIR payload relocation (the Nix/libgit2 tarball-cache
|
||||
# durability fix, discussion #536), and broken-chain fail-soft. Runs on
|
||||
# the host kernel — ptrace works on GitHub runners; no Android needed.
|
||||
proot-l2s-test:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
submodules: false
|
||||
- name: Checkout proot submodule
|
||||
run: git submodule update --init build-proot/proot-termux
|
||||
- name: Install talloc, busybox, and lld
|
||||
# gcc-multilib: the x86_64 build also compiles a 32-bit loader
|
||||
# (HAS_LOADER_32BIT) and needs the i386 libc headers.
|
||||
#
|
||||
# Bounded like setup-toolchain's apt step: apt has no default
|
||||
# network timeout, and this exact step sat stalled until the
|
||||
# 15-minute job cap killed it TWICE on 2026-08-19 (runs
|
||||
# 32233158153, 32236122541) — the second time WITH Acquire
|
||||
# timeouts in place and zero output, so a hard timeout(1) wall
|
||||
# per attempt is what actually bounds it.
|
||||
run: |
|
||||
APT_OPTS="-o Acquire::Retries=3 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30"
|
||||
apt_run() {
|
||||
wall="$1"; shift
|
||||
for attempt in 1 2 3; do
|
||||
sudo timeout -k 30 "$wall" apt-get $APT_OPTS "$@" && return 0
|
||||
echo "apt-get $1 failed or timed out (attempt $attempt)"
|
||||
pgrep -a 'apt|dpkg' || true
|
||||
# Fail over to the canonical archive when the azure mirror
|
||||
# stalls (see setup-toolchain for the incident detail).
|
||||
echo 'http://archive.ubuntu.com/ubuntu/ priority:1' | sudo tee /etc/apt/apt-mirrors.txt
|
||||
sudo timeout -k 30 180 apt-get $APT_OPTS update -qq || true
|
||||
sleep 5
|
||||
done
|
||||
echo "apt-get $1 failed after 3 attempts"
|
||||
return 1
|
||||
}
|
||||
apt_run 180 update -qq
|
||||
apt_run 600 install -y -qq libtalloc-dev busybox-static clang lld gcc-multilib
|
||||
# clang+lld, not gcc+GNU-ld: the loader's hardcoded --rosegment is an
|
||||
# LLD flag (the production NDK toolchain is clang+lld too) and older
|
||||
# GNU ld rejects it.
|
||||
- name: Build host proot
|
||||
run: make -C build-proot/proot-termux/src proot CC="clang -fuse-ld=lld"
|
||||
- name: Run link2symlink tests
|
||||
run: |
|
||||
cd build-proot/proot-termux/tests
|
||||
for t in test-l2s-refcount.sh test-l2s-dir.sh test-l2s-broken-chain.sh test-l2s-guest-dir.sh; do
|
||||
echo "=== $t"
|
||||
env PROOT="$PWD/../src/proot" sh -e "$t"
|
||||
done
|
||||
|
||||
# Three independent Gradle entry-points run as parallel jobs instead of
|
||||
# sequentially in one. Each restores the shared toolchain + caches from
|
||||
# the composite action; the second run of each job type reuses the cache
|
||||
# populated by the first, so the duplicated cache-restore cost is minimal.
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
# 45, not 30: on 4e06876c this job did 30m07s of real work against a 30m
|
||||
# cap and was stamped `cancelled` two seconds into cleanup — with every
|
||||
# step green and "BUILD SUCCESSFUL in 15m 14s" already in the log. That
|
||||
# reads as a red main for a run that actually passed. The spend is
|
||||
# genuine, not a hang: ~10.5m initialising submodules (the wayland tree
|
||||
# alone is a dozen nested repos), ~3.5m toolchain, ~15m tests. Observed
|
||||
# totals range 14m-30m depending on Gradle cache hits, so the cap has to
|
||||
# clear the top of that spread, not sit on it. Cutting the submodule cost
|
||||
# is the real fix; this stops it failing releases meanwhile.
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
submodules: false
|
||||
- uses: ./.github/actions/init-submodules-with-retry
|
||||
- uses: ./.github/actions/setup-toolchain
|
||||
- name: Run unit tests
|
||||
# :app uses ABI product flavors, so the unqualified `testDebugUnitTest`
|
||||
# matches no :app task and silently skips the agent/MCP unit tests.
|
||||
# Name the flavor task explicitly (arm64 only — unit tests are
|
||||
# flavor-agnostic) so they actually run in CI.
|
||||
#
|
||||
# The sshlib contract tests are excluded here and run in their own
|
||||
# non-gating step below. They exercise the opt-in preview SSH engine
|
||||
# against an upstream race in sshlib 0.4.1 — its output pump is
|
||||
# cancelled on CHANNEL_CLOSE and drops whatever it is still holding, so
|
||||
# a command's stdout or stderr comes back empty or truncated at random
|
||||
# (connectbot/cbssh#245, tracked in #448). Haven narrows the window but
|
||||
# cannot close it from outside the library, and 0.4.1 is the latest
|
||||
# release. Three failures in one day, on three different assertions,
|
||||
# blocked a release that changed nothing in core/ssh — so this engine's
|
||||
# known flakiness no longer gates shipping for the default JSch engine.
|
||||
# Restore it here the moment a fixed sshlib is out.
|
||||
run: >-
|
||||
./gradlew testDebugUnitTest :app:testArm64FullDebugUnitTest
|
||||
-PexcludeSshlibContractTests=true
|
||||
-PskipWaylandNatives=true
|
||||
-PskipFfmpegNatives=true
|
||||
- name: Run sshlib contract tests (non-gating, connectbot/cbssh#245)
|
||||
# Reported, never silent: a failure here is visible in the job summary
|
||||
# and the uploaded results, it just does not fail the build. If these
|
||||
# start failing *every* run rather than intermittently, that is a real
|
||||
# regression and not the upstream race — check before dismissing it.
|
||||
#
|
||||
# That last sentence used to be the reader's job. Since #475 the
|
||||
# test-retry plugin gives SshlibExecContractTest three attempts (and
|
||||
# only that class — verified by making a test in another core:ssh class
|
||||
# fail and watching it run once), so a red step here already means
|
||||
# "failed three times in a row" rather than "flaked once". The signal
|
||||
# is now worth acting on instead of squinting at.
|
||||
continue-on-error: true
|
||||
run: ./gradlew :core:ssh:testDebugUnitTest --tests 'sh.haven.core.ssh.sshlib.*' -PskipWaylandNatives=true -PskipFfmpegNatives=true
|
||||
- name: Upload test results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: test-results
|
||||
path: '**/build/reports/tests/'
|
||||
retention-days: 14
|
||||
|
||||
# Fast source-level gates — no Android toolchain, no submodules, ~30s. Split
|
||||
# out of the lint job so they keep running on EVERY push (a version bump
|
||||
# without CHANGELOG notes, a hardcoded string, or stale i18n export must fail
|
||||
# fast) even though the slow lintDebug moved to PR + nightly.
|
||||
checks:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
submodules: false
|
||||
- name: Check CHANGELOG has notes for the current version
|
||||
run: ./scripts/check-changelog.sh
|
||||
- name: Check for hardcoded UI strings (#210)
|
||||
run: ./scripts/check-i18n-hardcoded.sh
|
||||
- name: Check every English key exists in all 11 locales
|
||||
# Android's MissingTranslation lint is downgraded to a warning in
|
||||
# build.gradle.kts and lintDebug only runs on PRs, so direct pushes to
|
||||
# main used to ship untranslated keys silently — 37 keys had drifted out
|
||||
# of all 11 locales at once. This runs per-push instead.
|
||||
run: python3 scripts/check-i18n-coverage.py
|
||||
# check-native-libs.sh is NOT here: this job does not build, and since
|
||||
# #493 stopped committing the wayland .so there is nothing for it to read
|
||||
# at this point. It printed "does not exist; nothing to check" on every
|
||||
# run — a gate reporting success for doing nothing. It now runs in `build`,
|
||||
# after the binaries exist.
|
||||
- name: Check no new binaries are committed
|
||||
# Binaries are unauditable in review and go stale silently (#469).
|
||||
# Blocks any NEW one; the pre-existing set is grandfathered in the
|
||||
# script and that list can only shrink.
|
||||
run: ./scripts/check-no-committed-binaries.sh
|
||||
- name: Check translation export is current
|
||||
# docs/i18n/strings.json feeds the Pages translation page. Regenerate
|
||||
# and fail if it drifted from the strings.xml sources (rerun
|
||||
# scripts/i18n_export.py and commit the result).
|
||||
run: |
|
||||
python3 scripts/i18n_export.py
|
||||
git diff --exit-code docs/i18n/strings.json
|
||||
|
||||
# Full Android lint is slow (~13 min) and rarely catches a per-commit
|
||||
# regression the tests don't — so it runs on PRs and the nightly schedule,
|
||||
# not on every direct main push. The fast source gates above still run
|
||||
# per-push. github.event_name is 'push' only for direct main pushes.
|
||||
lint:
|
||||
if: github.event_name != 'push'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
submodules: false
|
||||
- uses: ./.github/actions/init-submodules-with-retry
|
||||
- uses: ./.github/actions/setup-toolchain
|
||||
- name: Run lint
|
||||
# Skip the from-source native builds. Android lint analyses sources,
|
||||
# resources and the manifest — it never opens a .so. Since #493 wired
|
||||
# those builds into preBuild they were costing this job ~20 minutes it
|
||||
# had no use for, and lint died on its own 30-minute timeout three
|
||||
# nights running without ever reaching the lint step (the log ends
|
||||
# inside clang++). A job killed by a timeout reports `cancelled`, which
|
||||
# reads as "superseded" — so the nightly lint gate stopped producing a
|
||||
# verdict and nothing said so.
|
||||
run: ./gradlew lintDebug -PskipWaylandNatives=true -PskipFfmpegNatives=true
|
||||
- name: Upload lint results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: lint-results
|
||||
path: |
|
||||
**/build/reports/lint-results-debug.html
|
||||
**/build/reports/lint-results-debug.xml
|
||||
if-no-files-found: ignore
|
||||
retention-days: 14
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
submodules: false
|
||||
- uses: ./.github/actions/init-submodules-with-retry
|
||||
- uses: ./.github/actions/setup-toolchain
|
||||
# Build arm64 only in CI — the x64 flavor exists for emulator support
|
||||
# and Play Store fat distribution, not smoke-testing main. Cuts build
|
||||
# work roughly in half vs :app:assembleDebug (which expands to both).
|
||||
- name: Build arm64 debug APK
|
||||
# -PtargetAbi drives core/wayland's buildWaylandNatives, which builds the
|
||||
# five arm64-only wayland binaries from the submodule instead of shipping
|
||||
# committed copies. This job is what proves they still compile (#493).
|
||||
run: ./gradlew :app:assembleArm64FullDebug -PtargetAbi=arm64
|
||||
# Runs here rather than in `checks` because it reads the built binaries,
|
||||
# and nothing builds them there. #469 was a wayland library linked without
|
||||
# gen-stubs.sh's weak stubs: 51 undefined symbols, dlopen refused it, and
|
||||
# every cage/app-window feature died on-device with a green build. Source
|
||||
# now, rather than a committed copy, does not make that unlinkable-output
|
||||
# case impossible — only unobservable until someone runs it.
|
||||
- name: Assert native libs resolve their stubs (#469)
|
||||
run: ./scripts/check-native-libs.sh
|
||||
- name: Upload debug APK
|
||||
if: success()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: app-debug
|
||||
path: app/build/outputs/apk/arm64Full/debug/haven-*-arm64-debug.apk
|
||||
retention-days: 7
|
||||
|
||||
# Nightly-only: build the ABIs the per-push `build` job skips (x64, armv7)
|
||||
# so an x64/armv7-specific compile or native-cross break surfaces within 24h
|
||||
# instead of only at release. arm64 is already covered per-push by `build`
|
||||
# (which also runs on the schedule), so it's not repeated here.
|
||||
nightly-abi:
|
||||
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- { abi: x64, variant: X64 }
|
||||
- { abi: armv7, variant: Armv7 }
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
submodules: false
|
||||
- uses: ./.github/actions/init-submodules-with-retry
|
||||
- uses: ./.github/actions/setup-toolchain
|
||||
- name: Build ${{ matrix.abi }} debug APK
|
||||
run: ./gradlew :app:assemble${{ matrix.variant }}FullDebug -PtargetAbi=${{ matrix.abi }}
|
||||
|
||||
# Debug builds don't run R8, so an R8 rename of a reflectively-loaded class
|
||||
# can ship a feature 100% broken in release while every debug check stays
|
||||
# green — exactly how the email feature broke once (R8 renamed
|
||||
# com.sun.mail.imap.IMAPSSLStore → getStore("imaps") threw, fixed v5.59.45).
|
||||
# This runs R8 on the release variant and asserts the by-name-loaded classes
|
||||
# survive (no keystore — minify precedes signing).
|
||||
#
|
||||
# Every published release is already R8-checked in release.yml (the assert
|
||||
# moved there), so this job is early-feedback only: PRs (catch a -keep
|
||||
# regression before merge) + the nightly schedule (the direct-main-push
|
||||
# safety net), skipping direct main pushes where it paced every run ~16 min.
|
||||
# github.event_name is 'push' only for direct main pushes.
|
||||
release-r8-smoke:
|
||||
if: github.event_name != 'push'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
submodules: false
|
||||
- uses: ./.github/actions/init-submodules-with-retry
|
||||
- uses: ./.github/actions/setup-toolchain
|
||||
- name: R8 the release variant
|
||||
# Same skip as lint, same reason: R8 shrinks bytecode and never reads
|
||||
# jniLibs, but it sits downstream of preBuild and was paying for the
|
||||
# native builds anyway. This job hit its 30-minute timeout on the same
|
||||
# three nights, so the R8-keep assertion below has not actually run
|
||||
# since the from-source work landed.
|
||||
run: ./gradlew :app:minifyArm64FullReleaseWithR8 -PskipWaylandNatives=true -PskipFfmpegNatives=true
|
||||
- name: Assert reflectively-loaded classes survived R8
|
||||
run: ./scripts/check-r8-kept-classes.sh
|
||||
@@ -0,0 +1,74 @@
|
||||
name: Extract release-signing secrets (one-shot)
|
||||
|
||||
# Manual-only workflow that bundles the release keystore + signing passwords
|
||||
# into a passphrase-encrypted tarball, uploads it as a 1-day artifact, then
|
||||
# discards the cleartext. The encryption passphrase is the BUNDLE_PASSPHRASE
|
||||
# repo secret (NOT a workflow_dispatch input — dispatch inputs are recorded in
|
||||
# run metadata, which is public on a public repo). Decrypt locally with the
|
||||
# same secret value:
|
||||
#
|
||||
# openssl enc -aes-256-cbc -pbkdf2 -iter 200000 -d \
|
||||
# -pass pass:"$BUNDLE_PASSPHRASE" \
|
||||
# -in bundle.tar.gz.enc -out bundle.tar.gz
|
||||
# tar -xzf bundle.tar.gz
|
||||
#
|
||||
# The `haven-release.env` file inside is `source`-able and sets the same env
|
||||
# vars the release workflow consumes.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
extract:
|
||||
runs-on: ubuntu-latest
|
||||
# Reviewer-gated via the `signing` Environment so exporting the signing
|
||||
# identity can't happen without an approval.
|
||||
environment: signing
|
||||
steps:
|
||||
- name: Sanity-check passphrase is set and long enough
|
||||
env:
|
||||
PASSPHRASE: ${{ secrets.BUNDLE_PASSPHRASE }}
|
||||
run: |
|
||||
if [ "${#PASSPHRASE}" -lt 16 ]; then
|
||||
echo "BUNDLE_PASSPHRASE secret is unset or shorter than 16 characters." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Bundle keystore + passwords (encrypted in-place)
|
||||
env:
|
||||
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||
PASSPHRASE: ${{ secrets.BUNDLE_PASSPHRASE }}
|
||||
run: |
|
||||
umask 077
|
||||
# Reconstruct the keystore from base64.
|
||||
printf '%s' "$KEYSTORE_BASE64" | base64 -d > haven-release.jks
|
||||
|
||||
# Write a source-able env file. printf %q shell-escapes each value
|
||||
# so passwords containing $, !, ', etc. round-trip correctly.
|
||||
{
|
||||
printf 'export KEYSTORE_PASSWORD=%q\n' "$KEYSTORE_PASSWORD"
|
||||
printf 'export KEY_ALIAS=%q\n' "$KEY_ALIAS"
|
||||
printf 'export KEY_PASSWORD=%q\n' "$KEY_PASSWORD"
|
||||
} > haven-release.env
|
||||
|
||||
tar -czf bundle.tar.gz haven-release.jks haven-release.env
|
||||
openssl enc -aes-256-cbc -pbkdf2 -iter 200000 \
|
||||
-pass env:PASSPHRASE \
|
||||
-in bundle.tar.gz -out bundle.tar.gz.enc
|
||||
|
||||
# Wipe cleartext.
|
||||
shred -u haven-release.jks haven-release.env bundle.tar.gz
|
||||
|
||||
- name: Upload encrypted bundle
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: signing-bundle
|
||||
path: bundle.tar.gz.enc
|
||||
retention-days: 1
|
||||
if-no-files-found: error
|
||||
+324
@@ -0,0 +1,324 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: [ 'v*' ]
|
||||
workflow_dispatch:
|
||||
|
||||
# Shared by both jobs.
|
||||
env:
|
||||
# Force any JS action still declaring node20 onto Node.js 24 (GitHub
|
||||
# deprecated node20 runners 2026-06-02). All pinned actions are node24-native
|
||||
# as of the v7/v8/v3 bumps; kept as a safety net for future additions.
|
||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
||||
|
||||
# Least-privilege floor. verify-ci/test/build only read; publish raises its
|
||||
# own block for the release upload + provenance.
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
# Skip a full ~16 min unit-test re-run when CI has already
|
||||
# verified the tagged commit on main — same commit, same test invocation
|
||||
# would produce the same result. Falls through to a real test run if
|
||||
# CI hasn't reported yet (rare: tag created without a prior main push)
|
||||
# or reported anything other than success.
|
||||
verify-ci:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
outputs:
|
||||
ci-passed: ${{ steps.check.outputs.passed }}
|
||||
steps:
|
||||
- name: Check CI status on tagged commit
|
||||
id: check
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
# Ask the CI workflow directly whether it passed on THIS commit.
|
||||
#
|
||||
# Do NOT use /commits/{sha}/status: that endpoint aggregates the legacy
|
||||
# Statuses API, and GitHub Actions publishes *check runs*, not statuses.
|
||||
# This repo has zero statuses, so it answered "pending" for every commit
|
||||
# ever tagged — meaning this job never once skipped the test re-run it
|
||||
# exists to skip, and every release paid ~16 minutes for nothing.
|
||||
#
|
||||
# /commits/{sha}/check-runs is the check-run equivalent but includes this
|
||||
# very workflow's own in-flight runs, so it can never be all-green either.
|
||||
# Filtering the CI workflow's completed runs by head_sha asks exactly the
|
||||
# question we mean: "did CI pass on this commit?"
|
||||
conclusion=$(gh api \
|
||||
"repos/${GITHUB_REPOSITORY}/actions/workflows/ci.yml/runs?head_sha=${GITHUB_SHA}&status=completed" \
|
||||
--jq '.workflow_runs[0].conclusion // "none"' 2>/dev/null || echo "unknown")
|
||||
echo "CI conclusion for ${GITHUB_SHA:0:7}: ${conclusion}"
|
||||
if [ "$conclusion" = "success" ]; then
|
||||
echo "passed=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
# Fail safe: anything else (no CI run yet, failure, API trouble) runs
|
||||
# the tests for real rather than shipping on an unverified commit.
|
||||
echo "passed=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
# Unit tests run once — flavor-agnostic, not worth duplicating per ABI.
|
||||
# Skipped entirely when CI already reported success for this SHA.
|
||||
# Runs on the free 4-core runner; larger runners are paid-tier and were
|
||||
# silently queueing release builds once that budget was exhausted.
|
||||
test:
|
||||
needs: verify-ci
|
||||
if: needs.verify-ci.outputs.ci-passed != 'true'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
submodules: false
|
||||
# Unit tests don't compile the Wayland native build, so we skip
|
||||
# `wayland-android` entirely — its freedesktop submodule chain
|
||||
# (cairo, mesa-drm, fontconfig, libinput) goes through
|
||||
# gitlab.freedesktop.org which intermittently 5xxs and breaks
|
||||
# this job for non-test reasons. The build job below still does
|
||||
# the full recursive init.
|
||||
- uses: ./.github/actions/init-submodules-with-retry
|
||||
with:
|
||||
paths: |
|
||||
termlib
|
||||
mosh-kotlin
|
||||
et-kotlin
|
||||
spice-kotlin
|
||||
reticulum-kt
|
||||
rnsh-kt
|
||||
build-proot/proot-termux
|
||||
prns
|
||||
- uses: ./.github/actions/setup-toolchain
|
||||
- name: Run release unit tests
|
||||
run: ./gradlew testDebugUnitTest -PskipWaylandNatives=true -PskipFfmpegNatives=true
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||
|
||||
# One signed APK + AAB per ABI in parallel — roughly halves wall time vs
|
||||
# running all four Gradle tasks sequentially in a single job.
|
||||
#
|
||||
# `needs: [verify-ci, test]` with `if: !cancelled() && (test skipped OR
|
||||
# test succeeded)` lets build proceed when CI has already greenlit the
|
||||
# SHA (test was skipped) or when a fresh test run passes.
|
||||
build:
|
||||
needs: [verify-ci, test]
|
||||
if: |
|
||||
!cancelled() &&
|
||||
(needs.verify-ci.outputs.ci-passed == 'true' || needs.test.result == 'success')
|
||||
# Free 4-core runner — arm64 + x64 build jobs run in parallel (matrix).
|
||||
# Paid larger-tier runners silently queue forever once the Actions
|
||||
# spending cap is hit, so we use the free tier and eat the extra build
|
||||
# time. Timeout is generous to allow the full Rust/Go/Gradle compile
|
||||
# on 4 cores (observed: ~60 min per ABI worst-case).
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 90
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- { abi: arm64, variant: Arm64 }
|
||||
- { abi: x64, variant: X64 }
|
||||
- { abi: armv7, variant: Armv7 }
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
submodules: false
|
||||
- uses: ./.github/actions/init-submodules-with-retry
|
||||
- uses: ./.github/actions/setup-toolchain
|
||||
- name: Decode release keystore
|
||||
run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > haven-release.jks
|
||||
# -PtargetAbi lets core/wayland's buildWaylandNatives skip on the ABIs it
|
||||
# has no binaries for. The five wayland natives are arm64-v8a only, so the
|
||||
# x64 and armv7 jobs would otherwise spend ~20 minutes each building
|
||||
# libraries they never package (#493).
|
||||
# Both flavours ship from GitHub: `full` is the complete app and the
|
||||
# only one F-Droid builds, `terminal` drops the desktop and media
|
||||
# native payload for a ~20 MB smaller download (#510). The AAB stays
|
||||
# full-only — it exists for store distribution, which the stripped
|
||||
# flavour is not part of.
|
||||
# The MEMSAMPLE loop prints host memory every 30s alongside the Gradle
|
||||
# output. The v5.87.36 release attempts died five times in a row with
|
||||
# "runner has received a shutdown signal" 26-31 min in (mid-minify) and
|
||||
# nothing in the log to attribute it; this puts the ground truth in the
|
||||
# log up to the moment of death, since evicted runners upload nothing
|
||||
# afterwards.
|
||||
- name: Build signed APK + AAB (${{ matrix.abi }})
|
||||
run: |
|
||||
( while true; do
|
||||
echo "MEMSAMPLE $(date -u +%H:%M:%S) $(free -m | awk '/^Mem:/{print "used="$3"M avail="$7"M"}')"
|
||||
sleep 30
|
||||
done ) &
|
||||
MEMSAMPLER=$!
|
||||
# The two flavours run as SEQUENTIAL Gradle invocations, not one.
|
||||
# With both in a single invocation, the terminal flavour's R8 ran
|
||||
# concurrently with the full flavour's bundling/signing, and that
|
||||
# overlap is where both armv7 host-OOM deaths sat (MEMSAMPLE showed
|
||||
# 15.2G used of ~16G, 625M available at the kill). One R8/bundle
|
||||
# peak at a time keeps the host inside its memory.
|
||||
set +e
|
||||
./gradlew :app:assemble${{ matrix.variant }}FullRelease \
|
||||
:app:bundle${{ matrix.variant }}FullRelease \
|
||||
-PtargetAbi=${{ matrix.abi }}
|
||||
rc=$?
|
||||
if [ "$rc" = "0" ]; then
|
||||
# Restart the daemons between the flavours. A Gradle daemon never
|
||||
# returns grown heap to the OS, so after the full flavour the host
|
||||
# sat at ~14.6G used and the terminal flavour's R8/lintVital spike
|
||||
# (15.65G used, 335M available, samples logging late = thrashing)
|
||||
# killed the arm64 and armv7 runners even with the flavours
|
||||
# serialized. A fresh daemon starts small and the terminal flavour
|
||||
# compiles mostly from cache. The Kotlin daemon outlives --stop on
|
||||
# its own idle timer, so it is killed explicitly.
|
||||
./gradlew --stop
|
||||
pkill -f KotlinCompileDaemon || true
|
||||
sleep 5
|
||||
./gradlew :app:assemble${{ matrix.variant }}TerminalRelease \
|
||||
-PtargetAbi=${{ matrix.abi }}
|
||||
rc=$?
|
||||
fi
|
||||
kill "$MEMSAMPLER" 2>/dev/null
|
||||
exit "$rc"
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||
# R8 reflective-class survival check — moved here from CI's per-push
|
||||
# release-r8-smoke job (which now runs on PRs only). This release build
|
||||
# already ran R8 (minify), so the assert is free here and guarantees
|
||||
# every published release is checked even on direct-to-main pushes.
|
||||
# ABI-agnostic (inspects the R8 mapping), so run it once on arm64.
|
||||
- name: Assert reflectively-loaded classes survived R8
|
||||
if: matrix.abi == 'arm64'
|
||||
run: ./scripts/check-r8-kept-classes.sh
|
||||
# A stale committed .so fails to dlopen on-device and kills every
|
||||
# cage/app-window feature (#469), with nothing failing at build time.
|
||||
# Inspects checked-in binaries only, so run it once.
|
||||
- name: Assert committed native libs resolve their stubs (#469)
|
||||
if: matrix.abi == 'arm64'
|
||||
run: ./scripts/check-native-libs.sh
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: haven-${{ matrix.abi }}-release
|
||||
path: |
|
||||
app/build/outputs/apk/${{ matrix.abi }}Full/release/haven-*-release.apk
|
||||
app/build/outputs/apk/${{ matrix.abi }}Terminal/release/haven-*-terminal-release.apk
|
||||
app/build/outputs/bundle/${{ matrix.abi }}FullRelease/*.aab
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
|
||||
# Aggregate both ABIs onto a single GitHub release. Splitting this from
|
||||
# build lets the per-ABI jobs run in parallel while the release step
|
||||
# still sees every artifact.
|
||||
publish:
|
||||
needs: build
|
||||
# Must name a status function explicitly. With a bare `if: startsWith(...)`,
|
||||
# GitHub applies an implicit success() over the whole dependency GRAPH — and
|
||||
# once verify-ci greenlights the SHA, `test` is skipped, which makes that
|
||||
# implicit success() false and silently skips publish (nothing ships). `build`
|
||||
# already guards itself this way; publish must too. This path only became
|
||||
# reachable when verify-ci started skipping `test` for the first time.
|
||||
if: |
|
||||
!cancelled() && needs.build.result == 'success' &&
|
||||
startsWith(github.ref, 'refs/tags/')
|
||||
# Publish is just artifact download + GitHub Release upload — no heavy
|
||||
# compile work. Keep on the free 4-core runner to avoid spending larger-
|
||||
# runner minutes on ~20 seconds of I/O.
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
# Reviewer-gated: the `signing` Environment (configured in repo settings
|
||||
# with a required reviewer + v*/main restriction) must approve before the
|
||||
# release is published, so no single account can ship unilaterally.
|
||||
environment: signing
|
||||
permissions:
|
||||
contents: write # create the GitHub Release + upload assets
|
||||
id-token: write # OIDC for build-provenance attestation
|
||||
attestations: write # write the provenance attestation
|
||||
steps:
|
||||
# First — checkout runs `git clean`, so it must precede the artifact
|
||||
# downloads or it would wipe release/. Provides CHANGELOG.md + the
|
||||
# extractor script (each job runs on a fresh runner).
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
submodules: false
|
||||
- name: Download arm64 artifacts
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
name: haven-arm64-release
|
||||
path: release/
|
||||
- name: Download x64 artifacts
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
name: haven-x64-release
|
||||
path: release/
|
||||
- name: Download armv7 artifacts
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
name: haven-armv7-release
|
||||
path: release/
|
||||
# Cryptographically tie each binary to this repo + commit + workflow so
|
||||
# downstreams (F-Droid, users) can verify provenance with `gh attestation
|
||||
# verify <file> --repo GlassHaven/Haven`.
|
||||
- name: Attest build provenance
|
||||
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
|
||||
with:
|
||||
subject-path: |
|
||||
release/**/*.apk
|
||||
release/**/*.aab
|
||||
# Publish a flat checksum manifest alongside the assets (asset names are
|
||||
# basenames once on the release, so the manifest uses basenames too).
|
||||
- name: Generate SHA256SUMS
|
||||
run: |
|
||||
: > SHA256SUMS
|
||||
find release -type f \( -name '*.apk' -o -name '*.aab' \) | sort | while read -r f; do
|
||||
printf '%s %s\n' "$(sha256sum "$f" | cut -d' ' -f1)" "$(basename "$f")" >> SHA256SUMS
|
||||
done
|
||||
cat SHA256SUMS
|
||||
# The notes for this tag must already exist in CHANGELOG.md (CI lint
|
||||
# enforces it at version-bump time). Extract that section as the release
|
||||
# body; generate_release_notes still appends the "Full Changelog" link.
|
||||
- name: Extract release notes from CHANGELOG.md
|
||||
run: ./scripts/check-changelog.sh extract "${GITHUB_REF_NAME}" > RELEASE_NOTES.md
|
||||
# #514: someone asked what the "terminal" APKs are, which means the release
|
||||
# page was not answering it. Appended to every release rather than left to
|
||||
# a changelog entry nobody scrolls back to, or an issue nobody finds.
|
||||
- name: Append the which-APK guide
|
||||
run: |
|
||||
cat >> RELEASE_NOTES.md <<'GUIDE'
|
||||
|
||||
---
|
||||
|
||||
### Which APK?
|
||||
|
||||
**`haven-<version>-<abi>-release.apk`** — the full app, and what F-Droid
|
||||
carries. If in doubt, take this one.
|
||||
|
||||
**`haven-<version>-<abi>-terminal-release.apk`** — the same app with the
|
||||
desktop and media parts left out, for people who only use Haven for SSH,
|
||||
terminals, files and storage. Less than half the size on arm64. It drops
|
||||
RDP and SPICE remote desktop, the native Wayland desktop, and ffmpeg — so
|
||||
no media conversion, and no video previews or streaming in the file
|
||||
browser. VNC is kept, so a Linux desktop running inside Haven's guest
|
||||
still works.
|
||||
|
||||
Both are signed with the same key and carry the same version number, so
|
||||
you can install either over the other without losing connections, keys or
|
||||
your Linux guest. The shared version number does mean an updater will not
|
||||
offer to move you between them — switching is a deliberate download.
|
||||
|
||||
`<abi>` is your device's CPU: `arm64` for essentially every modern phone,
|
||||
`armv7` for older 32-bit devices, `x64` for emulators.
|
||||
GUIDE
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
|
||||
with:
|
||||
body_path: RELEASE_NOTES.md
|
||||
generate_release_notes: true
|
||||
files: |
|
||||
release/**/*.apk
|
||||
release/**/*.aab
|
||||
SHA256SUMS
|
||||
Reference in New Issue
Block a user