Merge pull request #62 from D-Modem/claude/project-thread-u6e15a

Nightly release: the Android APKs and an unsigned iOS .ipa from main, each day
This commit is contained in:
Neo authored and GitHub committed 2026-11-20 22:50:11 -08:00
commit 1ca3119050
5 files changed
+234 -1

No files matched your search

+64
View File
@@ -0,0 +1,64 @@
#!/usr/bin/env bash
# nightly-pick.sh WORKFLOW...
#
# Finds the newest commit on main that has a completed run of each
# WORKFLOW (a file name in .github/workflows). It writes these lines to
# $GITHUB_OUTPUT:
#
# sha=<the commit>
# run_<workflow>=<the run ID> (for each WORKFLOW, "." and "-" as "_")
# skip=true|false (true: the nightly release has this commit)
#
# A run that is not complete is not used. Thus a run that is in progress
# does not stop the nightly release: the release uses the run before it.
# Set FORCE=true to publish again when the commit did not change.
#
# It needs GH_TOKEN and GH_REPO.
set -euo pipefail
[ $# -ge 1 ] || { echo "usage: $0 WORKFLOW..." >&2; exit 2; }
out=${GITHUB_OUTPUT:-/dev/stdout}
# the completed runs of a workflow on main (pushes and manual runs), newest first: "sha id"
runs() {
gh run list --workflow "$1" --branch main --status completed --limit 50 \
--json headSha,databaseId,event \
--jq '.[] | select(.event == "push" or .event == "workflow_dispatch") | "\(.headSha) \(.databaseId)"'
}
declare -A list
for w in "$@"; do
list[$w]=$(runs "$w")
done
sha=
while read -r s _; do
[ -n "$s" ] || continue
ok=1
for w in "$@"; do
grep -q "^$s " <<<"${list[$w]}" || { ok=0; break; }
done
if [ "$ok" = 1 ]; then sha=$s; break; fi
done <<<"${list[$1]}"
if [ -z "$sha" ]; then
echo "::error::No commit on main has a completed run of each of: $*"
exit 1
fi
echo "sha=$sha" >> "$out"
for w in "$@"; do
id=$(grep -m1 "^$sha " <<<"${list[$w]}" | cut -d' ' -f2)
echo "run_$(tr '.-' '__' <<<"$w")=$id" >> "$out"
echo "$w: run $id"
done
# (gh writes the error body of a 404 to stdout: no tag is no commit)
old=$(gh api "repos/$GH_REPO/git/ref/tags/nightly" --jq .object.sha 2>/dev/null) || old=
echo "Commit: $sha (the nightly release has: ${old:-none})"
if [ "$sha" = "$old" ] && [ "${FORCE:-false}" != true ]; then
echo "skip=true" >> "$out"
echo "No new commits on main. The nightly release does not change."
else
echo "skip=false" >> "$out"
fi
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# nightly-publish.sh SHA NOTES DIR
#
# Replaces the "nightly" pre-release with a new one: its tag at SHA, its
# text from the file NOTES, its files all the files in DIR.
#
# It needs GH_TOKEN and GH_REPO.
set -euo pipefail
sha=$1 notes=$2 dir=$3
shopt -s nullglob
files=("$dir"/*)
[ ${#files[@]} -gt 0 ] || { echo "::error::No files to publish in $dir"; exit 1; }
gh release delete nightly --yes --cleanup-tag 2>/dev/null || true
# (a tag that has no release)
gh api -X DELETE "repos/$GH_REPO/git/refs/tags/nightly" 2>/dev/null || true
gh release create nightly "${files[@]}" \
--prerelease --latest=false --target "$sha" \
--title "Nightly build ($(date -u +%Y-%m-%d), ${sha:0:7})" \
--notes-file "$notes"
+24 -1
View File
@@ -2,7 +2,8 @@
# Mbed TLS built for iOS (devices and simulator) and macOS as an
# XCFramework (ios/build-native.sh), and its Swift tests run on macOS
# (ios/DModemSmoke): the modem through its C API, as the iOS app has it;
# DModemKit's tests, and the iOS app (ios/DModem) built for the simulator.
# DModemKit's tests, and the iOS app (ios/DModem) built for the simulator;
# on main, also for a device, not signed (DModem-unsigned.ipa).
#
# D-Modem is a private submodule: the DMODEM_TOKEN secret (as
# android.yml's).
@@ -73,6 +74,28 @@ jobs:
-destination 'generic/platform=iOS Simulator' \
ARCHS=arm64 CODE_SIGNING_ALLOWED=NO build
# the iOS app for a device, not signed, as an .ipa (for the nightly
# release, nightly.yml): main and a manual run only, not a pull request.
# A person signs it again for their device (for example with AltStore
# or Sideloadly).
- name: The iOS app (device, not signed)
if: github.event_name != 'pull_request'
run: |
cd ios/DModem
xcodebuild -project DModem.xcodeproj -scheme DModem -configuration Release \
-destination 'generic/platform=iOS' -derivedDataPath "$RUNNER_TEMP/ios-device" \
CODE_SIGNING_ALLOWED=NO build
mkdir -p "$RUNNER_TEMP/ipa/Payload"
cp -R "$RUNNER_TEMP/ios-device/Build/Products/Release-iphoneos/DModem.app" "$RUNNER_TEMP/ipa/Payload/"
(cd "$RUNNER_TEMP/ipa" && zip -qry "$GITHUB_WORKSPACE/DModem-unsigned.ipa" Payload)
# (the .ipa itself, not zipped: as android.yml's APK)
- uses: actions/upload-artifact@v7
if: github.event_name != 'pull_request'
with:
path: DModem-unsigned.ipa
archive: false
- uses: actions/upload-artifact@v7
with:
name: DModemEngine.xcframework
+109
View File
@@ -0,0 +1,109 @@
# Nightly: the "nightly" pre-release of the apps, from the artifacts of
# the newest commit on main that has a complete run of android.yml and
# of apple.yml. It does not build the apps again. Each run replaces the
# release and moves its tag. When main has no new commits, the run stops
# and the release does not change. A manual run (Actions > Nightly > Run
# workflow) can publish again with "force".
#
# A hung test does not stop the release: the run uses each artifact that
# the CI run made. The release APK comes from android.yml's release job,
# which runs no tests. The release lists each artifact that is missing.
#
# Android: the release APK has the release environment's key (as
# android.yml's release job); the debug APK has the repository's debug
# key. iOS: the .ipa is not signed (apple.yml); a person signs it again
# for their device. An App Store or TestFlight build needs an Apple
# Developer account and its secrets (not set).
name: Nightly
on:
schedule:
- cron: "37 5 * * *"
workflow_dispatch:
inputs:
force:
description: Publish again, also when main has no new commits
type: boolean
default: false
# (one at a time: a second run waits for the first)
concurrency:
group: nightly
cancel-in-progress: false
permissions:
contents: write
actions: read
jobs:
nightly:
runs-on: ubuntu-24.04
timeout-minutes: 20
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
steps:
# (the scripts only: not the private submodule)
- uses: actions/checkout@v6
- name: The newest build of main
id: pick
run: .github/scripts/nightly-pick.sh android.yml apple.yml
env:
FORCE: ${{ inputs.force || 'false' }}
# (with the API, not download-artifact: an artifact uploaded with
# "archive: false" comes as the file itself, not as a zip)
- name: Files
if: steps.pick.outputs.skip == 'false'
env:
SHA: ${{ steps.pick.outputs.sha }}
ANDROID_RUN: ${{ steps.pick.outputs.run_android_yml }}
APPLE_RUN: ${{ steps.pick.outputs.run_apple_yml }}
run: |
mkdir out dl
: > missing
# get RUN ARTIFACT: the artifact's download in dl/ARTIFACT, or no file
get() {
local id
id=$(gh api "repos/$GH_REPO/actions/runs/$1/artifacts" \
--jq ".artifacts[] | select(.name == \"$2\" and (.expired | not)) | .id" | head -1)
if [ -n "$id" ]; then gh api "repos/$GH_REPO/actions/artifacts/$id/zip" > "dl/$2"; fi
}
# file RUN ARTIFACT NAME: an artifact that is one file ("archive: false")
file() {
get "$1" "$2"
if [ -s "dl/$2" ]; then mv "dl/$2" "out/$3"; else echo "- \`$3\`" >> missing; fi
}
# member RUN ARTIFACT PATH NAME: one file from a zipped artifact
member() {
get "$1" "$2"
if [ -s "dl/$2" ] && unzip -p "dl/$2" "$3" > "out/$4" && [ -s "out/$4" ]; then :; else
rm -f "out/$4"; echo "- \`$4\`" >> missing
fi
}
member "$ANDROID_RUN" release apk/release/app-release.apk dmodem-android.apk
file "$ANDROID_RUN" app-debug.apk dmodem-android-debug.apk
file "$APPLE_RUN" DModem-unsigned.ipa dmodem-ios-unsigned.ipa
(cd out && sha256sum * > SHA256SUMS)
ls -l out
{
echo "The newest build of \`main\`, from commit $SHA ([Android run]($GITHUB_SERVER_URL/$GH_REPO/actions/runs/$ANDROID_RUN), [Apple run]($GITHUB_SERVER_URL/$GH_REPO/actions/runs/$APPLE_RUN))."
echo "This is not a stable release."
echo
echo "| File | What it is |"
echo "| --- | --- |"
echo "| \`dmodem-android.apk\` | The Android app (release build, all four ABIs) |"
echo "| \`dmodem-android-debug.apk\` | The Android app (debug build). It has a different key: remove the release build before you install it |"
echo "| \`dmodem-ios-unsigned.ipa\` | The iOS app, not signed. Sign it again for your device (for example with AltStore or Sideloadly) |"
echo "| \`SHA256SUMS\` | The SHA-256 of each file |"
if [ -s missing ]; then
echo
echo "This build did not make these files:"
cat missing
fi
} > notes.md
- name: Publish
if: steps.pick.outputs.skip == 'false'
run: .github/scripts/nightly-publish.sh "${{ steps.pick.outputs.sha }}" notes.md out
+15
View File
@@ -20,6 +20,21 @@ modem, it uses V.91 at up to 62667 bit/s in the two directions.
- Two phones as the line for each other, through Wi-Fi or Bluetooth, without a SIP account
- The mobile calls of the phone as a slow line, where Android permits it
## Nightly builds
The [nightly release](https://github.com/D-Modem/app/releases/tag/nightly)
has the apps from the newest build of `main`. A workflow
(`.github/workflows/nightly.yml`) replaces the release one time each day.
When `main` has no new commits, the release does not change.
- `dmodem-android.apk`: the Android app (release build).
- `dmodem-android-debug.apk`: the Android app (debug build). It has a
different key. Remove the release build before you install it.
- `dmodem-ios-unsigned.ipa`: the iOS app. It is not signed. Sign it
again for your device (for example, with AltStore or Sideloadly).
These builds are not stable releases.
## Quick start
Android: open the project in Android Studio, or do these commands: