From c234e2d0c6ca26e845494fd2e6c83d81c2c4957f Mon Sep 17 00:00:00 2001 From: SyscallBrain <61458775+SyscallBrain@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:24:36 +0000 Subject: [PATCH 1/2] ci: test APK workflow in English, job-scoped permissions --- .github/workflows/test-apk.yml | 38 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test-apk.yml b/.github/workflows/test-apk.yml index f19584a..5ab1d5d 100644 --- a/.github/workflows/test-apk.yml +++ b/.github/workflows/test-apk.yml @@ -1,34 +1,34 @@ -# Compila um APK de teste do ZeroDroid SÓ quando o dono o lança à mão. -# Não publica nada: o APK fica como "artifact" do run e é apagado ao fim de -# 7 dias. É assinado com a chave de RELEASE (os secrets ZERODROID_*), por isso -# instala-se por cima da versão estável sem desinstalar nem voltar a emparelhar. +# Builds a ZeroDroid test APK, only when it is started by hand. Nothing is +# published: the APK is kept as a run artifact for 7 days. It is signed with +# the RELEASE key (the ZERODROID_* secrets), so it installs over the stable +# app without uninstalling or pairing again. # -# Lançar (no Termux, ou em qualquer sítio com o gh): +# Start it (from Termux, or anywhere with gh): # gh workflow run test-apk.yml -R SyscallBrain/zerodroid --ref -# gh workflow run test-apk.yml -R SyscallBrain/zerodroid --ref -f testes=false -# Seguir e descarregar: +# gh workflow run test-apk.yml -R SyscallBrain/zerodroid --ref -f checks=false +# Follow it and fetch the APK: # gh run watch -R SyscallBrain/zerodroid --exit-status # gh run download -R SyscallBrain/zerodroid --pattern 'zerodroid-*' name: Test APK (manual) -# Único gatilho: o botão "Run workflow" ou o "gh workflow run". Nada de push, -# pull_request ou schedule, por isso nunca corre sozinho. +# The only trigger is "Run workflow" / "gh workflow run": no push, +# pull_request or schedule, so it never starts on its own. on: workflow_dispatch: inputs: - testes: - description: Correr os testes unitários antes de compilar + checks: + description: Run the unit tests before building type: boolean default: true -# O token automático do run só pode ler o repo. -permissions: - contents: read +permissions: {} jobs: apk: runs-on: ubuntu-24.04 timeout-minutes: 30 + permissions: + contents: read steps: - name: Check out source uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -40,21 +40,21 @@ jobs: distribution: temurin java-version: 21 - # Instala o Gradle do wrapper, valida o gradle-wrapper.jar e guarda a cache. + # Also validates the checksum of gradle/wrapper/gradle-wrapper.jar. - uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1 - name: Unit tests - if: inputs.testes + if: inputs.checks run: ./gradlew testDebugUnitTest - # O keystore vive no secret em base64; é escrito num ficheiro temporário - # do runner só durante o build e apagado logo a seguir. + # The keystore lives base64-encoded in a secret; it is written to the + # runner's temp dir for the build only and deleted right after. - name: Set up the release signing key env: KEYSTORE_BASE64: ${{ secrets.ZERODROID_KEYSTORE_BASE64 }} run: | if [ -z "$KEYSTORE_BASE64" ]; then - echo "Falta o secret ZERODROID_KEYSTORE_BASE64: sem ele o APK não instala por cima do estável" >&2 + echo "The ZERODROID_KEYSTORE_BASE64 secret is not set; an unsigned APK cannot replace the stable app" >&2 exit 1 fi printf '%s' "$KEYSTORE_BASE64" | base64 --decode > "$RUNNER_TEMP/release.jks" From da07f2e3e0ed768fd3942db04b327558a5ba87ac Mon Sep 17 00:00:00 2001 From: SyscallBrain <61458775+SyscallBrain@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:33:46 +0000 Subject: [PATCH 2/2] ci: download the artifact from the watched run --- .github/workflows/test-apk.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-apk.yml b/.github/workflows/test-apk.yml index 5ab1d5d..9b0818f 100644 --- a/.github/workflows/test-apk.yml +++ b/.github/workflows/test-apk.yml @@ -6,9 +6,11 @@ # Start it (from Termux, or anywhere with gh): # gh workflow run test-apk.yml -R SyscallBrain/zerodroid --ref # gh workflow run test-apk.yml -R SyscallBrain/zerodroid --ref -f checks=false -# Follow it and fetch the APK: -# gh run watch -R SyscallBrain/zerodroid --exit-status -# gh run download -R SyscallBrain/zerodroid --pattern 'zerodroid-*' +# Follow it and fetch the APK from that same run (the newest run of this +# workflow; gh run download without a run id would ask which run): +# run=$(gh run list -R SyscallBrain/zerodroid -w test-apk.yml -L 1 --json databaseId -q '.[0].databaseId') +# gh run watch "$run" -R SyscallBrain/zerodroid --exit-status +# gh run download "$run" -R SyscallBrain/zerodroid name: Test APK (manual) # The only trigger is "Run workflow" / "gh workflow run": no push,