-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (71 loc) · 3.1 KB
/
build.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
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
name: "build"
on:
push:
branches: ["main"]
pull_request:
branches: ["main", "feature/*"]
workflow_dispatch:
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] # or: macos-latest, windows-latest
channel: [stable, beta, dev, main] # or: 'beta', 'dev' or 'main'
steps:
- uses: actions/checkout@v4
- name: 🎯 Setup Dart
uses: dart-lang/[email protected]
with:
sdk: ${{ matrix.channel }}
- id: disabled_analytics_dart
name: Disabled Analytics Dart
run: dart --disable-analytics
- name: 📦 Install Dependencies
run: dart pub get
# Verifies if the dart code is formatted well
- name: ✨ Verify formatting
run: dart format --output=none --set-exit-if-changed .
# --set-exit-if-changed stops execution if the any code is not well formatted
# --output=none prints files which needs to be formatted
# Checks for Semantic errors. Can be configured using analysis_options.yaml
- name: 🔍 Analyze project source
run: dart analyze --fatal-infos
# optionally use --fatal-warnings to stop execution if any warnings are found
# Checks for the quality and consistency of Dart code. Can be configured using analysis_options.yaml
- name: 🔍 Analyze project source (Dart code Linter - DCL)
run: dart run dart_code_linter:metrics analyze .
- name: 🔍 Analyze check unused files (DCL)
run: dart run dart_code_linter:metrics check-unused-files lib
- name: 🔍 Analyze check unused l10n (DCL)
run: dart run dart_code_linter:metrics check-unused-l10n .
- name: 🔍 Analyze check unused code (DCL)
run: dart run dart_code_linter:metrics check-unused-code .
- name: 🔍 Analyze check unnecessary nullable (DCL)
run: dart run dart_code_linter:metrics check-unnecessary-nullable .
- name: 🧪 Run Tests
run: |
dart pub global activate coverage
dart pub global run coverage:test_with_coverage
- name: 📦 Pre-publish - dry run
run: dart pub publish --dry-run
- name: 📊 Check Code Coverage
uses: VeryGoodOpenSource/very_good_coverage@v3
with:
path: "./coverage/lcov.info"
min_coverage: 100
- name: ⬆️ Upload Coverage to Coveralls
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage/lcov.info
- name: 💯 Verify Pub Score
run: |
dart pub global activate pana
sudo apt-get install webp
PANA=$(pana . --no-warning); PANA_SCORE=$(echo $PANA | sed -n "s/.*Points: \([0-9]*\)\/\([0-9]*\)./\1\/\2/p")
echo "score: $PANA_SCORE"
IFS='/'; read -a SCORE_ARR <<< "$PANA_SCORE"; SCORE=SCORE_ARR[0]; TOTAL=SCORE_ARR[1]
if [ -z "$1" ]; then MINIMUM_SCORE=TOTAL; else MINIMUM_SCORE=$1; fi
if (( $SCORE < $MINIMUM_SCORE )); then echo "minimum score $MINIMUM_SCORE was not met!"; exit 1; fi