Skip to content
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

ci: use nix setup for e2e tests #3118

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 28 additions & 31 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,12 @@ jobs:
steps:
- uses: actions/checkout@v2

# Node, Ruby, Java, Android Sdk
- uses: actions/setup-node@v2
with:
node-version: 20
- run: npm i -g yarn
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: actions/setup-java@v2
with:
java-version: 17
distribution: temurin
- uses: android-actions/setup-android@v3
# In case this is run on a runner without nix
# - uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@v2
- uses: nicknovitski/nix-develop@v1

# Caching
- uses: gradle/actions/setup-gradle@v3
- uses: DeterminateSystems/magic-nix-cache-action@v2
- uses: actions/cache@v2
with:
path: |
Expand All @@ -47,30 +36,35 @@ jobs:
run: yarn install
env:
LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8

# Metro
- name: Start Metro
run: |
yarn start &
echo "METRO_PID=$!" >> $GITHUB_ENV

# Build
# Builds
- run: yarn e2e:build ios.sim.debug
- run: yarn e2e:build android.emu.debug

# Start Tilt
- name: Tilt CI
run: |
for i in {1..5}; do
echo "Tilt CI attempt $i"
nix develop -c sh -c 'cd dev && tilt ci' && exit 0 || sleep 15
done
exit 1
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
retry_wait_seconds: 15
max_attempts: 5
command: cd dev && tilt ci

# Tests on iOS Simulator
- name: Run Detox Tests on iOS Simulator
run: yarn e2e:test ios.sim.debug -d -R 5 --take-screenshots all --record-videos all --record-logs all --artifacts-location ios-recordings
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 5
command: |
rm -rf ios-recordings || true
yarn e2e:test ios.sim.debug -d --take-screenshots all --record-videos all --record-logs all --artifacts-location ios-recordings

- run: killall Simulator
if: always()
Expand All @@ -85,15 +79,17 @@ jobs:
# Tests on Android Emulator
- name: Start Android Emulator
run: |
sdkmanager --install 'build-tools;34.0.0' platform-tools > /dev/null
sdkmanager --install emulator --channel=0 > /dev/null
sdkmanager --install 'system-images;android-34;google_apis_playstore;arm64-v8a' --channel=0 > /dev/null
echo no | avdmanager create avd --force -n Pixel_API_34 --abi 'google_apis_playstore/arm64-v8a' --package 'system-images;android-34;google_apis_playstore;arm64-v8a' --device 'pixel_6a'
emulator -avd Pixel_API_34 -gpu swiftshader_indirect -no-boot-anim &
make emulator &
adb wait-for-device

- name: Run Detox Tests on Android Emulator
run: yarn e2e:test android.emu.debug -d -R 5 --take-screenshots all --record-videos all --record-logs all --artifacts-location android-recordings
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 5
command: |
rm -rf android-recordings || true
yarn e2e:test android.emu.debug -d --take-screenshots all --record-videos all --record-logs all --artifacts-location android-recordings

- name: Kill Android Emulator
if: always()
Expand All @@ -116,5 +112,6 @@ jobs:
if: always()
continue-on-error: true
run: |
nix develop -c sh -c 'cd dev && tilt down' || true
cd dev && tilt down || true
docker volume prune -af || true
docker rm -f $(docker ps -aq)
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ tilt-down:
cd dev && tilt down

emulator:
emulator -avd Pixel_API_34 -gpu swiftshader
emulator -avd Pixel_API_34 -gpu swiftshader -wipe-data -no-boot-anim
Loading