Repository navigation
feat: Update tester-expo app and cover it with e2e tests #1519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MrMuzyk
wants to merge
34
commits into
callstack:main
Choose a base branch
from
MrMuzyk:tester-expo-app-e2e
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
6ff87a3
ci: temp e2e workflow
MrMuzyk c5fa84d
Merge branch 'callstack:main' into main
MrMuzyk 4feac60
feat: repack e2e tests
MrMuzyk e0a0ea5
Merge branch 'main' into e2e-ci
MrMuzyk 0254419
fix: CR fixes
MrMuzyk da3f15e
fix: pin ruby
MrMuzyk 53bca6d
fix: warn
MrMuzyk 62fd861
fix: cr fixes v2
MrMuzyk 31c9af0
feat: More features in MF2 test app
MrMuzyk b8b4207
Merge branch 'main' of github.com:MrMuzyk/repack into e2e-ci
MrMuzyk 144812f
fix: lock
MrMuzyk e010c48
Merge branch 'e2e-ci' of github.com:MrMuzyk/repack into add-more-feat…
MrMuzyk 46a7e94
feat: plugins
MrMuzyk dde9e4c
fix: prettier
MrMuzyk f84e401
Merge branch 'main' of github.com:MrMuzyk/repack into add-more-featur…
MrMuzyk 4354599
fix: ids
MrMuzyk 1612757
feat: assets tests
MrMuzyk e78ecbc
fix: prettier
MrMuzyk 1ffeb98
feat: svgr
MrMuzyk 9139910
fix: configs
MrMuzyk cae130c
feat: design doc and some cleanup of duplicated tests
MrMuzyk 5bb638f
fix: final touches
MrMuzyk d2074ff
fix: timeout as android is slower
MrMuzyk 351a1ef
fix: reduce motion warning
MrMuzyk 746a7d5
fix: failing android run
MrMuzyk 66a9047
fix: added some missing debugging logs and fixed some minor stuff
MrMuzyk 26e17ef
feat: Update tester-expo app and cover it with e2e tests
MrMuzyk 87e5c9d
fix: ios CI fix
MrMuzyk 9c8faed
Merge branch 'main' into tester-expo-app-e2e
MrMuzyk ec9271f
Merge branch 'main' into tester-expo-app-e2e
MrMuzyk 0e4181f
fix: Cachce similar to e2e lane
MrMuzyk 53027d5
Merge branch 'main' into tester-expo-app-e2e
MrMuzyk 706fe14
Merge branch 'main' into tester-expo-app-e2e
MrMuzyk 46a6035
Merge remote-tracking branch 'origin/main' into tester-expo-app-e2e
MrMuzyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,270 @@ | ||
| name: e2e (Expo) | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths-ignore: | ||
| - 'website/**' | ||
| - '**/*.md' | ||
| push: | ||
| branches: [main] | ||
| paths-ignore: | ||
| - 'website/**' | ||
| - '**/*.md' | ||
| workflow_dispatch: | ||
|
|
||
| # one run per PR; a new push cancels the older one | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: ${{ github.event_name != 'push' }} | ||
|
|
||
| # keep it read-only | ||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| E2E_TELEMETRY_DISABLED: '1' | ||
|
|
||
| jobs: | ||
| android: | ||
| name: e2e-expo (Android) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 45 | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2 | ||
|
|
||
| - name: Setup workspace | ||
| uses: ./.github/actions/setup-pnpm-node | ||
| with: | ||
| node-version: '24.22.1' | ||
|
|
||
| - name: Setup Java | ||
| uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # tag=v6.0.1 | ||
| with: | ||
| distribution: temurin | ||
| java-version: '17' | ||
|
|
||
| - name: Enable 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: Build workspace packages | ||
| run: pnpm --filter tester-expo... --filter tester-expo-widget... --filter tester-federation-v2... build | ||
|
|
||
| # android/ is generated, never committed | ||
| - name: Generate native project | ||
| run: pnpm --filter tester-expo exec expo prebuild --platform android --no-install | ||
|
|
||
| # Gradle dependencies come from the Actions cache, not Maven Central (it sometimes answers 404 | ||
| # for artifacts that exist). After prebuild: the key hashes files in android/ | ||
| - name: Restore Gradle cache | ||
| id: gradle-cache | ||
| uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # tag=v6.1.0 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: gradle-expo-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml', 'apps/tester-expo/android/**/*.gradle', 'apps/tester-expo/android/gradle.properties', 'apps/tester-expo/android/gradle/wrapper/gradle-wrapper.properties') }} | ||
| restore-keys: gradle-expo-${{ runner.os }}- | ||
|
|
||
| # nohup/disown: the runner kills step processes at the end | ||
| - name: Start dev servers | ||
| run: | | ||
| nohup pnpm --filter tester-expo repack:start > /tmp/host.log 2>&1 & | ||
| disown | ||
| nohup pnpm --filter tester-expo-widget repack:start:remote > /tmp/expo-widget.log 2>&1 & | ||
| disown | ||
| nohup pnpm --filter tester-federation-v2 start:expo-host-widget > /tmp/ordinary-widget.log 2>&1 & | ||
| disown | ||
| timeout 180 sh -c 'until [ "$(curl -sf localhost:8081/status)" = "packager-status:running" ] && [ "$(curl -sf localhost:8082/status)" = "packager-status:running" ] && [ "$(curl -sf localhost:8083/status)" = "packager-status:running" ]; do sleep 2; done' | ||
|
|
||
| # ask for the bundles now so the servers compile them — they only build on first request | ||
| - name: Warm all compilers | ||
| run: | | ||
| curl -sf --max-time 300 -o /dev/null 'http://localhost:8081/index.bundle?platform=android&dev=true&lazy=true&minify=false&app=com.callstack.repackexpo&modulesOnly=false&runModule=true' | ||
| curl -sf --max-time 300 -o /dev/null 'http://localhost:8082/android/mf-manifest.json' | ||
| curl -sf --max-time 300 -o /dev/null 'http://localhost:8083/android/mf-manifest.json' | ||
| echo 'All three served; compilers are warm.' | ||
|
|
||
| - name: Check shared versions are real semver | ||
| run: | | ||
| for p in 8081 8082; do | ||
| M=$(curl -sf --retry 3 --retry-delay 2 "http://localhost:$p/android/mf-manifest.json") || { echo "::error::port $p: mf-manifest.json not served"; exit 1; } | ||
| [ "$(jq '.shared | length' <<<"$M")" -gt 0 ] || { echo "::error::port $p: manifest has no shared entries"; exit 1; } | ||
| BAD=$(jq -r '.shared[] | select((.version // "") | test("^[0-9]+\\.[0-9]+\\.[0-9]+") | not) | "\(.name): \(.version)"' <<<"$M") | ||
| [ -z "$BAD" ] || { echo "::error::port $p has non-semver shared versions: $BAD"; exit 1; } | ||
| done | ||
|
|
||
| - name: Build Android app | ||
| working-directory: apps/tester-expo/android | ||
| run: ./gradlew :app:assembleDebug -PreactNativeArchitectures=x86_64 | ||
|
|
||
| # stop the daemon and drop lock files so the saved Gradle User Home is consistent | ||
| - name: Stop Gradle before caching | ||
| if: github.ref == 'refs/heads/main' && steps.gradle-cache.outputs.cache-hit != 'true' | ||
| working-directory: apps/tester-expo/android | ||
| run: | | ||
| ./gradlew --stop | ||
| rm -f ~/.gradle/caches/modules-2/modules-2.lock ~/.gradle/caches/modules-2/gc.properties | ||
|
|
||
| - name: Save Gradle cache | ||
| if: github.ref == 'refs/heads/main' && steps.gradle-cache.outputs.cache-hit != 'true' | ||
| uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # tag=v6.1.0 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: ${{ steps.gradle-cache.outputs.cache-primary-key }} | ||
|
|
||
| # expose dev servers to the emulator, install the APK, run the tests | ||
| - name: Run e2e on an emulator | ||
| uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # tag=v2.38.0 | ||
| with: | ||
| api-level: 35 | ||
| target: google_apis | ||
| arch: x86_64 | ||
| profile: pixel_7 | ||
| avd-name: e2e | ||
| disable-animations: false | ||
| working-directory: apps/tester-expo | ||
| script: | | ||
| adb shell settings put global hide_error_dialogs 1 | ||
| for i in 1 2 3; do adb shell "uiautomator dump /sdcard/d.xml >/dev/null && grep -q aerr_ /sdcard/d.xml" && { echo 'ANR dialog on screen, clearing it'; adb shell am force-stop com.google.android.apps.nexuslauncher; }; sleep 2; done | ||
| adb reverse tcp:8081 tcp:8081 | ||
| adb reverse tcp:8082 tcp:8082 | ||
| adb reverse tcp:8083 tcp:8083 | ||
| adb reverse --list | ||
| adb reverse --list | grep -q 'tcp:8081' || { echo '::error::adb reverse missing for tcp:8081'; exit 1; } | ||
| adb reverse --list | grep -q 'tcp:8082' || { echo '::error::adb reverse missing for tcp:8082'; exit 1; } | ||
| adb reverse --list | grep -q 'tcp:8083' || { echo '::error::adb reverse missing for tcp:8083'; exit 1; } | ||
| adb install -r -g android/app/build/outputs/apk/debug/app-debug.apk || { echo '::error::adb install failed'; exit 1; } | ||
| E2E_DEVICE="${ANDROID_SERIAL:-$(adb get-serialno)}" pnpm exec e2e run --target android --reporter list,junit; ec=$?; adb logcat -d -v time > .e2e/logcat.txt 2>&1; exit $ec | ||
|
|
||
| - name: Collect dev server logs | ||
| if: ${{ !cancelled() }} | ||
| working-directory: apps/tester-expo | ||
| run: | | ||
| mkdir -p .e2e | ||
| cp /tmp/host.log /tmp/expo-widget.log /tmp/ordinary-widget.log .e2e/ | ||
|
|
||
| - name: Upload e2e artifacts | ||
| if: ${{ !cancelled() }} | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # tag=v7.0.1 | ||
| with: | ||
| name: e2e-expo-android | ||
| path: apps/tester-expo/.e2e | ||
| include-hidden-files: true | ||
| if-no-files-found: warn | ||
| retention-days: 7 | ||
|
|
||
| - name: Show dev server logs | ||
| if: ${{ !cancelled() }} | ||
| run: tail -n 80 /tmp/host.log /tmp/expo-widget.log /tmp/ordinary-widget.log | ||
|
|
||
| # main + dispatch only | ||
| ios: | ||
| name: e2e-expo (iOS) | ||
| if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | ||
| runs-on: macos-15 | ||
| timeout-minutes: 45 | ||
| # expo-modules-jsi needs Swift 6.2; the image's default Xcode 16.4 has 6.1 | ||
| env: | ||
| DEVELOPER_DIR: /Applications/Xcode_26.3.app/Contents/Developer | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2 | ||
|
|
||
| - name: Setup workspace | ||
| uses: ./.github/actions/setup-pnpm-node | ||
| with: | ||
| node-version: '24.22.1' | ||
|
|
||
| - name: Build workspace packages | ||
| run: pnpm --filter tester-expo... --filter tester-expo-widget... --filter tester-federation-v2... build | ||
|
|
||
| - name: Start dev servers | ||
| run: | | ||
| nohup pnpm --filter tester-expo repack:start > /tmp/host.log 2>&1 & | ||
| disown | ||
| nohup pnpm --filter tester-expo-widget repack:start:remote > /tmp/expo-widget.log 2>&1 & | ||
| disown | ||
| nohup pnpm --filter tester-federation-v2 start:expo-host-widget > /tmp/ordinary-widget.log 2>&1 & | ||
| disown | ||
| for p in 8081 8082 8083; do curl -sf --retry 90 --retry-delay 2 --retry-all-errors --retry-connrefused -o /dev/null "http://localhost:$p/status"; done | ||
|
|
||
| - name: Warm all compilers | ||
| run: | | ||
| curl -sf --max-time 300 -o /dev/null 'http://localhost:8081/index.bundle?platform=ios&dev=true&lazy=true&minify=false&app=com.callstack.repackexpo&modulesOnly=false&runModule=true' | ||
| curl -sf --max-time 300 -o /dev/null 'http://localhost:8082/ios/mf-manifest.json' | ||
| curl -sf --max-time 300 -o /dev/null 'http://localhost:8083/ios/mf-manifest.json' | ||
| echo 'All three served; compilers are warm.' | ||
|
|
||
| - name: Check shared versions are real semver | ||
| run: | | ||
| for p in 8081 8082; do | ||
| M=$(curl -sf --retry 3 --retry-delay 2 "http://localhost:$p/ios/mf-manifest.json") || { echo "::error::port $p: mf-manifest.json not served"; exit 1; } | ||
| [ "$(jq '.shared | length' <<<"$M")" -gt 0 ] || { echo "::error::port $p: manifest has no shared entries"; exit 1; } | ||
| BAD=$(jq -r '.shared[] | select((.version // "") | test("^[0-9]+\\.[0-9]+\\.[0-9]+") | not) | "\(.name): \(.version)"' <<<"$M") | ||
| [ -z "$BAD" ] || { echo "::error::port $p has non-semver shared versions: $BAD"; exit 1; } | ||
| done | ||
|
|
||
| # SIM_RUNTIME_PREFIX is tied to the Xcode picked in DEVELOPER_DIR | ||
| - name: Boot simulator | ||
| env: | ||
| SIM_RUNTIME_PREFIX: com.apple.CoreSimulator.SimRuntime.iOS-26- | ||
|
Check warning on line 218 in .github/workflows/e2e-expo.yml
|
||
| SIM_DEVICE: iPhone 17 Pro | ||
| run: | | ||
| RT=$(xcrun simctl list runtimes -j | jq -r --arg prefix "$SIM_RUNTIME_PREFIX" '.runtimes | map(select(.isAvailable and (.identifier | startswith($prefix)))) | sort_by(.version) | last | .identifier') | ||
| echo "using $RT" | ||
| [ "$RT" != "null" ] && [ -n "$RT" ] | ||
| xcrun simctl create e2e "$SIM_DEVICE" "$RT" | ||
| xcrun simctl boot e2e | ||
| xcrun simctl bootstatus e2e -b | ||
|
|
||
| # ios/ is generated, never committed | ||
| - name: Generate native project | ||
| run: pnpm --filter tester-expo exec expo prebuild --platform ios --no-install | ||
|
|
||
| # CocoaPods needs a UTF-8 locale | ||
| - name: Build iOS app | ||
| working-directory: apps/tester-expo/ios | ||
| env: | ||
| LANG: en_US.UTF-8 | ||
| LC_ALL: en_US.UTF-8 | ||
| run: pod install && xcodebuild -workspace RepackExpoTester.xcworkspace -scheme RepackExpoTester -configuration Debug -destination 'generic/platform=iOS Simulator' -derivedDataPath build CODE_SIGNING_ALLOWED=NO ARCHS=arm64 build | ||
|
|
||
| - name: Run e2e | ||
| working-directory: apps/tester-expo | ||
| env: | ||
| E2E_DEVICE: e2e | ||
| run: | | ||
| xcrun simctl install booted ios/build/Build/Products/Debug-iphonesimulator/*.app | ||
| pnpm exec e2e run --target ios --reporter list,junit | ||
|
|
||
| - name: Collect dev server logs | ||
| if: ${{ !cancelled() }} | ||
| working-directory: apps/tester-expo | ||
| run: | | ||
| mkdir -p .e2e | ||
| cp /tmp/host.log /tmp/expo-widget.log /tmp/ordinary-widget.log .e2e/ | ||
| xcrun simctl spawn booted log show --style compact --last 30m \ | ||
| --predicate 'process == "RepackExpoTester"' \ | ||
| > .e2e/ios-syslog.txt 2>&1 || true | ||
|
|
||
| - name: Upload e2e artifacts | ||
| if: ${{ !cancelled() }} | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # tag=v7.0.1 | ||
| with: | ||
| name: e2e-expo-ios | ||
| path: apps/tester-expo/.e2e | ||
| include-hidden-files: true | ||
| if-no-files-found: warn | ||
| retention-days: 7 | ||
|
|
||
| - name: Show dev server logs | ||
| if: ${{ !cancelled() }} | ||
| run: tail -n 80 /tmp/host.log /tmp/expo-widget.log /tmp/ordinary-widget.log | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Minor · e2e-expo iOS job boots a simulator before prebuild; simctl create can die on a stale e2e device
xcrun simctl create e2eexits 1 with "device already exists" on any re-run or stateful macOS runner where thee2edevice persists in~/Library/Developer/CoreSimulator/Devicesfrom a prior boot.simctl createis not idempotent, so the step kills the job before any test runs.Suggested change
Add
xcrun simctl delete e2e >/dev/null 2>&1 || truebeforexcrun simctl create e2eto remove any pre-existing device. Also resolve the runtime viasimctl list runtimes -j | jqfiltering on$SIM_RUNTIME_PREFIXand assert it is non-null before passing it tocreate.Details
persona:
senior-developerUseful? Reply
@apex-sentinel-staging like, or@apex-sentinel-staging dislike <why>if it is not.Reply
@apex-sentinel-staging note ...to add context, or@apex-sentinel-staging pivot ...if it is wrong — I will re-check the cited code.