-
Notifications
You must be signed in to change notification settings - Fork 9
74 lines (63 loc) · 2.18 KB
/
flutter.yaml
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
name: Application ON Push & PR DO Code check
on: [push, pull_request]
jobs:
code-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Check file existence
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "pubspec.yaml"
- name: Setup flutter
if: steps.check_files.outputs.files_exists == 'true'
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Check flutter sdk version
if: steps.check_files.outputs.files_exists == 'true'
run: flutter --version
- name: Get dependencies
if: steps.check_files.outputs.files_exists == 'true'
run: flutter pub get
- name: Setup Dart Code Metrics
if: steps.check_files.outputs.files_exists == 'true'
run: dart pub get dart_code_metrics
- name: Dart Code Metrics
if: steps.check_files.outputs.files_exists == 'true'
run: |
dirs_to_analyse=""
if [ -d lib ]; then dirs_to_analyse+=" lib"; fi
if [ -d test ]; then dirs_to_analyse+=" test"; fi
if [ -d example ]; then dirs_to_analyse+=" example"; fi
if [ dirs_to_analyse != "" ]
then
dart run dart_code_metrics:metrics \
analyze \
$dirs_to_analyse \
--fatal-warnings \
--fatal-performance \
--fatal-style
dart run dart_code_metrics:metrics \
check-unused-files \
$dirs_to_analyse \
--fatal-unused
dart run dart_code_metrics:metrics \
check-unused-code \
$dirs_to_analyse \
--fatal-unused
fi
- name: Check formatting
if: steps.check_files.outputs.files_exists == 'true'
run: dart format . --set-exit-if-changed
- name: Run tests
if: steps.check_files.outputs.files_exists == 'true'
run: |
# run tests if `test` folder exists
if [ -d test ]
then
flutter test -r expanded
else
echo "Tests not found."
fi