improving e2e testing #1
Workflow file for this run
This file contains 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
name: End-to-end test | ||
on: | ||
workflow_call: | ||
inputs: | ||
timestamp: | ||
required: true | ||
type: string | ||
cache-key: | ||
required: true | ||
type: string | ||
env: | ||
REPO-OWNER: ${{ github.repository_owner }} | ||
jobs: | ||
e2e-test: | ||
name: End-to-end test | ||
runs-on: macos-13 | ||
strategy: | ||
matrix: | ||
include: | ||
- arch: x86_64 | ||
api-level: 30 | ||
env: | ||
CACHE-KEY: ${{ inputs.cache-key }} | ||
continue-on-error: true #temporary while e2e is still flaky | ||
steps: | ||
- name: Set envs for zingolib CI | ||
if: ${{ contains(github.repository, 'zingolib') }} | ||
run: echo "REPO-OWNER=zingolabs" >> $GITHUB_ENV | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ env.REPO-OWNER }}/zingo-mobile | ||
- name: Setup Docker 1 try | ||
uses: douglascamata/setup-docker-macos-action@v1-alpha | ||
id: dockerTry1 | ||
continue-on-error: true | ||
with: | ||
lima: v0.18.0 | ||
colima: v0.5.6 | ||
- name: checking outcome 1 | ||
run: echo ${{ steps.dockerTry1.outcome }} | ||
- name: Setup Docker 2 try | ||
if: steps.dockerTry1.outcome != 'success' | ||
uses: douglascamata/setup-docker-macos-action@v1-alpha | ||
id: dockerTry2 | ||
continue-on-error: true | ||
with: | ||
lima: v0.18.0 | ||
colima: v0.5.6 | ||
- name: checking outcome 2 | ||
run: echo ${{ steps.dockerTry2.outcome }} | ||
- name: Setup Docker Manually | ||
if: steps.dockerTry1.outcome != 'success' && steps.dockerTry2.outcome != 'success' | ||
run: | | ||
brew uninstall colima | ||
brew tap colima/releases | ||
brew install [email protected] | ||
brew install --formula docker | ||
colima start | ||
- name: Pull regchest docker image | ||
run: docker pull zingodevops/regchest:007 | ||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
- name: Gradle cache | ||
uses: gradle/actions/setup-gradle@v3 | ||
with: | ||
gradle-version: 8.2 | ||
build-root-directory: ./android | ||
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/dev'}} | ||
- name: Native rust cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: android/app/src/main/jniLibs/${{ matrix.arch }} | ||
key: native-android-uniffi-${{ matrix.arch }}-${{ env.CACHE-KEY }} | ||
fail-on-cache-miss: true | ||
- name: Kotlin uniffi cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: android/app/build/generated/source/uniffi/debug/java/uniffi/zingo | ||
key: kotlin-android-uniffi-${{ matrix.arch }}-${{ env.CACHE-KEY }} | ||
fail-on-cache-miss: true | ||
- name: Restore AVD cache | ||
uses: actions/cache/restore@v4 | ||
id: avd-cache | ||
with: | ||
path: | | ||
~/.android/avd/* | ||
~/.android/adb* | ||
key: avd-${{ matrix.arch }}-api-${{ matrix.api-level }}-e2e | ||
- 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: ${{ matrix.api-level }} | ||
arch: ${{ matrix.arch }} | ||
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: Save AVD cache | ||
if: steps.avd-cache.outputs.cache-hit != 'true' | ||
uses: actions/cache/save@v4 | ||
id: avd-cache-saving | ||
with: | ||
path: | | ||
~/.android/avd/* | ||
~/.android/adb* | ||
key: avd-${{ matrix.arch }}-api-${{ matrix.api-level }}-e2e | ||
-name: Yarn install | ||
run: yarn | ||
- name: Run Detox Build | ||
run: yarn detox build -c android.emu.debug -n test | ||
- name: Yarn Start | ||
run: nohup yarn start > "yarn_react_native_start.out" & | ||
- name: Run Detox Test | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
api-level: ${{ matrix.api-level }} | ||
arch: ${{ matrix.arch }} | ||
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: yarn detox test -c android.emu.debug -n test | ||