Repository navigation
124 lines (100 loc) · 3.37 KB
/
Copy pathci.yml
File metadata and controls
124 lines (100 loc) · 3.37 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: CI
on:
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
package-score:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Flutter
uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2
with:
channel: stable
cache: true
pub-cache: true
- name: Install latest pana
run: dart pub global activate pana
- name: Require maximum pub points
run: dart pub global run pana . --exit-code-threshold 0
quality:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Flutter
uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2
with:
channel: stable
cache: true
pub-cache: true
- name: Install package dependencies
run: flutter pub get
- name: Install example dependencies
run: flutter pub get
working-directory: example
- name: Generate example icon catalog
run: dart run tool/generate_example_icon_catalog.dart
- name: Check formatting
run: dart format --output=none --set-exit-if-changed .
- name: Analyze
run: flutter analyze --fatal-infos --fatal-warnings
- name: Run tests with coverage
run: flutter test --coverage
- name: Enforce coverage
run: |
awk -F: -v minimum=0.90 '
/^SF:/ {
source = substr($0, 4)
gsub(/\\/, "/", source)
in_lib = source ~ /(^|\/)lib\//
}
in_lib && /^LF:/ { total += $2 }
in_lib && /^LH:/ { covered += $2 }
END {
if (total == 0) {
print "Coverage report contains no executable lib lines" > "/dev/stderr"
exit 1
}
ratio = covered / total
printf "Coverage: %d/%d lines (%.2f%%)\n", covered, total, 100 * ratio
exit ratio < minimum
}
' coverage/lcov.info
- name: Install Chrome
id: chrome
uses: browser-actions/setup-chrome@48ad923757ca74d66703209fe939badbdf80f2f4 # v2
- name: Run browser smoke test
run: flutter test --platform chrome test/web_smoke_test.dart
env:
CHROME_EXECUTABLE: ${{ steps.chrome.outputs.chrome-path }}
- name: Test example
run: flutter test
working-directory: example
- name: Build example for web
run: flutter build web --release
working-directory: example
- name: Validate package
run: dart pub publish --dry-run
- name: Upload failure diagnostics
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: morphnext-failure-${{ github.run_attempt }}
path: |
test/failures/
if-no-files-found: ignore
retention-days: 14