-
Notifications
You must be signed in to change notification settings - Fork 5
208 lines (160 loc) · 4.95 KB
/
ci.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
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
198
199
200
201
202
203
204
205
206
207
208
name: CI
on:
pull_request:
push:
branches-ignore:
- l10n-main
workflow_dispatch:
permissions:
pull-requests: write
jobs:
get-flutter-version:
runs-on: ubuntu-latest
outputs:
flutter-version: ${{ steps.get-flutter-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Get Flutter version from .fvmrc
id: get-flutter-version
run: >
echo version=$(grep flutter .fvmrc | cut -d ":" -f2|cut -d "\"" -f2)
>> $GITHUB_OUTPUT
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Dart
uses: dart-lang/setup-dart@v1
- name: Format
run: >
dart format
$(find . -name '*.dart' -not -name '*.g.dart' -and -not -name '*.freezed.dart')
- name: Suggest changes
if: github.event_name == 'pull_request'
uses: reviewdog/action-suggester@v1
with:
fail_on_error: true
- name: Check diff
if: github.event_name != 'pull_request'
run: git diff --exit-code
analyze:
runs-on: ubuntu-latest
needs: get-flutter-version
steps:
- uses: actions/checkout@v4
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{ needs.get-flutter-version.outputs.flutter-version }}
cache: true
- name: Get dependencies
run: flutter pub get
- name: Analyze
uses: invertase/github-action-dart-analyzer@v3
with:
fatal-infos: true
custom-lint: true
test:
runs-on: ubuntu-latest
needs: get-flutter-version
steps:
- uses: actions/checkout@v4
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{ needs.get-flutter-version.outputs.flutter-version }}
cache: true
- name: Get dependencies
run: flutter pub get
- name: Test
run: flutter test
integration-test-ios:
runs-on: macos-14
needs: get-flutter-version
steps:
- uses: actions/checkout@v4
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{ needs.get-flutter-version.outputs.flutter-version }}
cache: true
- name: Get dependencies
run: flutter pub get
- name: Start simulator
uses: futureware-tech/simulator-action@v3
with:
model: 'iPhone 14'
- name: Pre-build the app
uses: nick-fields/retry@v3
with:
timeout_minutes: 30
max_attempts: 5
command: >
flutter build ios --simulator
--target=integration_test/timeline_test.dart
- name: Integration test
uses: nick-fields/retry@v3
with:
timeout_minutes: 30
max_attempts: 3
command: flutter test integration_test
check-i18n-sorting:
runs-on: ubuntu-latest
needs: get-flutter-version
steps:
- uses: actions/checkout@v4
- name: Get changed i18n files
id: changed-i18n-files
uses: tj-actions/changed-files@v44
with:
files: lib/i18n/aria/*.i18n.yaml
- name: Install Flutter
if: steps.changed-i18n-files.outputs.any_changed == 'true'
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{ needs.get-flutter-version.outputs.flutter-version }}
cache: true
- name: Get dependencies
if: steps.changed-i18n-files.outputs.any_changed == 'true'
run: flutter pub get
- name: Sort i18n files
if: steps.changed-i18n-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-i18n-files.outputs.all_changed_files }}
run: |
for file in $ALL_CHANGED_FILES; do
dart run script/sort_yaml.dart $file
done
- name: Suggest changes
if: github.event_name == 'pull_request'
uses: reviewdog/action-suggester@v1
with:
fail_on_error: true
- name: Check diff
if: github.event_name != 'pull_request'
run: git diff --exit-code
check-build-diff:
runs-on: ubuntu-latest
needs: get-flutter-version
steps:
- uses: actions/checkout@v4
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{ needs.get-flutter-version.outputs.flutter-version }}
cache: true
- name: Run build_runner
run: dart run build_runner build -d
- name: Suggest changes
if: github.event_name == 'pull_request'
uses: reviewdog/action-suggester@v1
with:
fail_on_error: true
- name: Check diff
if: github.event_name != 'pull_request'
run: git diff --exit-code