-
-
Notifications
You must be signed in to change notification settings - Fork 2
94 lines (90 loc) · 2.94 KB
/
test-coverage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: test-coverage
run-name: Test the project coverage and upload to codecov
permissions:
contents: write
packages: write
deployments: write
issues: write
pull-requests: write
repository-projects: write
security-events: write
statuses: write
on: push
jobs:
check_changes:
outputs:
run_build: ${{ steps.verify-changed-files.outputs.any_changed }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Verify Changed files
uses: tj-actions/changed-files@v37
id: verify-changed-files
with:
files: |
pubspec.yaml
pubspec.lock
l10n.yaml
lib
android
test
integration_test
build:
runs-on: macos-latest
needs: check_changes
if: needs.check_changes.outputs.run_build == 'true'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Gradle cache
uses: gradle/gradle-build-action@v2
- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-33
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 31
arch: x86_64
profile: pixel_6_pro
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:' # optional, change this to force refresh cache
architecture: x64
- run: flutter pub get
- run: dart pub global activate full_coverage
- run: flutter analyze .
- run: flutter gen-l10n
- run: dart pub global run full_coverage
- run: flutter test --coverage --dart-define=USERNAME=${{ secrets.USERNAME }} --dart-define=PASSWORD=${{ secrets.PASSWORD }}
- name: run integration tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 31
arch: x86_64
profile: pixel_6_pro
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: flutter test integration_test/app_test.dart --coverage --dart-define=USERNAME=${{ secrets.USERNAME }} --dart-define=PASSWORD=${{ secrets.PASSWORD }} --dart-define=NAME="${{ secrets.NAME }}"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3