From bd3fa40dfd65eec599f0d52a0abf5b96dbceecbc Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 30 Oct 2026 14:16:54 +0000 Subject: [PATCH] CI: each commit run once, superseded runs cancelled, time limits, one ABI on the emulator - Pushes run CI only on main; a branch's commits run as its pull request (each PR commit ran everything twice). workflow_dispatch to run a branch by hand. - A newer commit on a pull request cancels the run before it. - Every job has a time limit: a hung test had a build job running for over an hour, with GitHub's default 6 hours to go. - The emulator job builds x86_64 only (-Pdmodem.abis, new: the ABIs of the native code and proot, all four by default); the build job still builds all four. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01B82eRSgB6M9Vp9dEP1haEE --- .github/workflows/android.yml | 23 ++++++++++++++++++++--- .github/workflows/apple.yml | 10 ++++++++++ app/build.gradle.kts | 10 ++++++++-- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 23e827f..3b7d5ec 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -2,17 +2,25 @@ # 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 native library -# loads, binds and answers AT commands. +# device: the instrumented tests on an emulator (x86_64, the one ABI it +# builds): the native library loads, binds and answers AT commands. # # D-Modem-RE 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). name: Android +# (a branch's commits run once, as its pull request: pushed, only main's) on: push: + branches: [main] pull_request: + 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" @@ -21,6 +29,8 @@ env: 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@v4 with: @@ -32,6 +42,8 @@ jobs: build: runs-on: ubuntu-24.04 + # (a hung test ends here, not at GitHub's 6 hours) + timeout-minutes: 40 steps: - uses: actions/checkout@v4 with: @@ -74,6 +86,8 @@ jobs: native: runs-on: ubuntu-24.04 + # (a hung test ends here, not at GitHub's 6 hours) + timeout-minutes: 25 steps: - uses: actions/checkout@v4 with: @@ -113,6 +127,8 @@ jobs: device: runs-on: ubuntu-24.04 + # (a hung test ends here, not at GitHub's 6 hours) + timeout-minutes: 30 steps: - uses: actions/checkout@v4 with: @@ -148,7 +164,8 @@ jobs: arch: x86_64 target: google_apis disable-animations: true - script: ./gradlew connectedDebugAndroidTest + # (the emulator's ABI only: the other three are the build job's) + script: ./gradlew -Pdmodem.abis=x86_64 connectedDebugAndroidTest - uses: actions/upload-artifact@v4 if: always() diff --git a/.github/workflows/apple.yml b/.github/workflows/apple.yml index 38c1ccd..50a7463 100644 --- a/.github/workflows/apple.yml +++ b/.github/workflows/apple.yml @@ -8,13 +8,23 @@ # android.yml's). name: Apple +# (a branch's commits run once, as its pull request: pushed, only main's) on: push: + branches: [main] pull_request: + 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' }} jobs: engine: runs-on: macos-15 + # (a hung test ends here, not at GitHub's 6 hours) + timeout-minutes: 50 steps: - uses: actions/checkout@v4 with: diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e5f0a48..d49f81f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -20,6 +20,12 @@ fun commitOf(dir: File): String { return if (dirty) "$c-dirty" else c } +// the ABIs built (native code and proot): all four, or -Pdmodem.abis=x86_64 (comma-separated) for fewer, +// as CI's emulator job has it +val appAbis = providers.gradleProperty("dmodem.abis").orNull + ?.split(',')?.map { it.trim() }?.filter { it.isNotEmpty() } + ?: listOf("arm64-v8a", "armeabi-v7a", "x86_64", "x86") + android { namespace = "com.neodesktop.dmodem" compileSdk = 37 @@ -41,7 +47,7 @@ android { testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" ndk { - abiFilters += listOf("arm64-v8a", "armeabi-v7a", "x86_64", "x86") + abiFilters += appAbis } externalNativeBuild { cmake { @@ -164,7 +170,7 @@ tasks.withType().configureEach { } // proot and its loader for the local shell's Linux (native-proot/build.sh: Termux's proot, external/proot) -val prootAbis = listOf("arm64-v8a", "armeabi-v7a", "x86_64", "x86") +val prootAbis = appAbis val buildProot = tasks.register("buildProot") { description = "Builds proot and its loader for each ABI with the NDK" }