add CI/CD setup #21
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: React Native E2E Tests | |
on: | |
pull_request: | |
branches: [ main, develop ] | |
push: | |
branches: [ main, develop ] | |
workflow_dispatch: | |
jobs: | |
android-e2e-tests: | |
name: Android E2E Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Increase Java heap space | |
run: | | |
echo "org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError" >> android/gradle.properties | |
echo "org.gradle.daemon=false" >> android/gradle.properties | |
- name: Run Android app and Maestro tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
env: | |
JAVA_TOOL_OPTIONS: -Xmx4g | |
with: | |
api-level: 29 | |
arch: x86_64 | |
profile: Nexus 6 | |
script: | | |
echo "Building and running React Native Android app" | |
cd android && ./gradlew clean | |
cd .. && yarn android --no-packager | |
echo "Installing Maestro..." | |
curl -Ls "https://get.maestro.mobile.dev" | bash | |
echo 'export PATH="$PATH:$HOME/.maestro/bin"' >> $GITHUB_ENV | |
source $GITHUB_ENV | |
echo "Verifying Maestro installation..." | |
$HOME/.maestro/bin/maestro --version | |
echo "Running Maestro tests..." | |
$HOME/.maestro/bin/maestro test e2e/main-flow-android.yaml | |
- name: Upload Maestro logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: maestro-android-logs | |
path: ~/.maestro/logs |