add CI/CD setup #17
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 Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.0' | |
bundler-cache: true | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: | | |
yarn install --frozen-lockfile | |
cd android && bundle install | |
- name: Update Fastlane | |
run: | | |
cd android | |
bundle update fastlane | |
- name: Create fastlane directory and Fastfile | |
run: | | |
cd android | |
mkdir -p fastlane | |
echo ' | |
default_platform(:android) | |
platform :android do | |
desc "Build and install the app" | |
lane :build_and_install do | |
gradle(task: "clean assembleDebug") | |
gradle(task: "installDebug") | |
end | |
end | |
' > fastlane/Fastfile | |
echo "Contents of android/fastlane directory:" | |
ls -la fastlane | |
- name: Debug current directory before build | |
run: | | |
echo "Current directory: $(pwd)" | |
echo "Contents of current directory:" | |
ls -la | |
echo "Contents of android directory:" | |
ls -la android | |
- name: Build and run Android app | |
uses: reactivecircus/android-emulator-runner@v2 | |
env: | |
FASTLANE_OPT_OUT_USAGE: "YES" | |
FASTLANE_DISABLE_COLORS: "1" | |
FASTLANE_SKIP_UPDATE_CHECK: "1" | |
FASTLANE_DISABLE_INTERACTIVE: "1" | |
CI: "true" | |
TERM: "xterm" | |
with: | |
api-level: 29 | |
arch: x86_64 | |
profile: Nexus 6 | |
script: | | |
cd android | |
echo "Current directory: $(pwd)" | |
echo "Contents of current directory:" | |
ls -la | |
echo "Contents of fastlane directory:" | |
ls -la fastlane | |
bundle exec fastlane build_and_install --verbose | |
cd .. | |
echo "Installing Maestro..." | |
curl -Ls "https://get.maestro.mobile.dev" | bash | |
export PATH="$PATH":"$HOME/.maestro/bin" | |
echo "Running Maestro tests..." | |
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 |