Skip to content

Commit

Permalink
ci: see if android works
Browse files Browse the repository at this point in the history
  • Loading branch information
sandipndev committed Jan 31, 2024
1 parent e6808df commit 46d9943
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 25 deletions.
10 changes: 0 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,3 @@ workflows:
- equal: ["api", << pipeline.trigger_source >>]
jobs:
- upload_to_app_store
test_in_pr:
when:
not:
equal: [main, << pipeline.git.branch >>]
jobs:
- e2e_ios
- e2e_build_android
- e2e_run_android:
requires:
- e2e_build_android
2 changes: 1 addition & 1 deletion .detoxrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = {
emulator: {
type: "android.emulator",
device: {
avdName: "Pixel_API_34_AOSP",
avdName: "Pixel_API_29_AOSP",
},
},
},
Expand Down
117 changes: 117 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: E2E

on: [pull_request]

jobs:
build-e2e-android:
name: Build APK
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 20
- uses: actions/setup-java@v2
with:
java-version: "11"
distribution: "adopt"
- uses: actions/cache@v2
with:
path: |
node_modules
ios/Pods
key: ${{ runner.os }}-deps-${{ hashFiles('**/yarn.lock', '**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-deps-
- run: NOPOSTINSTALLPODS=1 yarn install
- name: Build app
run: yarn e2e:build android.emu.debug

- uses: actions/upload-artifact@v4
with:
name: built-e2e-apk
path: android/app/build/outputs

test-e2e-android:
name: Run Detox Tests
runs-on: ubuntu-latest
needs: build-e2e-android

steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v4
with:
name: built-e2e-apk
path: android/app/build/outputs
- uses: actions/setup-node@v2
with:
node-version: 20
- uses: actions/setup-java@v2
with:
java-version: "11"
distribution: "adopt"
- uses: actions/cache@v2
with:
path: |
node_modules
ios/Pods
key: ${{ runner.os }}-deps-${{ hashFiles('**/yarn.lock', '**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-deps-
- run: NOPOSTINSTALLPODS=1 yarn install
- name: Start Metro
run: |
yarn start &
echo "METRO_PID=$!" >> $GITHUB_ENV
- uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2
- name: Run local backend in background
run: |
nix develop -c make tilt-up &
sleep 30
- run: nix develop -c tilt wait --timeout 1h --for=condition=Ready uiresources init-setup
- name: Run Detox Tests (test attempt 1)
continue-on-error: true
id: test1
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
avd-name: Pixel_API_29_AOSP
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none -camera-front none -partition-size 2047
arch: x86_64
script: yarn e2e:test android.emu.debug --headless -d -R 3

- name: Run Detox Tests (test attempt 2)
continue-on-error: true
id: test2
if: steps.test1.outcome != 'success'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
avd-name: Pixel_API_29_AOSP
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none -camera-front none -partition-size 2047
arch: x86_64
script: yarn e2e:test android.emu.debug --headless -d -R 3

- name: Run Detox Tests (test attempt 3)
if: steps.test1.outcome != 'success' && steps.test2.outcome != 'success'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
avd-name: Pixel_API_29_AOSP
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none -camera-front none -partition-size 2047
arch: x86_64
script: yarn e2e:test android.emu.debug --headless -d -R 3

# TODO: Store Artifacts in a bucket and get link

- name: Terminate Metro
if: always()
continue-on-error: true
run: kill $METRO_PID
14 changes: 0 additions & 14 deletions .github/workflows/test.yaml

This file was deleted.

0 comments on commit 46d9943

Please sign in to comment.