@@ -2,11 +2,11 @@ name: CI
22
33on :
44 push :
5- branches : [ main ]
5+ branches : [main]
66 paths-ignore :
77 - ' **/README.md'
88 pull_request :
9- branches : [ main ]
9+ branches : [main]
1010
1111defaults :
1212 run :
@@ -15,9 +15,8 @@ defaults:
1515jobs :
1616 test-app :
1717 name : App
18- timeout-minutes : 40
19-
2018 runs-on : ubuntu-latest
19+ timeout-minutes : 40
2120
2221 steps :
2322 - name : Checkout
@@ -34,109 +33,121 @@ jobs:
3433 - name : Cache pub dependencies
3534 uses : actions/cache@v4
3635 with :
37- path : ${{ env.FLUTTER_HOME }}/.pub-cache
36+ path : ${{ env.HOME }}/.pub-cache
3837 key : ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
3938 restore-keys : ${{ runner.os }}-pub-
4039
4140 - name : Download pub dependencies
4241 run : flutter pub get
4342
44- # - name: Pub Global
45- # run: dart pub global activate flutter_gen
46-
47- # - name: Build runner
48- # run: flutter packages pub run build_runner build --delete-conflicting-outputs
49-
50- # - name: Generate intl
51- # run: flutter pub run intl_utils:generate
52-
53- # - name: Run fluttergen
54- # run: fluttergen -c pubspec.yaml
55-
5643 - name : Run analyzer
5744 run : flutter analyze
5845
59- # - name: Run Dart code metrics
60- # run: flutter pub run dart_code_metrics:metrics analyze lib
61-
6246 - name : Run tests
6347 run : flutter test --coverage
6448
65- # - name: Create Android emulator
66- # uses: reactivecircus/android-emulator-runner@v2
67- # with:
68- # api-level: 28
69- # target: google_apis
70- # arch: x86_64
71- # profile: Nexus 6
72- # script: |
73- # flutter test integration_test/app_test.dart --flavor dev --timeout none
74- #
75- # echo "Closing connection with emulator-5554"
76- # adb -s emulator-5554 emu kill || true
77- #
78- # echo "Closing connection with emulator-5556"
79- # adb -s emulator-5556 emu kill || true
80-
8149 - name : Install lcov
8250 run : sudo apt-get install -y lcov
8351
8452 - name : Upload test results
8553 if : always()
8654 uses : actions/upload-artifact@v4
8755 with :
88- name : integration -test-results
56+ name : unit -test-results
8957 path : build/
9058
91- - name : Install lcov
92- run : sudo apt-get install -y lcov
93-
94- - name : Remove generated files from code coverage report
95- run : lcov --remove coverage/lcov.info 'lib/*/*.gen.dart' 'lib/generated/*.dart' 'lib/generated/*/*.dart' 'lib/di/*.dart' '**/lib/constants/' 'lib/constants/*.dart' -o coverage/lcov.info --ignore-errors unused
96-
97- - name : Remove router from code coverage report
98- run : lcov --remove coverage/lcov.info 'lib/routers/router.dart' -o coverage/lcov.info --ignore-errors unused
59+ - name : Clean coverage report
60+ run : |
61+ lcov --remove coverage/lcov.info \
62+ 'lib/**.gen.dart' \
63+ 'lib/generated/**' \
64+ 'lib/di/**' \
65+ 'lib/constants/**' \
66+ 'lib/routers/router.dart' \
67+ -o coverage/lcov.info \
68+ --ignore-errors unused
9969
10070 - name : Check Code Coverage
10171 uses :
VeryGoodOpenSource/[email protected] 10272 with :
10373 path : coverage/lcov.info
10474 min_coverage : 59
105- exclude : ' **/*.g.dart **/*.gen.dart **/lib/di/ lib/generated/ **/lib/generated/ lib/di/*.dart **/lib/constants/ lib/constants/*.dart/ lib/routers/router.dart'
106-
107- - name : Upload coverage to codecov
75+ exclude : |
76+ **/*.g.dart
77+ **/*.gen.dart
78+ lib/di/**
79+ lib/generated/**
80+ lib/constants/**
81+ lib/routers/router.dart
82+
83+ - name : Upload coverage to Codecov
10884 uses : codecov/codecov-action@v5
10985
110- - name : Run codacy-coverage-reporter
86+ - name : Codacy Coverage Reporter
11187 uses : codacy/codacy-coverage-reporter-action@v1
11288 with :
11389 project-token : ${{ secrets.CODACY_PROJECT_TOKEN }}
11490 coverage-reports : ./coverage/lcov.info
11591
116- integration_tests :
117- runs-on : macos-latest
92+ integration-tests :
93+ name : Flutter Integration Tests
94+ runs-on : ubuntu-latest
95+ timeout-minutes : 60
96+ strategy :
97+ fail-fast : true
98+ matrix :
99+ api-level : [22, 26, 31]
100+
118101 steps :
119- - name : Checkout code
120- uses : actions/checkout@v3
102+ - name : Checkout
103+ uses : actions/checkout@v4
121104
122- - name : Set up Flutter
105+ - name : Setup Flutter
123106 uses : subosito/flutter-action@v2
124107 with :
125- channel : stable
108+ flutter-version : stable
126109
127- - name : Install dependencies
128- run : flutter pub get
110+ - name : Enable KVM
111+ run : |
112+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
113+ sudo udevadm control --reload-rules
114+ sudo udevadm trigger --name-match=kvm
129115
130- - uses : futureware-tech/simulator-action@v4
116+ - name : Setup Android emulator and run integration tests
117+ uses : reactivecircus/android-emulator-runner@v2
131118 with :
132- model : ' iPhone 16 Pro'
133- wait_for_boot : true
134-
135- # Pre-building the app serves two purposes:
136- # 1. Verifies that the app builds successfully before running integration tests.
137- # 2. Speeds up the integration test startup, reducing the risk of test timeouts.
138- - name : Pre-build the app
139- run : flutter build ios --simulator --target=integration_test/app_test.dart --flavor dev
140-
141- - name : Run integration tests
142- run : flutter test integration_test/app_test.dart --flavor dev --timeout 1h
119+ api-level : ${{ matrix.api-level }}
120+ arch : x86_64
121+ target : google_apis
122+ profile : Nexus 6
123+ script : |
124+ flutter pub get
125+ flutter test integration_test --flavor dev --timeout 1h
126+
127+ # integration_tests:
128+ # runs-on: macos-latest
129+ # steps:
130+ # - name: Checkout code
131+ # uses: actions/checkout@v3
132+ #
133+ # - name: Set up Flutter
134+ # uses: subosito/flutter-action@v2
135+ # with:
136+ # channel: stable
137+ #
138+ # - name: Install dependencies
139+ # run: flutter pub get
140+ #
141+ # - uses: futureware-tech/simulator-action@v4
142+ # with:
143+ # model: 'iPhone 16 Pro'
144+ # wait_for_boot: true
145+ #
146+ # # Pre-building the app serves two purposes:
147+ # # 1. Verifies that the app builds successfully before running integration tests.
148+ # # 2. Speeds up the integration test startup, reducing the risk of test timeouts.
149+ # - name: Pre-build the app
150+ # run: flutter build ios --simulator --target=integration_test/app_test.dart --flavor dev
151+ #
152+ # - name: Run integration tests
153+ # run: flutter test integration_test/app_test.dart --flavor dev --timeout 1h
0 commit comments