-
-
Notifications
You must be signed in to change notification settings - Fork 75
313 lines (262 loc) · 9.32 KB
/
github-actions.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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
name: GitHub Actions
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
schedule:
- cron: "0 0 * * SUN"
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Get project Flutter version 🏷️
id: fvm-config
uses: kuhnroyal/flutter-fvm-config-action@v1.2.0
- name: Setup Flutter 💻
uses: subosito/flutter-action@v2.17.0
id: setup-flutter
with:
flutter-version: ${{ steps.fvm-config.outputs.FLUTTER_VERSION }}
cache: true
cache-key: ${{ runner.os }}-flutter-${{ steps.fvm-config.outputs.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }}
- name: Cache Pub 💾
uses: actions/cache@v4
with:
path: |
**/.dart_tool
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Run tests 🧪
run: |
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
flutter test --coverage --concurrency=12
flutter pub run remove_from_coverage -f coverage/lcov.info -r '\.g\.dart$' -r 'extensions\.dart'
- name: Upload coverage report 📡
uses: codecov/codecov-action@v5.0.6
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./coverage/lcov.info
flags: appainter
integration-test:
name: Integration test
runs-on: ${{ matrix.os }}
strategy:
matrix:
type:
- macos
- windows
- linux
# Disabled because forever hanging on GitHub Actions
# - web
include:
- type: macos
os: macos-latest
- type: windows
os: windows-latest
- type: linux
os: ubuntu-latest
# Disabled because forever hanging on GitHub Actions
# - type: web
# os: macos-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Get project Flutter version 🏷️
id: fvm-config
uses: kuhnroyal/flutter-fvm-config-action@v1.2.0
- name: Setup Flutter 💻
uses: subosito/flutter-action@v2.17.0
id: setup-flutter
with:
flutter-version: ${{ steps.fvm-config.outputs.FLUTTER_VERSION }}
cache: true
cache-key: ${{ runner.os }}-flutter-${{ steps.fvm-config.outputs.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }}
- name: Setup ChromeDriver 🚘
uses: nanasess/setup-chromedriver@v2.2.2
if: ${{ matrix.type == 'web' }}
- name: Cache Pub 💾
uses: actions/cache@v4
with:
path: |
**/.pub-cache
**/.dart_tool
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Patch for Linux build 🩹
if: ${{ matrix.type == 'linux' }}
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev
- name: Write Google service info file for MacOS 📝
if: ${{ matrix.type == 'macos' }}
run: printf "${{ secrets.GOOGLE_SERVICE_INFO_MACOS }}" > macos/Runner/GoogleService-Info.plist
- name: Run tests 🧪
shell: bash
run: |
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
flutter build ${{ matrix.type }} --no-tree-shake-icons --target=integration_test/app_test.dart
if [ "${{ matrix.type }}" == "linux" ]; then
xvfb-run flutter test integration_test -d ${{ matrix.type }}
elif [ "${{ matrix.type }}" == "web" ]; then
export DISPLAY=:99
chromedriver --port=4444 &
flutter drive \
--driver=test_driver/integration_test.dart \
--target=integration_test/app_test.dart \
-d web-server
else
flutter test integration_test -d ${{ matrix.type }}
fi
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Get project Flutter version 🏷️
id: fvm-config
uses: kuhnroyal/flutter-fvm-config-action@v1.2.0
- name: Setup Flutter 💻
uses: subosito/flutter-action@v2.17.0
with:
flutter-version: ${{ steps.fvm-config.outputs.FLUTTER_VERSION }}
cache: true
cache-key: ${{ runner.os }}-flutter-${{ steps.fvm-config.outputs.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }}
- name: Cache Pub 💾
uses: actions/cache@v4
with:
path: |
**/.dart_tool
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Run linting 🧪
run: |
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
dart format --output=none --set-exit-if-changed .
flutter analyze
build:
name: Build
runs-on: ${{ matrix.os }}
needs: [test, integration-test, lint]
if: ${{ (github.ref == 'refs/heads/main') && (contains(fromJSON('["workflow_dispatch", "schedule"]'), github.event_name)) }}
strategy:
matrix:
type: [web, macos, windows, linux]
include:
- type: web
os: ubuntu-latest
build-path: build
build-output: web
- type: macos
os: macos-latest
build-path: build/macos/Build/Products/Release
build-output: appainter.app
- type: windows
os: windows-latest
build-path: build\windows\x64\runner
build-output: Release
- type: linux
os: ubuntu-latest
build-path: build/linux/x64/release
build-output: bundle
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Get project Flutter version 🏷️
id: fvm-config
uses: kuhnroyal/flutter-fvm-config-action@v1.2.0
- name: Setup Flutter 💻
id: setup-flutter
uses: subosito/flutter-action@v2.17.0
with:
flutter-version: ${{ steps.fvm-config.outputs.FLUTTER_VERSION }}
cache: true
cache-key: ${{ runner.os }}-flutter-${{ steps.fvm-config.outputs.FLUTTER_CHANNEL }}
- name: Cache Pub 💾
uses: actions/cache@v4
with:
path: |
**/.dart_tool
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Setup Node 💻
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: yarn
- name: Patch for Linux build 🩹
if: ${{ matrix.type == 'linux' }}
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev
- name: Write Google service info file for MacOS 📝
if: ${{ matrix.type == 'macos' }}
run: printf "${{ secrets.GOOGLE_SERVICE_INFO_MACOS }}" > macos/Runner/GoogleService-Info.plist
- name: Install dependencies 📦
run: yarn
- name: Build artifacts 🏗️
shell: bash
run: npx semantic-release --extends ./build.release.config.js
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
APP_TYPE: ${{ matrix.type }}
BUILD_PATH: ${{ matrix.build-path }}
BUILD_OUTPUT: ${{ matrix.build-output }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
- name: Upload artifacts ⬆️
uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.type }}
path: "**/appainter_${{ matrix.type }}.tar.gz"
if-no-files-found: error
release:
name: Release
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Download artifacts ⬇️
id: download-artifacts
uses: actions/download-artifact@v4
- name: Decompress web artifacts 📂
env:
WEB_OUTPUT: build
run: |
mkdir -p ${{ env.WEB_OUTPUT }}
tar -zxf ${{ steps.download-artifacts.outputs.download-path }}/artifact-web/build/appainter_web.tar.gz -C ${{ env.WEB_OUTPUT }}
- name: Setup Node 💻
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: yarn
- name: Install dependencies 📦
run: yarn
- name: Release 🚀
run: npx semantic-release --extends ./publish.release.config.js
env:
GITHUB_TOKEN: ${{ secrets.PAT }}