This commit is contained in:
Hillel Coren 2021-05-04 20:57:59 +03:00
parent 26e072a32e
commit 47194ad53e
1 changed files with 59 additions and 16 deletions

View File

@ -1,39 +1,82 @@
name: Run Tests name: Run Tests
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
drive:
env: test:
staging_secret: ${{secrets.staging_secret}} runs-on: macos-latest
staging_url: ${{secrets.staging_url}} #sequence of tasks called
firebase_ios: ${{secrets.firebase_ios}} steps:
- uses: actions/checkout@v1
# Setup a flutter environment.
# https://github.com/marketplace/actions/flutter-action
- uses: subosito/flutter-action@v1
with:
flutter-version: '2.0.5'
channel: 'stable'
- run: flutter pub get
# run static analys code
- run: flutter analyze
drive_ios:
strategy: strategy:
matrix: matrix:
device: device:
- "iPhone 11" - "iPhone 8 (13.3)"
- "iPad Air" - "iPhone 11 Pro (13.3)"
fail-fast: false fail-fast: false
runs-on: macOS-latest runs-on: macos-latest
needs: test
steps: steps:
- name: List all simulators - name: List all simulators
run: "xcrun instruments -s" run: xcrun instruments -s
# get UUID simulator and boot a simulator on mac from command line
- name: Start Simulator - name: Start Simulator
run: | run: |
UDID=$( UDID=$(
xcrun instruments -s | grep "${{ matrix.device }} (" | cut -d'[' -f 2 | cut -d']' -f 1 xcrun instruments -s |
awk \
-F ' *[][]' \
-v 'device=${{ matrix.device }}' \
'$1 == device { print $2 }'
) )
xcrun simctl boot "${UDID:?No Simulator with this name found}" xcrun simctl boot "${UDID:?No Simulator with this name found}"
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- uses: subosito/flutter-action@v1 - uses: subosito/flutter-action@v1
with: with:
flutter-version: '2.0.5'
channel: 'stable' channel: 'stable'
#flutter-version: '1.15.17' - name: Run iOS Flutter Driver tests
- run: flutter pub get run: flutter drive --target=test_driver/login_it.dart
- run: rm ios/Podfile
- run: | drive_android:
runs-on: macos-latest
#creates a build matrix for your jobs
strategy:
#set of different configurations of the virtual environment.
matrix:
api-level: [21, 29]
target: [default]
needs: test
steps:
- uses: actions/checkout@v1
- uses: subosito/flutter-action@v1
with:
flutter-version: '2.0.5'
channel: 'stable'
- name: Setup App
run: |
cp android/app/build.gradle.prod android/app/build.gradle cp android/app/build.gradle.prod android/app/build.gradle
cp lib/.env.dart.example lib/.env.dart cp lib/.env.dart.example lib/.env.dart
sed -i -e 's/user/medium/g' lib/.env.dart sed -i -e 's/user/medium/g' lib/.env.dart
sed -i -e 's/\/example.com/\/${{secrets.staging_url}}/g' lib/.env.dart sed -i -e 's/\/example.com/\/${{secrets.staging_url}}/g' lib/.env.dart
echo ${{secrets.firebase_ios}} | base64 --decode > ios/Runner/GoogleService-Info.plist echo ${{secrets.firebase_ios}} | base64 --decode > ios/Runner/GoogleService-Info.plist
- name: Run Tests - name: Run Android Flutter Driver tests
run: flutter drive --target=test_driver/login_it.dart uses: reactivecircus/android-emulator-runner@v1
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: x86_64
profile: Nexus 6
script: flutter drive --target=test_driver/login_it.dart