mirror of
https://github.com/D-Modem/app.git
synced 2026-11-28 17:38:05 -08:00
The README, titled for Android only, now introduces the app on Android and iOS with a short feature list, a quick start, the suite's repositories and the licence. Its sections move to docs/: the modem's lines, fax, adapters and phone lines, the app screen by screen, building, the iOS app and the source layout. D-Modem-RE becomes D-Modem in comments, docs, workflows and the generator's header, as in brand's naming guide; the build info line says 'D-Modem core <commit>' for the submodule's commit. Identifiers and the external/d-modem-re path keep their names. The Android and Apple workflows no longer run for a change to Markdown, docs/ or COPYING alone (tag pushes still run). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRSqjp9Pn2KBr9N9LAn
289 lines
11 KiB
YAML
289 lines
11 KiB
YAML
# docs: every function documented (tools/doc_check.py).
|
|
# build: the APK (all four ABIs), the unit tests and lint.
|
|
# native: the native engine on the runner against a dmodemd over loopback
|
|
# SIP (native-test).
|
|
# device: the instrumented tests on an emulator (x86_64, the one ABI it
|
|
# builds): the native library loads, binds and answers AT commands.
|
|
#
|
|
# release: the release APK and bundle (R8), signed with the release
|
|
# environment's key: main, v* tags and a manual run only, not a pull
|
|
# request (its R8 build is the slow one; build's debug APK is what a
|
|
# pull request is tried with).
|
|
#
|
|
# Packages: apt's downloads are cached (.github/actions/apt), keyed on
|
|
# the runner image and the package list.
|
|
#
|
|
# D-Modem is a private submodule: the DMODEM_TOKEN secret is a token
|
|
# that can read it (a fine-grained personal access token with Contents:
|
|
# read on D-Modem/D-Modem).
|
|
#
|
|
# Signing: ANDROID_KEYSTORE_BASE64 (a PKCS12 keystore, base64),
|
|
# ANDROID_KEYSTORE_PASSWORD, ANDROID_KEY_ALIAS and ANDROID_KEY_PASSWORD
|
|
# (the store's if empty). The repository's secrets hold the debug
|
|
# keystore, the protected "release" environment's the release one (an
|
|
# environment's secret wins over the repository's of the same name). A
|
|
# fork's pull request has neither: its builds take the SDK's debug key
|
|
# (and its release build is unsigned).
|
|
name: Android
|
|
|
|
# (a branch's commits run once, as its pull request: pushed, only main's;
|
|
# a change to docs alone runs nothing: the Markdown, docs/ and COPYING)
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ["v*"]
|
|
paths: ['**', '!**.md', '!docs/**', '!COPYING']
|
|
pull_request:
|
|
paths: ['**', '!**.md', '!docs/**', '!COPYING']
|
|
workflow_dispatch:
|
|
|
|
# a newer commit on a pull request cancels the run before it (main's all run)
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
env:
|
|
NDK_VERSION: "29.0.14206865"
|
|
CMAKE_VERSION: "3.31.6"
|
|
|
|
jobs:
|
|
docs:
|
|
runs-on: ubuntu-24.04
|
|
# (a hung test ends here, not at GitHub's 6 hours)
|
|
timeout-minutes: 5
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
submodules: recursive
|
|
token: ${{ secrets.DMODEM_TOKEN || github.token }}
|
|
|
|
- name: Every function documented
|
|
run: python3 tools/doc_check.py
|
|
|
|
build:
|
|
runs-on: ubuntu-24.04
|
|
# (a hung test ends here, not at GitHub's 6 hours)
|
|
timeout-minutes: 40
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
submodules: recursive
|
|
token: ${{ secrets.DMODEM_TOKEN || github.token }}
|
|
|
|
- uses: actions/setup-java@v5
|
|
with:
|
|
distribution: temurin
|
|
java-version: "21"
|
|
|
|
- uses: gradle/actions/setup-gradle@v5
|
|
|
|
- name: SDK packages
|
|
run: |
|
|
yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --licenses > /dev/null
|
|
"$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" \
|
|
"ndk;$NDK_VERSION" "cmake;$CMAKE_VERSION" "platforms;android-37.0"
|
|
|
|
- name: OpenSSH, PuTTY, mksh (the interop tests), gawk (proot's build)
|
|
uses: ./.github/actions/apt
|
|
with:
|
|
packages: openssh-client openssh-server putty-tools gawk mksh
|
|
recommends: 'true'
|
|
- run: sudo mkdir -p /run/sshd
|
|
# the keystore from its secret, for the build (app/build.gradle.kts); none on a fork's pull request
|
|
- name: Signing keystore
|
|
env:
|
|
KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
|
|
run: |
|
|
if [ -n "$KEYSTORE_BASE64" ]; then
|
|
printf '%s' "$KEYSTORE_BASE64" | tr -d '[:space:]' | base64 -d > "$RUNNER_TEMP/keystore.p12"
|
|
echo "ANDROID_KEYSTORE_FILE=$RUNNER_TEMP/keystore.p12" >> "$GITHUB_ENV"
|
|
else
|
|
echo "No keystore secret: the SDK's debug key (a release build unsigned)"
|
|
fi
|
|
|
|
- name: Build, unit tests, lint
|
|
run: ./gradlew assembleDebug assembleDebugAndroidTest testDebugUnitTest lintDebug :shared:jvmTest :shared:linuxX64Test
|
|
env:
|
|
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
|
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
|
|
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
|
|
|
|
- name: The APK's signer
|
|
if: ${{ !cancelled() && hashFiles('app/build/outputs/apk/debug/app-debug.apk') != '' }}
|
|
run: |
|
|
tools=$(ls -d "$ANDROID_HOME"/build-tools/* | sort -V | tail -1)
|
|
"$tools/apksigner" verify --print-certs app/build/outputs/apk/debug/app-debug.apk
|
|
|
|
# the APK even when a test fails, so a build can still be tried on a phone; as
|
|
# the .apk itself, not zipped (archive: false, upload-artifact v7: the artifact
|
|
# takes the file's name)
|
|
- uses: actions/upload-artifact@v7
|
|
if: ${{ !cancelled() && hashFiles('app/build/outputs/apk/debug/app-debug.apk') != '' }}
|
|
with:
|
|
path: app/build/outputs/apk/debug/app-debug.apk
|
|
archive: false
|
|
|
|
- uses: actions/upload-artifact@v7
|
|
if: always()
|
|
with:
|
|
name: reports
|
|
path: |
|
|
app/build/reports
|
|
app/build/test-results
|
|
|
|
release:
|
|
if: github.event_name != 'pull_request'
|
|
runs-on: ubuntu-24.04
|
|
# (a hung build ends here, not at GitHub's 6 hours)
|
|
timeout-minutes: 40
|
|
# main and v* tags: the release environment and its key (that environment takes only those);
|
|
# anything else (a pull request) none, so the repository's debug key
|
|
environment: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) && 'release' || '' }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
submodules: recursive
|
|
token: ${{ secrets.DMODEM_TOKEN || github.token }}
|
|
|
|
- uses: actions/setup-java@v5
|
|
with:
|
|
distribution: temurin
|
|
java-version: "21"
|
|
|
|
- uses: gradle/actions/setup-gradle@v5
|
|
|
|
- name: SDK packages
|
|
run: |
|
|
yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --licenses > /dev/null
|
|
"$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" \
|
|
"ndk;$NDK_VERSION" "cmake;$CMAKE_VERSION" "platforms;android-37.0"
|
|
|
|
- name: gawk (proot's build)
|
|
uses: ./.github/actions/apt
|
|
with:
|
|
packages: gawk
|
|
|
|
# the keystore from its secret, for the build (app/build.gradle.kts); none on a fork's pull request
|
|
- name: Signing keystore
|
|
env:
|
|
KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
|
|
run: |
|
|
if [ -n "$KEYSTORE_BASE64" ]; then
|
|
printf '%s' "$KEYSTORE_BASE64" | tr -d '[:space:]' | base64 -d > "$RUNNER_TEMP/keystore.p12"
|
|
echo "ANDROID_KEYSTORE_FILE=$RUNNER_TEMP/keystore.p12" >> "$GITHUB_ENV"
|
|
else
|
|
echo "No keystore secret: the SDK's debug key (a release build unsigned)"
|
|
fi
|
|
|
|
- name: Release APK and bundle
|
|
run: ./gradlew assembleRelease bundleRelease
|
|
env:
|
|
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
|
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
|
|
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
|
|
|
|
- name: The APK's signer
|
|
if: ${{ env.ANDROID_KEYSTORE_FILE != '' }}
|
|
run: |
|
|
tools=$(ls -d "$ANDROID_HOME"/build-tools/* | sort -V | tail -1)
|
|
"$tools/apksigner" verify --print-certs app/build/outputs/apk/release/app-release.apk
|
|
|
|
- uses: actions/upload-artifact@v7
|
|
with:
|
|
name: release
|
|
path: |
|
|
app/build/outputs/apk/release/*.apk
|
|
app/build/outputs/bundle/release/*.aab
|
|
app/build/outputs/mapping/release/mapping.txt
|
|
|
|
native:
|
|
runs-on: ubuntu-24.04
|
|
# (a hung test ends here, not at GitHub's 6 hours)
|
|
timeout-minutes: 25
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
submodules: recursive
|
|
token: ${{ secrets.DMODEM_TOKEN || github.token }}
|
|
|
|
- name: Packages
|
|
uses: ./.github/actions/apt
|
|
with:
|
|
packages: cmake ninja-build g++ libssl-dev libgtest-dev
|
|
|
|
- name: Build
|
|
run: |
|
|
cmake -S native-test -B build-host -G Ninja
|
|
cmake --build build-host
|
|
|
|
- name: Engine test
|
|
run: ctest --test-dir build-host --output-on-failure
|
|
|
|
# the iOS app's DModemKit (its Swift) on this engine: Swift runs on Linux too
|
|
# (the runner image's Swift: setup-swift still runs on Node 20)
|
|
- name: Swift
|
|
run: swift --version
|
|
|
|
- name: DModemKit (Swift) on the engine
|
|
run: swift test --package-path ios/DModemKit
|
|
env:
|
|
DMODEM_HOST_BUILD: ${{ github.workspace }}/build-host
|
|
|
|
# (Apple's ways on Linux: the portable fallbacks the iOS build has)
|
|
- name: Engine test, Apple's fallbacks
|
|
run: |
|
|
cmake -S native-test -B build-fallback -G Ninja \
|
|
-DCMAKE_CXX_FLAGS=-DDMODEM_PORTABLE_FALLBACKS -DCMAKE_C_FLAGS=-DDMODEM_PORTABLE_FALLBACKS
|
|
cmake --build build-fallback
|
|
ctest --test-dir build-fallback --output-on-failure
|
|
|
|
device:
|
|
runs-on: ubuntu-24.04
|
|
# (a hung test ends here, not at GitHub's 6 hours)
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
submodules: recursive
|
|
token: ${{ secrets.DMODEM_TOKEN || github.token }}
|
|
|
|
- uses: actions/setup-java@v5
|
|
with:
|
|
distribution: temurin
|
|
java-version: "21"
|
|
|
|
- uses: gradle/actions/setup-gradle@v5
|
|
|
|
- name: gawk (proot's build)
|
|
uses: ./.github/actions/apt
|
|
with:
|
|
packages: gawk
|
|
|
|
- name: KVM
|
|
run: |
|
|
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
|
|
sudo udevadm control --reload-rules
|
|
sudo udevadm trigger --name-match=kvm
|
|
|
|
- name: SDK packages
|
|
run: |
|
|
yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --licenses > /dev/null
|
|
"$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" \
|
|
"ndk;$NDK_VERSION" "cmake;$CMAKE_VERSION" "platforms;android-37.0"
|
|
|
|
- name: Instrumented tests
|
|
uses: reactivecircus/android-emulator-runner@v2
|
|
with:
|
|
api-level: 35
|
|
arch: x86_64
|
|
target: google_apis
|
|
disable-animations: true
|
|
# (the emulator's ABI only: the other three are the build job's)
|
|
script: ./gradlew -Pdmodem.abis=x86_64 connectedDebugAndroidTest
|
|
|
|
- uses: actions/upload-artifact@v7
|
|
if: always()
|
|
with:
|
|
name: device-reports
|
|
path: app/build/reports/androidTests
|