Try to add delay in new tests #94
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: Test | |
on: | |
push: | |
branches: | |
- "**" | |
- "!main" # Prevent when pushing on main | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
js: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Cache node dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
run: yarn install | |
- name: Run JS tests | |
run: yarn test | |
android: | |
needs: js | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: testApp | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Cache node dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
run: yarn install | |
- name: Cache Gradle Wrapper | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} | |
- name: Cache Gradle Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle-caches- | |
- name: Make Gradlew Executable | |
run: cd android && chmod +x ./gradlew | |
- name: Build Android App | |
run: | | |
npx react-native bundle --platform android --dev false --entry-file index.tsx --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/ | |
cd android && ./gradlew assembleDebug --no-daemon | |
- name: Upload Android App APK | |
uses: actions/upload-artifact@v1 | |
with: | |
name: app-debug.apk | |
path: testApp/android/app/build/outputs/apk/debug/app-debug.apk | |
- name: Build Android Test | |
run: | | |
cd android && ./gradlew :app:assembleDebugAndroidTest --no-daemon | |
- name: Upload Android Test APK | |
uses: actions/upload-artifact@v1 | |
with: | |
name: app-debug-androidTest.apk | |
path: testApp/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk | |
# Authenticate Cloud SDK | |
- id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: ${{ secrets.GCP_CREDENTIALS }} | |
- name: Setup Cloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
project_id: ${{ secrets.FIREBASE_PROJECT_ID }} | |
- name: Run Instrumentation Tests in Firebase Test Lab | |
run: | | |
gcloud firebase test android run --type instrumentation \ | |
--app android/app/build/outputs/apk/debug/app-debug.apk \ | |
--test android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk \ | |
--device model=MediumPhone.arm,version=33,locale=en,orientation=portrait \ | |
--num-flaky-test-attempts=3 | |
ios: | |
needs: js | |
runs-on: macos-latest | |
defaults: | |
run: | |
working-directory: testApp | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
registry-url: 'https://registry.npmjs.org' | |
- name: Cache node dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
run: yarn install | |
- name: Install pods | |
run: cd ios && pod install | |
- name: Run iOS Tests | |
run: | | |
cp index.tsx index.js | |
npx react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios/assets | |
rm index.js | |
cd ios && TEST=1 && RCT_NO_LAUNCH_PACKAGER=1 xcodebuild \ | |
-workspace DidomiExample.xcworkspace \ | |
-scheme DidomiExample \ | |
-sdk iphonesimulator \ | |
-destination "platform=iOS Simulator,name=iPhone 11" \ | |
clean test |