-
Notifications
You must be signed in to change notification settings - Fork 31
61 lines (49 loc) · 1.73 KB
/
test.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
name: Test
# Tests workflow runs unit tests and uploads a code coverage report
# This workflow is run on pushes to main and every pull requests where a .dart, .mod, .sum have been changed
on:
pull_request:
push:
branches:
- main
jobs:
Unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Setup 🔨
uses: dart-lang/[email protected]
with:
sdk: 3.2.0
- name: Get dependencies 📥
run: dart pub get
- name: Compute diff 📜
uses: technote-space/[email protected]
with:
PATTERNS: |
**/**.dart
pubspec.yaml
- name: Test 🔧
if: env.GIT_DIFF
run: |
dart pub global activate coverage
dart pub global run coverage:test_with_coverage
- name: Clean coverage 🧹
if: env.GIT_DIFF
run: |
dart pub global activate remove_from_coverage
# Exclude the .pub-cache
dart pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '/.pub-cache/'
# Exclude all g.dart files
dart pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '.g.dart$'
# Exclude the proto files
dart pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '/lib/proto/'
# Exclude the test folder
dart pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '/test/'
- name: Upload coverage 📤
if: env.GIT_DIFF
uses: codecov/codecov-action@v3
with:
file: coverage/lcov.info
fail_ci_if_error: true