-
-
Notifications
You must be signed in to change notification settings - Fork 535
60 lines (50 loc) · 1.51 KB
/
code-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
name: 📊 Code Coverage
on: [push, pull_request]
env:
PUB_ENVIRONMENT: bot.github
jobs:
test_with_coverage:
name: 🧪 Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
# Checkout the Repository
- name: 📥 Checkout Repository
uses: actions/checkout@v4
# Setup Flutter SDK with Cache
- name: ⚡ Set Up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
# Cache Pub Dependencies
- name: 📦 Cache Pub Dependencies
uses: actions/cache@v3
with:
path: |
~/.pub-cache
.dart_tool
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: |
${{ runner.os }}-pub-
# Install Project Dependencies
- name: 🚀 Install Dependencies
run: flutter pub get
# Run Tests with Code Coverage
- name: ✅ Run Unit Tests with Coverage
run: flutter test --coverage
# Upload Coverage Report as Artifact
- name: 📊 Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/lcov.info
# Upload Coverage to Codecov
- name: ☁️ Upload Coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/lcov.info
flags: unittests
name: codecov-flutter
fail_ci_if_error: true