-
-
Notifications
You must be signed in to change notification settings - Fork 48
356 lines (290 loc) · 10.8 KB
/
nightly.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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Nightly
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
permissions:
contents: write
jobs:
build-resources:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: 'Install dependencies'
run: |
sudo apt-get update
sudo apt-get install gettext
mkdir out/
- name: 'Generate i18n'
run: |
# Build translations
mkdir otl/
sudo chmod +x ./gentl.sh
./gentl.sh
cp out/* otl/
- name: Make Artifact
uses: actions/upload-artifact@v3
with:
name: translations
path: otl/*
retention-days: 1
linux-zip:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: dlang-community/setup-dlang@4c99aa991ce7d19dd3064de0a4f2f6b2f152e2d7
with:
compiler: ldc-latest
- name: "Get build dependencies"
run: |
sudo apt install libsdl2-dev libfreetype6-dev gettext
- name: 'Generate i18n'
run: |
sudo chmod +x ./gentl.sh
./gentl.sh
- name: "Clone dependencies & set versions"
run: |
git clone https://github.com/Inochi2D/i2d-imgui.git --recurse-submodules
git clone https://github.com/Inochi2D/inochi2d.git
git clone https://github.com/Inochi2D/dcv-i2d
dub add-local i2d-imgui/ "0.8.0"
dub add-local inochi2d/ "0.8.0"
dub add-local dcv-i2d/ "0.3.0"
- name: 'Build Inochi Creator'
run: |
# Build metadata (like version information and icons)
dub build --config=meta
# Build the project, with its main file included, without unittests
dub build --compiler=ldc2 --config=linux-nightly --debug=InExperimental
- name: Archive Zip
uses: thedoctor0/zip-release@main
with:
type: 'zip'
filename: 'inochi-creator-linux-x86_64.zip'
directory: 'out/'
path: '*'
- name: Release to nightly tag
uses: softprops/action-gh-release@v1
with:
name: 'Nightly Build'
tag_name: nightly
files: |
out/inochi-creator-linux-x86_64.zip
generate_release_notes: true
windows:
runs-on: windows-latest
needs: build-resources
steps:
- uses: actions/checkout@v3
- uses: dlang-community/setup-dlang@4c99aa991ce7d19dd3064de0a4f2f6b2f152e2d7
with:
compiler: ldc-latest
- name: Download translations
uses: actions/download-artifact@v3
with:
name: translations
path: out/i18n/
- name: "Clone dependencies & set versions"
run: |
git clone https://github.com/Inochi2D/i2d-imgui.git --recurse-submodules
git clone https://github.com/Inochi2D/inochi2d.git
git clone https://github.com/Inochi2D/dcv-i2d
dub add-local i2d-imgui/ "0.8.0"
dub add-local inochi2d/ "0.8.0"
dub add-local dcv-i2d/ "0.3.0"
- name: 'Build Inochi Creator'
run: |
function Invoke-VSDevEnvironment {
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$installationPath = & $vswhere -prerelease -legacy -latest -property installationPath
$Command = Join-Path $installationPath "Common7\Tools\vsdevcmd.bat"
& "${env:COMSPEC}" /s /c "`"$Command`" -no_logo && set" | Foreach-Object {
if ($_ -match '^([^=]+)=(.*)') {
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2])
}
}
}
Invoke-VSDevEnvironment
Remove-Item 'C:/Strawberry' -Recurse
# Build metadata (like version information and icons)
dub build --config=meta
# Build the project, with its main file included, without unittests
dub build --compiler=ldc2 --config=win32-nightly --debug=InExperimental
- name: Archive Zip
uses: thedoctor0/zip-release@main
with:
type: 'zip'
filename: 'inochi-creator-win32-x86_64.zip'
directory: 'out/'
path: '*'
- name: 'Add msbuild to PATH'
uses: microsoft/[email protected]
- name: 'Build MSI'
run: |
cd build-aux/windows/wix
# Install required dependency
mkdir packages/
nuget install WixToolset.UI.wixext -version 4.0.0 -OutputDirectory packages/
# Build solution
msbuild "Inochi Creator.sln" -property:Configuration=Release
# Copy installer out
mv "bin/Release/Inochi Creator.msi" "../../../out/inochi-creator-win32-x86_64.msi"
cd ../../../
- name: 'Release to nightly tag'
uses: softprops/action-gh-release@v1
with:
tag_name: nightly
files: |
out/inochi-creator-win32-x86_64.msi
out/inochi-creator-win32-x86_64.zip
macOS-dmg:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- uses: LunaTheFoxgirl/setup-dlang@v1
with:
compiler: ldc-latest
- name: "Prepare for DMG packing"
continue-on-error: true
run: |
export HOMEBREW_NO_INSTALL_CLEANUP=1
brew update
brew install create-dmg gettext
- name: "Remove conflicting brew packages"
continue-on-error: true
run: |
# Remove conflicting brew items
brew remove --ignore-dependencies aom cairo composer curl fontconfig freetype gd ghostscript httpd imagemagick jpeg-xl libavif libheif libxft [email protected] mongosh node@16 openjpeg php r sox webp libpng brotli
- name: "Remove final conflicting files"
continue-on-error: true
run: |
# Delete fake harfbuzz if need be
if [ -f "/usr/local/lib/libharfbuzz.dylib" ]; then
sudo rm -r /usr/local/lib/libharfbuzz.dylib
fi
# And the .a for it as well
if [ -f "/usr/local/lib/libharfbuzz.a" ]; then
sudo rm -r /usr/local/lib/libharfbuzz.a
fi
- name: 'Generate i18n'
run: |
sudo chmod +x ./gentl.sh
./gentl.sh
- name: "Clone dependencies & set versions"
run: |
git clone https://github.com/Inochi2D/i2d-imgui.git --recurse-submodules
git clone https://github.com/Inochi2D/inochi2d.git
git clone https://github.com/Inochi2D/dcv-i2d
dub add-local i2d-imgui/ "0.8.0"
dub add-local inochi2d/ "0.8.0"
dub add-local dcv-i2d/ "0.3.0"
- name: 'Build Inochi Creator'
env:
DFLAGS: "-g -force-dwarf-frame-section=false"
run: |
# Build metadata (like version information and icons)
dub build --config=meta
# First build ARM64 version...
echo "Building arm64 binary..."
dub build --config=osx-nightly --arch=arm64-apple-macos
mv "out/Inochi Creator.app/Contents/MacOS/inochi-creator" "out/Inochi Creator.app/Contents/MacOS/inochi-creator-arm64"
# Then the X86_64 version...
echo "Building x86_64 binary..."
dub build --config=osx-nightly --arch=x86_64-apple-macos
mv "out/Inochi Creator.app/Contents/MacOS/inochi-creator" "out/Inochi Creator.app/Contents/MacOS/inochi-creator-x86_64"
# Glue them together with lipo
echo "Gluing them together..."
lipo "out/Inochi Creator.app/Contents/MacOS/inochi-creator-x86_64" "out/Inochi Creator.app/Contents/MacOS/inochi-creator-arm64" -output "out/Inochi Creator.app/Contents/MacOS/inochi-creator" -create
# Print some nice info
echo "Done!"
lipo -info "out/Inochi Creator.app/Contents/MacOS/inochi-creator"
# Cleanup and bundle
echo "Cleaning up..."
rm "out/Inochi Creator.app/Contents/MacOS/inochi-creator-x86_64" "out/Inochi Creator.app/Contents/MacOS/inochi-creator-arm64"
./build-aux/osx/osxbundle.sh
- name: 'Build DMG'
run: |
./build-aux/osx/gendmg.sh
- name: Release to nightly tag
uses: softprops/action-gh-release@v1
with:
name: 'Nightly Build'
tag_name: nightly
files: 'out/Install_Inochi_Creator.dmg'
build-flatpak:
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:freedesktop-22.08
options: --privileged
env:
MANIFEST_PATH: build-aux/flatpak/nightly/com.inochi2d.inochi-creator.yml
FLATPAK_BRANCH: nightly
FLATPAK_BUILD_DIR: build-dir
FLATPAK_BUILD_REPO: build-repo
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Dump canonical manifest
run: |
set -e
flatpak-builder --show-manifest ${MANIFEST_PATH} > canonical-manifest.json
- name: Download flatpak SDK and sources
run: |
set -e
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak-builder --default-branch=${FLATPAK_BRANCH} --install-deps-from=flathub --install-deps-only --user /dev/null ${MANIFEST_PATH}
flatpak-builder --default-branch=${FLATPAK_BRANCH} --download-only /dev/null ${MANIFEST_PATH}
- name: Prime cache
uses: actions/cache@v3
with:
path: |
.flatpak-builder/ccache
key: flatpak-builder-${{ hashFiles('canonical-manifest.json') }}
restore-keys: |
flatpak-builder-
- name: Build flatpak
run: |
set -e
flatpak-builder --default-branch=${FLATPAK_BRANCH} --ccache --repo=${FLATPAK_BUILD_REPO} ${FLATPAK_BUILD_DIR} ${MANIFEST_PATH}
- name: Upload flatpak repo
uses: actions/upload-artifact@v3
with:
name: ${{ env.FLATPAK_BUILD_REPO }}
path: |
${{ env.FLATPAK_BUILD_REPO }}
!${{ env.FLATPAK_BUILD_REPO }}/.lock
publish-flatpak-bundle:
runs-on: ubuntu-latest
needs: build-flatpak
env:
APP_ID: com.inochi2d.inochi-creator
FLATPAK_BUNDLE: inochi-creator
FLATPAK_BRANCH: nightly
FLATPAK_BUILD_REPO: build-repo
steps:
- uses: actions/checkout@v2
- name: Install flatpak
run: |
set -e
sudo apt install -y flatpak
- name: Download flatpak repo
uses: actions/download-artifact@v1
with:
name: ${{ env.FLATPAK_BUILD_REPO }}
- name: Create flatpak bundle
run: |
set -e
mkdir -p ${FLATPAK_BUILD_REPO}/{extensions,refs/{mirrors,remotes},state,tmp/cache}
flatpak build-bundle --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo ${FLATPAK_BUILD_REPO} ${FLATPAK_BUNDLE}.flatpak ${APP_ID} ${FLATPAK_BRANCH}
- name: Release to nightly tag
uses: softprops/action-gh-release@v1
with:
name: 'Nightly Build'
tag_name: nightly
files: |
${{ env.FLATPAK_BUNDLE }}.flatpak