Skip to content

Commit

Permalink
Merge pull request #63 from natsuk4ze/implove-test
Browse files Browse the repository at this point in the history
Implove tests
  • Loading branch information
natsuk4ze authored Aug 3, 2023
2 parents af00bbc + 15ec045 commit 638165b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 70 deletions.
72 changes: 9 additions & 63 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,69 +4,29 @@ on:
push:

jobs:
cancel-outdated-runs:
set-up:
runs-on: ubuntu-latest
steps:
- name: Cancel
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
setup:
runs-on: macos-latest
steps:
- name: Check out
uses: actions/checkout@v3

- name: Setup Flutter SDK
uses: subosito/flutter-action@v2
with:
channel: beta

- name: Cache Flutter SDK
uses: actions/cache@v3
with:
path: /opt/hostedtoolcache/Flutter
key: ${{ runner.os }}-flutter-${{ hashFiles('**/flutter/bin/cache/**') }}-${{ github.run_id }}

- name: Cache Flutter packages
uses: actions/cache@v3
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}-${{ github.run_id }}

- name: Install packages
run: flutter --disable-telemetry && flutter clean && flutter pub get

- name: Analyze
run: flutter analyze

ios:
needs: setup
timeout-minutes: 60
needs: set-up
timeout-minutes: 30
strategy:
fail-fast: true
runs-on: macos-latest
steps:
- name: Check out
uses: actions/checkout@v3

- name: Cache Flutter SDK
uses: actions/cache@v3
with:
path: /opt/hostedtoolcache/Flutter
key: ${{ runner.os }}-flutter-${{ hashFiles('**/flutter/bin/cache/**') }}-${{ github.run_id }}

- name: Setup Flutter SDK
uses: subosito/flutter-action@v2
with:
channel: beta

- name: Cache Flutter packages
uses: actions/cache@v3
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}-${{ github.run_id }}

- name: Install Flutter dependencies
run: flutter pub get ./example

Expand All @@ -75,7 +35,7 @@ jobs:
model: iPhone 14 Pro Max

- name: Build
timeout-minutes: 20
timeout-minutes: 10
run: |
cd example
flutter build ios --simulator --target=integration_test/integration_test.dart
Expand All @@ -98,8 +58,8 @@ jobs:
flutter test integration_test/integration_test.dart --timeout none
android:
needs: setup
timeout-minutes: 60
needs: set-up
timeout-minutes: 30
runs-on: macos-latest
strategy:
matrix:
Expand All @@ -109,23 +69,11 @@ jobs:
- name: Check out
uses: actions/checkout@v3

- name: Cache Flutter SDK
uses: actions/cache@v3
with:
path: /opt/hostedtoolcache/Flutter
key: ${{ runner.os }}-flutter-${{ hashFiles('**/flutter/bin/cache/**') }}-${{ github.run_id }}

- name: Setup Flutter SDK
uses: subosito/flutter-action@v2
with:
channel: beta

- name: Cache Flutter packages
uses: actions/cache@v3
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}-${{ github.run_id }}

- name: Install Flutter dependencies
run: flutter pub get ./example

Expand All @@ -151,7 +99,7 @@ jobs:
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
emulator-boot-timeout: 600
emulator-boot-timeout: 300
force-avd-creation: false
sdcard-path-or-size: ${{ matrix.api-level <= 23 && '10M' || null }}
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none
Expand All @@ -165,13 +113,12 @@ jobs:
api-level: ${{ matrix.api-level }}
working-directory: ./example
arch: x86_64
emulator-boot-timeout: 300
emulator-boot-timeout: 120
force-avd-creation: false
sdcard-path-or-size: ${{ matrix.api-level <= 23 && '10M' || null }}
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none
script: |
if [ ${{ matrix.api-level }} -le 29 ]; then flutter build apk --debug; adb install -r build/app/outputs/flutter-apk/app-debug.apk; adb shell pm grant studio.midoridesign.gal_example android.permission.WRITE_EXTERNAL_STORAGE; fi
if [ ${{ matrix.api-level }} -le 23 ]; then adb shell pm grant studio.midoridesign.gal_example android.permission.READ_EXTERNAL_STORAGE; fi
flutter test integration_test/integration_test.dart --timeout none
- name: Retry integration tests
Expand All @@ -181,7 +128,7 @@ jobs:
api-level: ${{ matrix.api-level }}
working-directory: ./example
arch: x86_64
emulator-boot-timeout: 600
emulator-boot-timeout: 300
force-avd-creation: false
sdcard-path-or-size: ${{ matrix.api-level <= 23 && '10M' || null }}
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none
Expand All @@ -191,5 +138,4 @@ jobs:
script: |
flutter clean && flutter pub get
if [ ${{ matrix.api-level }} -le 29 ]; then flutter build apk --debug; adb install -r build/app/outputs/flutter-apk/app-debug.apk; adb shell pm grant studio.midoridesign.gal_example android.permission.WRITE_EXTERNAL_STORAGE; fi
if [ ${{ matrix.api-level }} -le 23 ]; then adb shell pm grant studio.midoridesign.gal_example android.permission.READ_EXTERNAL_STORAGE; fi
flutter test integration_test/integration_test.dart --timeout none
9 changes: 2 additions & 7 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,11 @@
android:name="flutterEmbedding"
android:value="2" />
</application>
<uses-permission android:name="android.permission.INTERNET"/>

<!-- Gal: If supports API <29 add this key :Gal-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="29" />

<!--Package users can ignore this key: For example-->
<uses-permission android:name="android.permission.INTERNET"/>

<!--Package users can ignore this key: For integration test-->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="23" />
<!-- Gal: If supports API <29 add this key :Gal-->

</manifest>

0 comments on commit 638165b

Please sign in to comment.