-
Notifications
You must be signed in to change notification settings - Fork 0
230 lines (208 loc) · 10.3 KB
/
build_test_artifacts.yml
File metadata and controls
230 lines (208 loc) · 10.3 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
name: SeamLess Plugin Suite
on:
workflow_dispatch: # lets you run a build from github.com
# Runs the workflow on push events but only for the develop branch
push:
branches:
- main
- develop
# This is needed otherwise the github.ref is not set with ref/tags/v...
tags:
- "*.*.*"
# When pushing new commits, cancel any running builds on that branch
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
PROJECT_NAME: seamless-plugin-suite
PLUGINS: (SeamLess_Client SeamLess_Main)
PLUGIN_RELEASE_NAMES: ("SeamLess Client" "SeamLess Main")
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
# Use up to 4 cpus to build juceaide, etc
CMAKE_BUILD_PARALLEL_LEVEL: 4
# Name of the build directory
BUILD_DIR: build
# Needed for mozilla sccache action
SCCACHE_GHA_ENABLED: "true"
jobs:
build:
name: ${{ matrix.name }}
strategy:
fail-fast: false # show all errors for each platform (vs. cancel jobs on error)
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
include:
- os: macOS-latest
name: macOS
- os: windows-latest
name: Windows
- name: Linux
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
#A simple printout of the matrix
- name: printout
shell: bash
run: |
echo ${{ github.ref }}
PLUGINS=${{ env.PLUGINS }}
PLUGIN_RELEASE_NAMES=${{ env.PLUGIN_RELEASE_NAMES }}
# !{array[@]} gives the index of the array
for index in ${!PLUGINS[@]}; do
echo "PLUGIN=${PLUGINS[$index]}";
echo "PLUGIN_RELEASE_NAME=${PLUGIN_RELEASE_NAMES[$index]}";
echo "matrix.name=${{ matrix.name }}";
echo "matrix.os=${{ matrix.os }}";
done
# We need the osxutils to get the codesign and notorization tools
# We need to install ccache here for Windows to grab the right version
- name: install deps
shell: bash
run: |
if [ "${{ matrix.name }}" == "macOS" ]; then
brew install osxutils ninja
elif [ "${{ matrix.name }}" == "Windows" ]; then
echo "No dependencies needed for Windows"
elif [ "${{ matrix.name }}" == "Linux" ]; then
sudo apt-get update && sudo apt install libasound2-dev libx11-dev libxcomposite-dev libxcursor-dev libxext-dev libxinerama-dev libxrandr-dev libxrender-dev ninja-build libfreetype-dev libfontconfig1-dev
else
echo "Unknown OS";
fi;
# With this we checkout to our repo
- name: get repo and submodules
uses: actions/checkout@v4
# Here we get the submodules like juce
with:
submodules: true
fetch-depth: 0
# We cache the build to speed up the build process
- name: cache the build
uses: mozilla-actions/sccache-action@v0.0.9
# Typical cmake configuration with default generator
# With DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" we can build universal binaries for apple computers
- name: cmake configure
shell: bash
run: |
if [ "${{ matrix.name }}" == "macOS" ]; then
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
elif [ "${{ matrix.name }}" == "Windows" ]; then
cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
else
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
fi;
# Build the project
- name: cmake build
shell: bash
run: cmake --build build --config ${{ env.BUILD_TYPE }} --parallel ${{ env.CMAKE_BUILD_PARALLEL_LEVEL }}
# Test the project
- name: ctest
working-directory: ${{github.workspace}}/build
run: ctest --verbose
- name: define the current version
shell: bash
run: |
version=$(grep 'CMAKE_PROJECT_VERSION:STATIC' build/CMakeCache.txt | cut -d'=' -f2)
echo "VERSION_NUMBER=${version}" >> $GITHUB_ENV
echo "current version number: ${version}"
# Declaring the product name and the packaging directory
- name: declare artefact variables
shell: bash
run: |
echo "PACKAGE_DIR=artefacts/${{ env.PROJECT_NAME }}-${{ env.VERSION_NUMBER }}-${{ matrix.name }}" >> $GITHUB_ENV
echo "PRODUCT_NAME=${{ env.PROJECT_NAME }}-${{ env.VERSION_NUMBER }}-${{ matrix.name }}" >> $GITHUB_ENV
# Moving the artefacts to a packaging directory
- name: move artefacts
shell: bash
run: |
mkdir -p ${{ env.PACKAGE_DIR }}
PLUGINS=${{ env.PLUGINS }}
PLUGIN_RELEASE_NAMES=${{ env.PLUGIN_RELEASE_NAMES }}
for index in ${!PLUGINS[@]}; do
mv "${{ env.BUILD_DIR }}/${PLUGINS[$index]}/${PLUGINS[$index]}_artefacts/${{ env.BUILD_TYPE }}/VST3/${PLUGIN_RELEASE_NAMES[$index]}.vst3" ${{ env.PACKAGE_DIR }};
if [ "${{ matrix.name }}" == "macOS" ]; then
mv "${{ env.BUILD_DIR }}/${PLUGINS[$index]}/${PLUGINS[$index]}_artefacts/${{ env.BUILD_TYPE }}/AU/${PLUGIN_RELEASE_NAMES[$index]}.component" ${{ env.PACKAGE_DIR }};
mv "${{ env.BUILD_DIR }}/${PLUGINS[$index]}/${PLUGINS[$index]}_artefacts/${{ env.BUILD_TYPE }}/Standalone/${PLUGIN_RELEASE_NAMES[$index]}.app" ${{ env.PACKAGE_DIR }};
elif [ "${{ matrix.name }}" == "Windows" ]; then
mv "${{ env.BUILD_DIR }}/${PLUGINS[$index]}/${PLUGINS[$index]}_artefacts/${{ env.BUILD_TYPE }}/Standalone/${PLUGIN_RELEASE_NAMES[$index]}.exe" ${{ env.PACKAGE_DIR }};
elif [ "${{ matrix.name }}" == "Linux" ]; then
mv "${{ env.BUILD_DIR }}/${PLUGINS[$index]}/${PLUGINS[$index]}_artefacts/${{ env.BUILD_TYPE }}/Standalone/${PLUGIN_RELEASE_NAMES[$index]}" ${{ env.PACKAGE_DIR }};
else
echo "Unknown OS";
fi;
done;
# We need to import the apple developer certificate so that we can codesign our binaries
- name: import certificates (macOS)
uses: apple-actions/import-codesign-certs@v3
if: ${{ matrix.name == 'macOS' }}
with:
# GitHub encrypted secrets
p12-file-base64: ${{ secrets.DEV_ID_APP_CERT }}
p12-password: ${{ secrets.DEV_ID_APP_PWD }}
# Codesigning all the binaries
- name: codesign (macOS)
if: ${{ matrix.name == 'macOS' }}
run: |
PLUGINS=${{ env.PLUGINS }}
PLUGIN_RELEASE_NAMES=${{ env.PLUGIN_RELEASE_NAMES }}
for index in ${!PLUGINS[@]}; do
codesign --force -s "${{ secrets.DEV_ID_APP}}" -v "${{ env.PACKAGE_DIR }}/${PLUGIN_RELEASE_NAMES[$index]}.vst3" --deep --strict --options=runtime --timestamp;
codesign --force -s "${{ secrets.DEV_ID_APP}}" -v "${{ env.PACKAGE_DIR }}/${PLUGIN_RELEASE_NAMES[$index]}.component" --deep --strict --options=runtime --timestamp;
# The standalone needs to have specific entitlements, which we need to add when we codesign the files. Since we have set the entitlements in the CMakeLists.txt we can use the generated file in the location below
codesign --entitlements "${{ env.BUILD_DIR }}/${PLUGINS[$index]}/${PLUGINS[$index]}_artefacts/JuceLibraryCode/${PLUGINS[$index]}_Standalone.entitlements" --force -s "${{ secrets.DEV_ID_APP}}" -v "${{ env.PACKAGE_DIR }}/${PLUGIN_RELEASE_NAMES[$index]}.app" --deep --strict --options=runtime --timestamp;
# Here we check the code signitures
codesign -dv --verbose=4 "${{ env.PACKAGE_DIR }}/${PLUGIN_RELEASE_NAMES[$index]}.vst3";
codesign -dv --verbose=4 "${{ env.PACKAGE_DIR }}/${PLUGIN_RELEASE_NAMES[$index]}.component";
codesign -dv --verbose=4 "${{ env.PACKAGE_DIR }}/${PLUGIN_RELEASE_NAMES[$index]}.app";
done;
# Zip the artefact
- name: zip artefacts
working-directory: ${{github.workspace}}/artefacts
shell: bash
run: |
if [ "${{ matrix.name }}" == "macOS" ]; then
zip -vr ${{ env.PRODUCT_NAME }}.zip ${{ env.PRODUCT_NAME }}/ -x "*.DS_Store"
elif [ "${{ matrix.name }}" == "Windows" ]; then
tar -a -c -f ${{ env.PRODUCT_NAME }}.zip ${{ env.PRODUCT_NAME }}/
elif [ "${{ matrix.name }}" == "Linux" ]; then
zip -r ${{ env.PRODUCT_NAME }}.zip ${{ env.PRODUCT_NAME }}/
else
echo "Unknown OS";
fi;
# Let's now notarize the zip file and with it all its contents / binaries
- name: notarize (macOS)
working-directory: ${{github.workspace}}/artefacts
if: ${{ matrix.name == 'macOS' }}
run: |
# In contrast to dmg files zip files do not need to be codesigned before notarization
xcrun notarytool submit ${{ env.PRODUCT_NAME }}.zip --apple-id ${{ secrets.APPLE_DEV_ID }} --password ${{ secrets.APPLE_DEV_PWD }} --team-id ${{ secrets.TEAM_ID }} --wait
# Then we need to unzip it and staple the ticket for the gatekeeper to all binaries
unzip ${{ env.PRODUCT_NAME }}.zip && rm ${{ env.PRODUCT_NAME }}.zip
cd ${{ env.PRODUCT_NAME }}
PLUGINS=${{ env.PLUGINS }}
PLUGIN_RELEASE_NAMES=${{ env.PLUGIN_RELEASE_NAMES }}
for index in ${!PLUGINS[@]}; do
xcrun stapler staple "${PLUGIN_RELEASE_NAMES[$index]}.vst3";
xcrun stapler staple "${PLUGIN_RELEASE_NAMES[$index]}.component";
xcrun stapler staple "${PLUGIN_RELEASE_NAMES[$index]}.app";
done;
cd ..
# And finally zip it again
zip -vr ${{ env.PRODUCT_NAME }}.zip ${{ env.PRODUCT_NAME }}/ -x "*.DS_Store"
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PRODUCT_NAME }}.zip
path: artefacts/${{ env.PRODUCT_NAME }}.zip
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: build
steps:
- name: Get Artifacts
uses: actions/download-artifact@v4
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
*/*.zip