-
Notifications
You must be signed in to change notification settings - Fork 0
197 lines (179 loc) · 6.43 KB
/
ci.yaml
File metadata and controls
197 lines (179 loc) · 6.43 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: Lint Checks
# Always run the checks on a push and a PR.
#
# 20250914 gjw Run the tests as separate jobs so we see the individual
# results. We can instead run then as a single job with multiple
# steps, but then it stops on the first fail and so not as
# informative.
on:
push:
pull_request:
types: [opened, reopened, synchronize]
env:
FLUTTER_VERSION: '3.38.3'
jobs:
analyze:
runs-on: ubuntu-latest
if: github.event.repository.private == false
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{env.FLUTTER_VERSION}}
- run: flutter pub get
- run: flutter analyze --fatal-infos
format:
runs-on: ubuntu-latest
if: github.event.repository.private == false
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{env.FLUTTER_VERSION}}
- run: flutter pub get
- run: dart format --set-exit-if-changed .
unused_code:
runs-on: ubuntu-latest
if: github.event.repository.private == false
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{env.FLUTTER_VERSION}}
- run: flutter pub get
- run: dart pub global activate dart_code_metrics
- run: metrics check-unused-code --disable-sunset-warning lib
unused_files:
runs-on: ubuntu-latest
if: github.event.repository.private == false
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{env.FLUTTER_VERSION}}
- run: flutter pub get
- run: dart pub global activate dart_code_metrics
- run: metrics check-unused-files --disable-sunset-warning lib
import_order:
runs-on: ubuntu-latest
if: github.event.repository.private == false
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{env.FLUTTER_VERSION}}
- run: flutter pub get
- run: dart pub global activate import_order_lint
- run: import_order --check
markdown:
runs-on: ubuntu-latest
if: github.event.repository.private == false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm install -g markdownlint-cli
- run: markdownlint *.md lib assets installers
link_checker:
runs-on: ubuntu-latest
if: github.event.repository.private == false
permissions:
issues: write # required for peter-evans/create-issue-from-file
steps:
- uses: actions/checkout@v4
- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v2
with: # Don't fail for now but then create an issue - useful?
args:
--exclude-file .lycheeignore
--no-progress
'*.md'
'./**/*.dart'
'assets/**/*.md'
'assets/**/*.html'
fail: true
# 20251030 gjw Remove the automatic creation of an issue for
# now. It is creating too many and I am simply closing them. The
# failure of the lint test itself should be enough.
# - name: Create Issue From File
# if: steps.lychee.outputs.exit_code != 0
# uses: peter-evans/create-issue-from-file@v5
# with:
# title: Link Checker Report
# content-filepath: ./lychee/out.md
# labels: report, automated issue
locmax:
runs-on: ubuntu-latest
if: github.event.repository.private == false
steps:
- uses: actions/checkout@v4
- run: make locmax-enforce
copyright:
runs-on: ubuntu-latest
if: github.event.repository.private == false
steps:
- uses: actions/checkout@v4
- name: Check copyright headers
run: |
# Find Dart files without proper copyright headers, excluding generated files
missing_copyright=$(find lib -type f -name '*.dart' \
! -name '*.g.dart' \
! -name '*.gr.dart' \
! -name '*.freezed.dart' \
! -name '*.chopper.dart' \
! -name '*.part.dart' \
! -name '*.config.dart' \
-exec grep -L "Copyright" {} \;)
if [ -n "$missing_copyright" ]; then
echo "❌ Files missing copyright headers:"
echo "$missing_copyright"
echo ""
echo "💡 Note: Generated files (*.g.dart, *.freezed.dart, etc.) are automatically excluded"
exit 1
else
echo "✅ All non-generated Dart files have copyright headers"
fi
# 20251017 gjw The usual command for running the integration tests
# is `flutter test interaction_test` and each `*_test.dart` is
# run. However for our testing of apps using solidui we need to
# authenticate through an external browser login. The usual `flutter
# test` will not properly authenticate. Instead, we should run `make
# qtest.all` to run the tests. This action
test_enforcement:
runs-on: ubuntu-latest
if: github.event.repository.private == false
steps:
- uses: actions/checkout@v4
- name: Check for batch test commands
run: |
# Check for disallowed "flutter test integration_test/" usage in scripts/workflows
# Exclude comments and this CI check itself
batch_test_found=$(grep -r "flutter test integration_test" \
.github/workflows/ \
support/ \
scripts/ \
Makefile 2>/dev/null | \
grep -v "# Check for disallowed" | \
grep -v "batch_test_found=" | \
grep -v "echo.*flutter test integration_test/" || true)
if [ -n "$batch_test_found" ]; then
echo "❌ Found disallowed batch test command 'flutter test integration_test/'"
echo ""
echo "Found in:"
echo "$batch_test_found"
echo ""
echo "⚠️ Batch testing fails on desktop due to Flutter framework limitations."
echo "✅ Use 'make qtest' instead - it runs tests individually."
echo ""
echo "See docs/TESTING_GUIDE.md for details."
exit 1
else
echo "✅ No batch test commands found - using recommended 'make qtest' approach"
fi