This repository has been archived by the owner on Sep 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
340 lines (284 loc) · 9.46 KB
/
weekly.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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
name: Weekly CI
env:
SOURCE_PATH: './src/kaiteki'
PATCH_VERSION: ${{ github.event.inputs.patch_version }}
on:
workflow_dispatch:
inputs:
patch_version:
description: 'Patch version'
required: false
type: string
schedule:
- cron: '0 0 * * 1'
permissions:
contents: read
pages: write
id-token: write
jobs:
test:
name: Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.SOURCE_PATH }}
outputs:
weekly-epoch: ${{steps.build-variables.outputs.WEEKLY_EPOCH}}
build-name: ${{steps.build-variables.outputs.BUILD_NAME}}
make-args: ${{steps.build-variables.outputs.MAKE_ARGS}}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'master'
cache: true
- name: Get packages
run: 'flutter pub get'
- name: Generate Localizations
run: 'flutter gen-l10n'
- name: Analyze
uses: invertase/[email protected]
with:
working-directory: ${{ env.SOURCE_PATH }}
- name: Test
run: 'flutter test --coverage -r expanded --no-pub'
- name: Provide build variables
id: build-variables
run: |
echo "WEEKLY_EPOCH=$(date +%s)" >> $GITHUB_OUTPUT
echo "BUILD_NAME=$(date +%Y-%U)${{ github.event.inputs.patch_version && format('.${0}', github.event.inputs.patch_version) || '' }}" >> $GITHUB_OUTPUT
echo "MAKE_ARGS=RELEASE=TRUE SIGNED=TRUE SPLIT_PER_ABI=TRUE WEEKLY_EPOCH=$(date +%s)" >> $GITHUB_OUTPUT
build-linux:
name: Build for Linux
runs-on: ubuntu-latest
needs: test
defaults:
run:
working-directory: ${{ env.SOURCE_PATH }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'master'
cache: true
- name: Update Linux repos
run: 'sudo apt-get update --fix-missing && sudo apt-get -y upgrade'
- name: Install Linux build requirements
run: 'sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev libhandy-1-dev'
- name: Enable Linux Desktop
run: 'flutter config --enable-linux-desktop'
- name: Get packages
run: 'flutter pub get'
- name: Generate Localizations
run: 'flutter gen-l10n'
- name: Build
run: 'make build-linux ${{needs.test.outputs.make-args}}'
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: linux
path: '${{ env.SOURCE_PATH }}/build/linux/x64/release/bundle/'
package-appimage:
name: Package (AppImage)
runs-on: ubuntu-latest
needs: build-linux
if: github.event_name != 'pull_request'
steps:
- name: Install packaging dependencies
run: 'sudo apt-get install -y python3-pip python3-setuptools patchelf desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse'
- name: Download AppImageTool
run: |
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool
chmod +x appimagetool
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: linux
path: 'kaiteki.AppDir'
- name: Prepare directory
run: |
chmod +x kaiteki.AppDir/kaiteki
wget https://raw.githubusercontent.com/Craftplacer/Kaiteki/master/assets/icons/windows/kaiteki.png -O kaiteki.AppDir/kaiteki.png
wget https://raw.githubusercontent.com/Craftplacer/Kaiteki/master/assets/icons/windows/kaiteki.png -O kaiteki.AppDir/.DirIcon
wget https://raw.githubusercontent.com/Craftplacer/Kaiteki/master/packaging/linux/kaiteki.desktop -O kaiteki.AppDir/kaiteki.desktop
wget https://raw.githubusercontent.com/Craftplacer/Kaiteki/master/packaging/linux/AppRun -O kaiteki.AppDir/AppRun
chmod +x kaiteki.AppDir/AppRun
- name: Make AppImage
run: |
./appimagetool --appimage-extract
./squashfs-root/AppRun kaiteki.AppDir/
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: appimage
path: 'Kaiteki-x86_64.AppImage'
package-flatpak:
name: Package (Flatpak)
runs-on: ubuntu-latest
needs: build-linux
if: github.event_name != 'pull_request'
container:
image: bilelmoussaoui/flatpak-github-actions:gnome-44
options: --privileged
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: linux
path: './src/kaiteki/build/linux/x64/release/bundle/'
- name: Build Flatpak
uses: flatpak/flatpak-github-actions/[email protected]
with:
bundle: moe.craftplacer.kaiteki.flatpak
manifest-path: ./packaging/linux/moe.craftplacer.kaiteki.yaml
cache-key: flatpak-builder-${{ github.sha }}
build-android:
name: Build for Android
runs-on: ubuntu-latest
needs: test
defaults:
run:
working-directory: ${{ env.SOURCE_PATH }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'master'
cache: true
- name: Get packages
run: 'flutter pub get'
- name: Generate Localizations
run: 'flutter gen-l10n'
- name: Dump signing key
uses: timheuer/[email protected]
with:
fileName: 'keystore.pfx'
fileDir: '${{ env.SOURCE_PATH }}/android/app/'
encodedString: ${{ secrets.ANDROID_KEYSTORE }}
- name: Build (signed)
run: 'make build-android ${{needs.test.outputs.make-args}}'
env:
KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: android
path: '${{ env.SOURCE_PATH }}/build/app/outputs/flutter-apk/app-*.apk'
build-windows:
name: Build for Windows
runs-on: windows-latest
needs: test
defaults:
run:
working-directory: ${{ env.SOURCE_PATH }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'master'
cache: true
- name: Enable Windows Desktop
run: 'flutter config --enable-windows-desktop'
- name: Get packages
run: 'flutter pub get'
- name: Generate Localizations
run: 'flutter gen-l10n'
- name: Build
run: 'make build-windows ${{needs.test.outputs.make-args}}'
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: windows
path: '${{ env.SOURCE_PATH }}/build/windows/x64/runner/Release/'
build-web:
name: Build for Web
runs-on: ubuntu-latest
needs: test
defaults:
run:
working-directory: ${{ env.SOURCE_PATH }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'master'
cache: true
- name: Enable web
run: flutter config --enable-web
- name: Get packages
run: 'flutter pub get'
- name: Generate Localizations
run: 'flutter gen-l10n'
- name: Build
run: 'make build-web ${{needs.test.outputs.make-args}}'
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: web
path: '${{ env.SOURCE_PATH }}/build/web/*'
deploy-web:
name: Deploy for Web
runs-on: ubuntu-latest
needs: build-web
if: github.event_name != 'pull_request'
concurrency:
group: "pages"
cancel-in-progress: true
steps:
- name: Download web artifact
uses: actions/download-artifact@v3
with:
name: web
path: ./web-publish
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: './web-publish'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
deploy:
name: Deploy
runs-on: ubuntu-latest
permissions: write-all
needs: [ "test", "package-appimage", "package-flatpak", "build-android", "build-windows" ]
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
- name: Zip multi-file artifacts
run: |
zip -r windows.zip windows
zip -r linux.zip linux
- name: Create release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: weekly-${{needs.test.outputs.build-name}}
title: Weekly ${{needs.test.outputs.build-name}}
prerelease: true
files: |
android/*.apk
appimage/*.AppImage
linux.zip
windows.zip
moe.craftplacer.kaiteki-*/*.flatpak