Skip to content

feat: align with @percy/detox 1.0.0 + add iOS + improve CI - #2

Open
pranavz28 wants to merge 1 commit into
mainfrom
release/1.0.0
Open

feat: align with @percy/detox 1.0.0 + add iOS + improve CI#2
pranavz28 wants to merge 1 commit into
mainfrom
release/1.0.0

Conversation

@pranavz28

Copy link
Copy Markdown
Collaborator

Summary

Brings example-percy-detox to a production-ready state aligned with @percy/detox 1.0.0. Adds iOS support, improves CI to actually exercise real Detox runtime, and matches Percy's standard example-repo conventions.

What's in this PR

iOS support (Task #9)

  • detox.config.js — new ios.debug app, simulator device (default iPhone 14 Pro), ios.sim.debug configuration.
  • package.jsonios, build:ios, test:ios scripts.
  • ios/Podfilepod 'Detox', :path => '../node_modules/detox' under app target.

README polish (Task #8)

  • Rewritten to follow Percy's standard 8-step tutorial template — matches example-percy-cypress, example-percy-java-selenium, example-percy-webdriverio.

CI improvements

  • detox-android-emulator.yml (new) — real Detox runtime via reactivecircus/android-emulator-runner on a free Linux runner. Manual dispatch + nightly cron at 04:00 UTC. AVD snapshot caching for fast subsequent runs. Produces actual Percy builds against Pixel_7_API_34 (API level 34, x86_64, google_apis).
  • test.yml — upgraded from parse-only to: install + eslint + tsc + config parse + scripts-executable.
  • detox-bs-android.yml — unchanged; remains workflow_dispatch-only and stays wired for the day BrowserStack ships server-side takeScreenshot (cloud_detox_support#L1004).

Lint pass

  • Prettier-style auto-fixes across detox.config.js, e2e/*, scripts/* so test.yml's eslint step is green.

Test plan

  • node -e \"require('./detox.config.js')\" — parses
  • npx eslint --ignore-path .gitignore . — clean
  • npx tsc --noEmit -p . — clean
  • test -x scripts/upload-apk-to-browserstack.sh — passes
  • Trigger detox-android-emulator.yml manually after merge to confirm real Percy build

Required repo secrets (already documented)

  • PERCY_TOKEN — App-type Percy project token (starts with app_)
  • BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY — for the detox-bs-android.yml workflow

Post-Deploy Monitoring & Validation

  • Validation checks
    • After merge, dispatch detox-android-emulator.yml manually to confirm a real Percy build is produced.
    • Watch the first nightly cron run (04:00 UTC) for stability.
  • Failure signal / rollback
    • If emulator boot fails or AVD cache corrupts: clear the avd-${api-level} cache key in the Actions UI.
    • If Detox tests time out: increase timeout-minutes (currently 45).
  • Validation window
    • First 3 nightly runs after merge.

🤖 Generated with Claude Code

- Add iOS Detox configuration (ios.debug app, simulator device, ios.sim.debug
  configuration) plus ios + build:ios + test:ios scripts; add `pod 'Detox'`
  to Podfile.
- Rewrite README to match Percy's standard 8-step example-repo tutorial template
  (matches example-percy-cypress, example-percy-java-selenium, example-percy-webdriverio).
- Add detox-android-emulator.yml — real Detox runtime on a Linux runner via
  reactivecircus/android-emulator-runner. Manual dispatch + nightly cron.
  Produces actual Percy builds.
- Improve test.yml to run install + lint + tsc + parse checks (was parse-only).
- Lint pass: prettier-style auto-fixes across detox.config.js, e2e/*, scripts/*.
Comment on lines +16 to +84
name: Build APK + run Detox + capture Percy
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4

- name: Set up Node 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

# AVD creation is expensive — cache the snapshot so subsequent runs boot in seconds.
- name: Cache AVD
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ inputs.avd-api-level || '34' }}

- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ inputs.avd-api-level || '34' }}
arch: x86_64
target: google_apis
avd-name: Pixel_7_API_34
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."

- name: Install dependencies
run: npm install --legacy-peer-deps

- name: Build Android APKs (debug + androidTest)
run: npm run build:android

- name: Run Detox tests under Percy
uses: reactivecircus/android-emulator-runner@v2
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
with:
api-level: ${{ inputs.avd-api-level || '34' }}
arch: x86_64
target: google_apis
avd-name: Pixel_7_API_34
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: npx percy app:exec -- npm run test:android

- name: Upload Detox artifacts on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: detox-artifacts
path: |
artifacts
android/app/build/outputs/logs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants