From 49cf924105b8db6531043db75f65e79aa99903b8 Mon Sep 17 00:00:00 2001 From: Thomas Luizon Rodrigues Gregorio Date: Fri, 19 Jun 2026 15:32:36 -0300 Subject: [PATCH] chore(qa): wire QA API base into android internal-track build seam (#211) Internal-track Android builds silently baked in the prod API base because android-release.yml never injected EXPO_PUBLIC_API_BASE at prebuild. Derive the build target from the release track (internal => QA, all other tracks => prod): inject EXPO_PUBLIC_API_BASE from vars.QA_API_BASE, force AdMob test IDs, and gate the prod-AdMob validation steps off for the QA build. Add a first-class eas qa build profile + submit.qa internal-track mapping, and a QA switch in the android-generate skill. QA web + API run on operator-provisioned infra (Render QA service + env group with ASPNETCORE_ENVIRONMENT=Production, QA Supabase, QA web deploy, and vars.QA_API_BASE); those are documented in the PR, not code. Co-Authored-By: Claude Opus 4.8 (1M context) --- .claude/skills/android-generate/SKILL.md | 24 ++++++++++++++++ .github/workflows/android-release.yml | 35 ++++++++++++++++++++++-- apps/mobile/eas.json | 17 ++++++++++++ 3 files changed, 74 insertions(+), 2 deletions(-) diff --git a/.claude/skills/android-generate/SKILL.md b/.claude/skills/android-generate/SKILL.md index 12e8538084..41ae7d4269 100644 --- a/.claude/skills/android-generate/SKILL.md +++ b/.claude/skills/android-generate/SKILL.md @@ -7,6 +7,30 @@ description: Build the Android APK for the mobile app by running npm run android Runs the project's existing Android APK release command. +The APK bakes in `EXPO_PUBLIC_API_BASE` at prebuild time, so the API the build targets is decided by the environment present when the script runs. Default (no env set) builds against prod (`https://api.useorbit.org`). + ## Steps +### Prod (default) + 1. From the repo root, run `npm run android:apk -w @orbit/mobile`. The `android:apk` script is defined in the `apps/mobile` workspace (`node scripts/android-release-apk.js`), not at the root, so it must be targeted with `-w @orbit/mobile`. + +### QA + +Build against the QA API instead of prod by exporting the QA base (and forcing AdMob test IDs so the QA build never serves live ads) before running the same command. The QA API base is the public QA endpoint `https://api-qa.useorbit.org`. + +- PowerShell: + + ```powershell + $env:EXPO_PUBLIC_API_BASE = "https://api-qa.useorbit.org" + $env:EXPO_PUBLIC_ADMOB_USE_TEST_IDS = "true" + npm run android:apk -w @orbit/mobile + ``` + +- bash: + + ```bash + EXPO_PUBLIC_API_BASE="https://api-qa.useorbit.org" \ + EXPO_PUBLIC_ADMOB_USE_TEST_IDS="true" \ + npm run android:apk -w @orbit/mobile + ``` diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml index 06a743722c..fb7e9c0aff 100644 --- a/.github/workflows/android-release.yml +++ b/.github/workflows/android-release.yml @@ -183,7 +183,33 @@ jobs: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }} EOF + - name: Resolve build target (prod vs QA) + shell: bash + env: + RELEASE_TRACK: ${{ inputs.track }} + QA_API_BASE: ${{ vars.QA_API_BASE }} + PROD_API_BASE: https://api.useorbit.org + run: | + set -euo pipefail + + if [ "${RELEASE_TRACK}" = "internal" ]; then + if [ -z "${QA_API_BASE}" ]; then + echo "::error::The internal track builds against QA, but vars.QA_API_BASE is not set. Configure it under repo Settings → Secrets and variables → Actions → Variables." >&2 + exit 1 + fi + echo "BUILD_API_BASE=${QA_API_BASE}" >> "${GITHUB_ENV}" + echo "BUILD_ADMOB_USE_TEST_IDS=true" >> "${GITHUB_ENV}" + echo "BUILD_EAS_PROFILE=qa" >> "${GITHUB_ENV}" + echo "Build target: QA (api_base=${QA_API_BASE}, test AdMob IDs)" + else + echo "BUILD_API_BASE=${PROD_API_BASE}" >> "${GITHUB_ENV}" + echo "BUILD_ADMOB_USE_TEST_IDS=false" >> "${GITHUB_ENV}" + echo "BUILD_EAS_PROFILE=production" >> "${GITHUB_ENV}" + echo "Build target: PROD (api_base=${PROD_API_BASE}, real AdMob IDs)" + fi + - name: Validate Expo config resolves production AdMob IDs + if: ${{ inputs.track != 'internal' }} working-directory: ${{ env.RELEASE_WORKDIR }}/apps/mobile shell: bash env: @@ -277,17 +303,22 @@ jobs: env: CI: "1" EXPO_NO_TELEMETRY: "1" - EAS_BUILD_PROFILE: production - EXPO_PUBLIC_ADMOB_USE_TEST_IDS: "false" + EAS_BUILD_PROFILE: ${{ env.BUILD_EAS_PROFILE }} + EXPO_PUBLIC_API_BASE: ${{ env.BUILD_API_BASE }} + EXPO_PUBLIC_ADMOB_USE_TEST_IDS: ${{ env.BUILD_ADMOB_USE_TEST_IDS }} EXPO_PUBLIC_ADMOB_ANDROID_APP_ID: ${{ env.PROD_ADMOB_ANDROID_APP_ID }} EXPO_PUBLIC_ADMOB_ANDROID_INTERSTITIAL_ID: ${{ env.PROD_ADMOB_ANDROID_INTERSTITIAL_ID }} EXPO_PUBLIC_ADMOB_ANDROID_REWARDED_ID: ${{ env.PROD_ADMOB_ANDROID_REWARDED_ID }} run: | set -euo pipefail + echo "Prebuild API base: ${EXPO_PUBLIC_API_BASE}" + echo "Prebuild AdMob test IDs: ${EXPO_PUBLIC_ADMOB_USE_TEST_IDS}" + npx expo prebuild --platform android --no-install - name: Validate generated Android project does not contain sample AdMob IDs + if: ${{ inputs.track != 'internal' }} working-directory: ${{ env.RELEASE_WORKDIR }}/apps/mobile shell: bash env: diff --git a/apps/mobile/eas.json b/apps/mobile/eas.json index 9a866a3fb0..744cb7a4cd 100644 --- a/apps/mobile/eas.json +++ b/apps/mobile/eas.json @@ -25,6 +25,16 @@ "EXPO_PUBLIC_ADMOB_USE_TEST_IDS": "true" } }, + "qa": { + "distribution": "internal", + "android": { + "buildType": "apk" + }, + "env": { + "EXPO_PUBLIC_API_BASE": "https://api-qa.useorbit.org", + "EXPO_PUBLIC_ADMOB_USE_TEST_IDS": "true" + } + }, "production": { "distribution": "store", "android": { @@ -47,6 +57,13 @@ "releaseStatus": "completed" } }, + "qa": { + "android": { + "serviceAccountKeyPath": "./play-service-account.json", + "track": "internal", + "releaseStatus": "completed" + } + }, "closed": { "android": { "serviceAccountKeyPath": "./play-service-account.json",