feat: 0.2.1-beta #8
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
# Copyright 2023 Google LLC | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# https://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: Run integration tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
android: | |
if: contains(github.base_ref, 'main') | |
timeout-minutes: 45 | |
strategy: | |
matrix: | |
patrol_cli_version: [2.5.0] | |
working_directory: | |
['example'] | |
runs-on: | |
labels: ubuntu-latest | |
env: | |
MAPS_API_KEY: ${{ secrets.ACTIONS_API_KEY }} | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
# Enables hardware acceleration for the Android SDK tools makes running Android tests much faster and consumes fewer minutes | |
# This feature is only available on larger linux runners like (ubuntu-latest-8core) | |
# - name: Enable KVM group perms | |
# run: | | |
# echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
# sudo udevadm control --reload-rules | |
# sudo udevadm trigger --name-match=kvm | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 | |
name: AVD Cache | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd | |
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa | |
with: | |
flutter-version: '3.16.x' | |
channel: 'stable' | |
cache: true | |
- name: Install patrol_cli | |
run: flutter pub global activate patrol_cli ${{ matrix.patrol_cli_version }} | |
- name: Run flutter pub get | |
run: flutter pub get | |
- name: Create and start emulator | |
run: | | |
echo "List installed packages" | |
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --list_installed | |
echo "Installing system image" | |
echo "y" | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager "system-images;android-33;google_apis;x86_64" | |
echo "Creating AVD" | |
echo "no" | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/avdmanager create avd -n test_emulator -k "system-images;android-33;google_apis;x86_64" --force | |
echo "Starting emulator" | |
$ANDROID_SDK_ROOT/emulator/emulator -avd test_emulator -no-audio -no-boot-anim -no-window & | |
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82' | |
- name: Generate gradlew file with flutter build | |
working-directory: ${{ matrix.working_directory }} | |
run: flutter build apk --config-only | |
- name: Run integration tests | |
working-directory: ${{ matrix.working_directory }} | |
run: patrol test --verbose | |
- name: Upload test report | |
uses: actions/upload-artifact@v3 | |
if: ${{ always() }} | |
with: | |
name: android_integration_test_report | |
path: example/build/app/reports/androidTests/connected/ | |
retention-days: 5 | |
ios: | |
if: contains(github.base_ref, 'main') | |
timeout-minutes: 90 | |
strategy: | |
matrix: | |
patrol_cli_version: [2.5.0] | |
working_directory: | |
['example'] | |
runs-on: | |
labels: macos-13-large | |
env: | |
MAPS_API_KEY: ${{ secrets.ACTIONS_API_KEY }} | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 | |
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa | |
with: | |
flutter-version: '3.16.x' | |
channel: 'stable' | |
cache: true | |
- uses: actions/cache@v3 | |
with: | |
path: '**/Pods' | |
key: ${{ runner.os }}-pods-${{ hashFiles('**/*.podspec') }} | |
restore-keys: | | |
${{ runner.os }}-pods- | |
- name: Select XCode 15.1 | |
run: sudo xcode-select -s '/Applications/Xcode_15.1.app/Contents/Developer' | |
- name: Start iOS simulator | |
run: | | |
RESULT=0 | |
while [[ $RESULT == 0 ]]; do | |
xcrun simctl delete "Flutter-iPhone" || RESULT=1 | |
if [ $RESULT == 0 ]; then | |
echo -e "Deleted Flutter-iPhone" | |
fi | |
done | |
xcrun simctl create "Flutter-iPhone" "com.apple.CoreSimulator.SimDeviceType.iPhone-14-Pro" "com.apple.CoreSimulator.SimRuntime.iOS-17-2" | xargs xcrun simctl boot | |
xcrun simctl list | |
- name: Install patrol_cli | |
run: flutter pub global activate patrol_cli ${{ matrix.patrol_cli_version }} | |
- name: Run flutter pub get | |
run: flutter pub get | |
- name: Run Integration tests | |
id: tests_step | |
working-directory: ${{ matrix.working_directory }} | |
run: | | |
patrol test --dart-define=MAPS_API_KEY="$MAPS_API_KEY" --verbose -d 'Flutter-iPhone' | |
- name: Upload test report | |
uses: actions/upload-artifact@v3 | |
if: ${{ always() }} | |
with: | |
name: ios_integration_test_report | |
path: example/build/ios_results_*.xcresult | |
retention-days: 5 |