-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (42 loc) · 1.46 KB
/
Copy pathci.yml
File metadata and controls
53 lines (42 loc) · 1.46 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
name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
analyze-and-test:
name: Lint & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: Install dependencies
run: flutter pub get
- name: Verify formatting
run: dart format --output=none --set-exit-if-changed lib/ test/ bin/
- name: Analyze code
run: dart analyze lib/ test/ bin/
- name: Run tests with coverage
run: flutter test --coverage --exclude-tags=integration --timeout=30s
- name: Enforce 80% line coverage floor
run: |
lcov_path="coverage/lcov.info"
if [ ! -f "$lcov_path" ]; then
echo "lcov.info missing at $lcov_path"
exit 1
fi
pct=$(awk -F: '/^LF:/{lf+=$2} /^LH:/{lh+=$2} END{ if (lf==0) exit 1; printf "%.2f", (lh/lf)*100 }' "$lcov_path")
echo "Line coverage: ${pct}%"
awk -v p="$pct" 'BEGIN{ if (p+0 < 80.0) { print "FAIL: coverage below 80% floor"; exit 1 } else { print "PASS: coverage at or above 80% floor" } }'
- name: Upload coverage
uses: codecov/codecov-action@v7
with:
files: coverage/lcov.info
fail_ci_if_error: false
- name: Validate publish archive
run: dart pub publish --dry-run