-
Notifications
You must be signed in to change notification settings - Fork 0
462 lines (392 loc) · 16.6 KB
/
ci-snapshot.yml
File metadata and controls
462 lines (392 loc) · 16.6 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
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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
#===========================================================================================
# This workflow will build the project for Windows, macOS, and Linux.
# It will also build an Arch Linux and Fedora package using Docker containers.
# The artifacts will be uploaded to the release page.
#
# TODO:
# - Add a step after release to update the AUR repository
#===========================================================================================
name: Build Snapshot
on:
workflow_dispatch:
pull_request:
push:
defaults:
run:
shell: bash
#===========================================================================================
# Environment Variables
env:
PROJECT_NAME: Disflux
BUNDLE_NAME: disflux
BUNDLE_ID: com.dimethoxy.disflux
VERSION: 1.1.2 # Disflux-Version
BUILD_DIR: build
DISPLAY: :0 # Linux pluginval needs this
HOMEBREW_NO_INSTALL_CLEANUP: 1
IPP_DIR: C:\Program Files (x86)\Intel\oneAPI\ipp\latest\lib\cmake\ipp
#===========================================================================================
# Build Jobs
#===========================================================================================
jobs:
#=========================================================================================
# Windows Build
#=========================================================================================
build-windows:
runs-on: windows-latest
steps:
- name: Export Variables
run: |
echo "BUILD_ARTIFACTS_DIR=$BUILD_DIR/src/${{env.PROJECT_NAME}}Plugin_artefacts/Release" >> $GITHUB_ENV
echo "WINDOWS-PACKAGE=${{env.BUNDLE_NAME}}-snapshot-windows.exe" >> $GITHUB_ENV
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup MSVC
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64
spectre: true
- name: Set Up Windows
run: |
choco install ninja
choco install innosetup
- name: Cache IPP (Windows)
id: cache-ipp
uses: actions/cache@v4
with:
key: ipp-v6
path: C:\Program Files (x86)\Intel
- name: Install IPP (Windows)
if: steps.cache-ipp.outputs.cache-hit != 'true'
run: |
curl --output oneapi.exe https://registrationcenter-download.intel.com/akdlm/IRC_NAS/2e89fab4-e1c7-4f14-a1ef-6cddba8c5fa7/intel-ipp-2022.0.0.796_offline.exe
./oneapi.exe -s -x -f oneapi
./oneapi/bootstrapper.exe -s -c --action install --components=intel.oneapi.win.ipp.devel --eula=accept -p=NEED_VS2022_INTEGRATION=1 --log-dir=.
- name: Save IPP cache
if: steps.cache-ipp.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: C:\Program Files (x86)\Intel
key: ipp-v6
- name: Select CMake Preset
run: |
cmake --preset "Windows Release"
- name: Build
run: cmake --build build --config "Release"
- name: Copy Build Artifacts
run: |
mkdir -p artifacts
cp -r ${{env.BUILD_ARTIFACTS_DIR}}/VST3/${{env.PROJECT_NAME}}.vst3 \
artifacts/
cp -r ${{env.BUILD_ARTIFACTS_DIR}}/CLAP/${{env.PROJECT_NAME}}.clap \
artifacts/
shell: bash
- name: Create Installer
run: |
# Create the packaging directory
mkdir -p packaging
# Create the Inno Setup
envsubst < pkg/windows/Setup.iss > packaging/Setup.iss
iscc packaging/Setup.iss
# Move the installer to the artifacts directory
mv packaging/Output/"${{env.PROJECT_NAME}}_Setup.exe" artifacts/${{env.WINDOWS-PACKAGE}}
shell: bash
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-windows
path: artifacts
#=========================================================================================
# macOS Build
#=========================================================================================
build-macos:
runs-on: macos-latest
steps:
- name: Export Variables
run: |
echo "BUILD_ARTIFACTS_DIR=$BUILD_DIR/src/${{env.PROJECT_NAME}}Plugin_artefacts/Release" >> $GITHUB_ENV
echo "MAC_PACKAGE=${{env.BUNDLE_NAME}}-snapshot-macos.pkg" >> $GITHUB_ENV
- name: Checkout Code
uses: actions/checkout@v4
- name: Set Up Mac
run: brew install ninja osxutils
- name: Select CMake Preset
run: |
cmake --preset "Mac Release" \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
- name: Build
run: cmake --build build --config "Release"
- name: Copy Build Artifacts
run: |
mkdir -p artifacts
cp -r ${{env.BUILD_ARTIFACTS_DIR}}/VST3/${{env.PROJECT_NAME}}.vst3 \
artifacts/
cp -r ${{env.BUILD_ARTIFACTS_DIR}}/CLAP/${{env.PROJECT_NAME}}.clap \
artifacts/
cp -r ${{env.BUILD_ARTIFACTS_DIR}}/AU/${{env.PROJECT_NAME}}.component \
artifacts/
shell: bash
- name: Import Certificates
uses: sudara/basic-macos-keychain-action@v1
id: keychain
with:
dev-id-app-cert: ${{ secrets.DEV_ID_APP_CERT }}
dev-id-app-password: ${{ secrets.DEV_ID_PASSWORD }}
dev-id-installer-cert: ${{ secrets.DEV_ID_INSTALL_CERT }}
dev-id-installer-password: ${{ secrets.DEV_ID_PASSWORD }}
- name: Codesign (macOS)
run: |
# Set variables
VST3_BIN="artifacts/${{env.PROJECT_NAME}}.vst3/Contents/MacOS/${{env.PROJECT_NAME}}"
CLAP_BIN="artifacts/${{env.PROJECT_NAME}}.clap/Contents/MacOS/${{env.PROJECT_NAME}}"
AU_BIN="artifacts/${{env.PROJECT_NAME}}.component/Contents/MacOS/${{env.PROJECT_NAME}}"
# Codesign the binaries
codesign \
--force -s "${{secrets.DEVELOPER_ID_APPLICATION}}" \
-v "$VST3_BIN" \
--deep --strict --options=runtime --timestamp
codesign \
--force -s "${{secrets.DEVELOPER_ID_APPLICATION}}" \
-v "$CLAP_BIN" \
--deep --strict --options=runtime --timestamp
codesign \
--force -s "${{secrets.DEVELOPER_ID_APPLICATION}}" \
-v "$AU_BIN" \
--deep --strict --options=runtime --timestamp
shell: bash
- name: Create Installer
run: |
# Set variables
VST3_PATH="artifacts/${{env.PROJECT_NAME}}.vst3"
CLAP_PATH="artifacts/${{env.PROJECT_NAME}}.clap"
AU_PATH="artifacts/${{env.PROJECT_NAME}}.component"
PACKAGE_NAME="${{env.PROJECT_NAME}}-snapshot-macos.pkg"
# Create the packaging directory
mkdir -p packaging
# Create the distribution file
envsubst < pkg/mac/distribution.xml > packaging/distribution.xml
# Create the VST subpackage
pkgbuild \
--identifier "${{env.BUNDLE_ID}}.vst3.pkg" \
--version "$VERSION" \
--component "$VST3_PATH" \
--install-location "/Library/Audio/Plug-Ins/VST3" \
"packaging/${{env.PROJECT_NAME}}.vst3.pkg"
# Create the CLAP subpackage
pkgbuild \
--identifier "${{env.BUNDLE_ID}}.clap.pkg" \
--version "$VERSION" \
--component "$CLAP_PATH" \
--install-location "/Library/Audio/Plug-Ins/CLAP" \
"packaging/${{env.PROJECT_NAME}}.clap.pkg"
# Create the AU subpackage
pkgbuild \
--identifier "${{env.BUNDLE_ID}}.au.pkg" \
--version "$VERSION" \
--component "$AU_PATH" \
--install-location "/Library/Audio/Plug-Ins/Components" \
"packaging/${{env.PROJECT_NAME}}.au.pkg"
# Create the main package
cd packaging
productbuild \
--resources ./resources \
--distribution distribution.xml \
--sign "${{secrets.DEVELOPER_ID_INSTALLER}}" \
--timestamp "${{env.PROJECT_NAME}}.pkg"
# Notarize the package
xcrun notarytool submit "${{env.PROJECT_NAME}}.pkg" \
--apple-id ${{secrets.NOTARIZATION_USERNAME}} \
--password ${{secrets.NOTARIZATION_PASSWORD}} \
--team-id ${{secrets.TEAM_ID}} \
--wait
# Staple the package
xcrun stapler staple "${{env.PROJECT_NAME}}.pkg"
# Move the package to the artifacts directory
mv ${{env.PROJECT_NAME}}.pkg ../artifacts/${{env.MAC_PACKAGE}}
shell: bash
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-macos
path: artifacts
#=========================================================================================
# Ubuntu Linux Build
#=========================================================================================
build-ubuntu:
runs-on: ubuntu-latest
steps:
- name: Export Variables
run: |
echo "BUILD_ARTIFACTS_DIR=$BUILD_DIR/src/${{env.PROJECT_NAME}}Plugin_artefacts/Release" >> $GITHUB_ENV
echo "UBUNTU_PACKAGE=${{env.BUNDLE_NAME}}-snapshot-linux-ubuntu.deb" >> $GITHUB_ENV
echo "LINUX_PACKAGE=${{env.BUNDLE_NAME}}-snapshot-linux-vanilla.zip" >> $GITHUB_ENV
- name: Checkout Code
uses: actions/checkout@v4
- name: Set Up Linux
run: |
sudo apt-get update
sudo apt-get install ninja-build
sudo apt install libasound2-dev \
libjack-jackd2-dev \
ladspa-sdk \
libcurl4-openssl-dev \
libfreetype-dev \
libfontconfig1-dev \
libx11-dev \
libxcomposite-dev \
libxcursor-dev \
libxext-dev \
libxinerama-dev \
libxrandr-dev \
libxrender-dev \
libwebkit2gtk-4.1-dev \
libglu1-mesa-dev mesa-common-dev
sudo apt install curl
sudo apt-get install -y dpkg-dev devscripts
sudo /usr/bin/Xvfb $DISPLAY &
shell: bash
- name: Select CMake Preset
run: |
cmake --preset "Linux Release"
- name: Build
run: cmake --build build --config "Release"
- name: Copy Artifacts
run: |
mkdir -p artifacts
cp -r ${{env.BUILD_ARTIFACTS_DIR}}/VST3/${{env.PROJECT_NAME}}.vst3 \
artifacts/
cp -r ${{env.BUILD_ARTIFACTS_DIR}}/CLAP/${{env.PROJECT_NAME}}.clap \
artifacts/
cp -r ${{env.BUILD_ARTIFACTS_DIR}}/LV2/${{env.PROJECT_NAME}}.lv2 \
artifacts/
shell: bash
- name: Package Linux Artifacts
run: |
# Set variables
UBUNTU_PACKAGE_DIR="${{env.BUNDLE_NAME}}-snapshot-linux-ubuntu"
UBUNTU_CONTROL_FILE="pkg/ubuntu/control"
VST3_INSTALL_DIR="/usr/lib/vst3/${{env.PROJECT_NAME}}"
CLAP_INSTALL_DIR="/usr/lib/clap/${{env.PROJECT_NAME}}"
LV2_INSTALL_DIR="/usr/lib/lv2/${{env.PROJECT_NAME}}"
# Create Vanilla package directory
mkdir -p vanilla
cp -r artifacts/${{env.PROJECT_NAME}}.vst3 vanilla/
cp -r artifacts/${{env.PROJECT_NAME}}.clap vanilla/
cp -r artifacts/${{env.PROJECT_NAME}}.lv2 vanilla/
# Zip and move the package to the artifacts directory
zip -r ${{env.LINUX_PACKAGE}} vanilla/*
mv ${{env.LINUX_PACKAGE}} artifacts/$LINUX_PACKAGE
# Create Debian package directory
mkdir -p $UBUNTU_PACKAGE_DIR/DEBIAN
mkdir -p $UBUNTU_PACKAGE_DIR/$VST3_INSTALL_DIR
mkdir -p $UBUNTU_PACKAGE_DIR/$CLAP_INSTALL_DIR
mkdir -p $UBUNTU_PACKAGE_DIR/$LV2_INSTALL_DIR
# Copy files to Debian package directory
cp -r artifacts/${{env.PROJECT_NAME}}.vst3 \
$UBUNTU_PACKAGE_DIR/$VST3_INSTALL_DIR/
cp -r artifacts/${{env.PROJECT_NAME}}.clap \
$UBUNTU_PACKAGE_DIR/$CLAP_INSTALL_DIR/
cp -r artifacts/${{env.PROJECT_NAME}}.lv2 \
$UBUNTU_PACKAGE_DIR/$LV2_INSTALL_DIR/
# Set PACKAGE_NAME for envsubst
export PACKAGE_NAME=${{env.BUNDLE_NAME}}-snapshot
export PACKAGE_VERSION=${{env.VERSION}}
# Replace PACKAGE_NAME in control file and copy to Debian package directory
envsubst < $UBUNTU_CONTROL_FILE > $UBUNTU_PACKAGE_DIR/DEBIAN/control
# Build Debian package
dpkg-deb --build $UBUNTU_PACKAGE_DIR
# Move the package to the artifacts directory
cp -r *.deb artifacts/${{env.UBUNTU_PACKAGE}}
shell: bash
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-ubuntu
path: artifacts
#=========================================================================================
# Arch Linux Build
#=========================================================================================
build-archlinux:
runs-on: ubuntu-latest
container:
image: archlinux:latest
steps:
- name: Export Variables
run: |
echo "BUILD_ARTIFACTS_DIR=$BUILD_DIR/src/${{env.PROJECT_NAME}}Plugin_artefacts/Release" >> $GITHUB_ENV
echo "PACKAGE_NAME=${{env.BUNDLE_NAME}}-snapshot-linux-arch.pkg.tar.zst" >> $GITHUB_ENV
- name: Install Base Packages
run: |
pacman -Sy --noconfirm base-devel git
- name: Checkout Repository
uses: actions/checkout@v4
- name: Create user for build process
run: |
useradd -m dimethoxy
sudo su - dimethoxy
- name: Set permissions for the build directory
run: |
sudo chown -R dimethoxy:dimethoxy /__w/${{env.PROJECT_NAME}}/${{env.PROJECT_NAME}}/pkg/arch/git
sudo chmod -R u+rw /__w/${{env.PROJECT_NAME}}/${{env.PROJECT_NAME}}/pkg/arch/git
- name: Disable sudo password prompt
run: |
echo 'dimethoxy ALL=(ALL) NOPASSWD: ALL' | sudo tee -a /etc/sudoers
- name: Build Package
run: |
sudo -u dimethoxy bash -c 'cd pkg/arch/git && makepkg -s --noconfirm'
- name: Package Artifacts
run: |
# Remove the default package
rm pkg/arch/git/*debug*.pkg.tar.zst
# Move the package to the root directory
mv pkg/arch/git/*.pkg.tar.zst .
# Rename the package
mv *.pkg.tar.zst ${{env.PACKAGE_NAME}}
# Move the package to the artifacts directory
mkdir -p artifacts
mv ${{env.PACKAGE_NAME}} artifacts/
shell: bash
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-archlinux
path: artifacts
#=========================================================================================
# Release the project
#=========================================================================================
release:
runs-on: ubuntu-latest
needs: [build-windows, build-ubuntu, build-macos, build-archlinux]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Get Artifacts
uses: actions/download-artifact@v4
- name: Package Artifacts
run: |
mv artifacts-windows/*.exe .
mv artifacts-macos/*.pkg .
mv artifacts-ubuntu/*.deb .
mv artifacts-ubuntu/*.zip .
mv artifacts-archlinux/*.pkg.tar.zst .
shell: bash
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: "Snapshot"
prerelease: true
body: |
### ⚠️ WARNING: Unstable Release ⚠️
This is a **unstable** snapshot intended solely for testing purposes.
It may contain bugs, incomplete features, or cause instability.
**Not recommended** for production or general use—proceed with caution.
- name: Upload Artifacts
run: |
ls -la
gh release upload "Snapshot" ${{env.BUNDLE_NAME}}-snapshot-windows.exe --clobber
gh release upload "Snapshot" ${{env.BUNDLE_NAME}}-snapshot-linux-arch.pkg.tar.zst --clobber
gh release upload "Snapshot" ${{env.BUNDLE_NAME}}-snapshot-linux-ubuntu.deb --clobber
gh release upload "Snapshot" ${{env.BUNDLE_NAME}}-snapshot-linux-vanilla.zip --clobber
gh release upload "Snapshot" ${{env.BUNDLE_NAME}}-snapshot-macos.pkg --clobber