-
-
Notifications
You must be signed in to change notification settings - Fork 5
343 lines (318 loc) · 12 KB
/
main.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
name: Plugin Build
on:
push:
paths-ignore:
- '**.md'
branches:
- '*'
tags:
- '*'
pull_request:
paths-ignore:
- '**.md'
branches:
- main
env:
artifactName: ${{ contains(github.ref_name, '/') && 'artifact' || github.ref_name }}
qt: false
jobs:
linux_build:
runs-on: ${{ matrix.ubuntu }}
strategy:
fail-fast: false
matrix:
obs: [28]
ubuntu: ['ubuntu-22.04']
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Download obs-studio development environment
id: obsdeps
uses: norihiro/obs-studio-devel-action@v1-beta
with:
obs: ${{ matrix.obs }}
verbose: true
qt: ${{ env.qt }}
- name: Build plugin
run: |
set -ex
sudo apt install libvncserver-dev
OBS_QT_VERSION_MAJOR=${{ steps.obsdeps.outputs.OBS_QT_VERSION_MAJOR }}
mkdir build
cd build
case ${{ matrix.obs }} in
28)
cmake_opt=(
-D CPACK_DEBIAN_PACKAGE_DEPENDS='obs-studio (>= 28)'
)
;;
esac
cmake .. \
-D QT_VERSION=$OBS_QT_VERSION_MAJOR \
-D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D LINUX_PORTABLE=OFF \
-D CPACK_DEBIAN_PACKAGE_SHLIBDEPS=ON \
-D PKG_SUFFIX=-obs${{ matrix.obs }}-${{ matrix.ubuntu }}-x86_64 \
"${cmake_opt[@]}"
make -j4
make package
echo "FILE_NAME=$(find $PWD -name '*.deb' | head -n 1)" >> $GITHUB_ENV
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifactName }}
path: '${{ env.FILE_NAME }}'
- name: Check package
run: |
. ci/ci_includes.generated.sh
set -ex
sudo apt install '${{ env.FILE_NAME }}'
case ${{ matrix.obs }} in
28) plugins_dir=/usr/lib/x86_64-linux-gnu/obs-plugins ;;
esac
ldd $plugins_dir/${PLUGIN_NAME}.so > ldd.out
if grep not.found ldd.out ; then
echo "Error: unresolved shared object." >&2
exit 1
fi
ls /usr/share/obs/obs-plugins/${PLUGIN_NAME}/
macos_build:
runs-on: macos-12
strategy:
fail-fast: false
matrix:
include:
- obs: 28
arch: x86_64
- obs: 28
arch: arm64
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Environment
id: setup
run: |
set -e
echo '::group::Set up code signing'
if [[ '${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}' != '' && \
'${{ secrets.MACOS_SIGNING_INSTALLER_IDENTITY }}' != '' && \
'${{ secrets.MACOS_SIGNING_CERT }}' != '' ]]; then
echo "haveCodesignIdent=true" >> $GITHUB_OUTPUT
else
echo "haveCodesignIdent=false" >> $GITHUB_OUTPUT
fi
if [[ '${{ secrets.MACOS_NOTARIZATION_USERNAME }}' != '' && \
'${{ secrets.MACOS_NOTARIZATION_PASSWORD }}' != '' ]]; then
echo "haveNotarizationUser=true" >> $GITHUB_OUTPUT
else
echo "haveNotarizationUser=false" >> $GITHUB_OUTPUT
fi
echo '::endgroup::'
- name: Install Apple Developer Certificate
if: ${{ github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' }}
uses: apple-actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071
with:
keychain-password: ${{ github.run_id }}
p12-file-base64: ${{ secrets.MACOS_SIGNING_CERT }}
p12-password: ${{ secrets.MACOS_SIGNING_CERT_PASSWORD }}
- name: Set Signing Identity
if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' }}
run: |
set -e
TEAM_ID=$(echo "${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}" | sed 's/.*(\([A-Za-z0-9]*\))$/\1/')
xcrun notarytool store-credentials AC_PASSWORD \
--apple-id "${{ secrets.MACOS_NOTARIZATION_USERNAME }}" \
--team-id "$TEAM_ID" \
--password "${{ secrets.MACOS_NOTARIZATION_PASSWORD }}"
- name: Download obs-studio development environment
id: obsdeps
uses: norihiro/obs-studio-devel-action@v1-beta
with:
path: /tmp/deps-${{ matrix.obs }}-${{ matrix.arch }}
arch: ${{ matrix.arch }}
obs: ${{ matrix.obs }}
verbose: true
qt: ${{ env.qt }}
- name: Install libvncserver
run: |
export arch=${{ matrix.arch }}
ci/macos/install-libvncserver-${{ matrix.arch }}.sh
- name: Build plugin
run: |
arch=${{ matrix.arch }}
deps=/tmp/deps-${{ matrix.obs }}-${{ matrix.arch }}
MACOSX_DEPLOYMENT_TARGET=${{ steps.obsdeps.outputs.MACOSX_DEPLOYMENT_TARGET }}
OBS_QT_VERSION_MAJOR=${{ steps.obsdeps.outputs.OBS_QT_VERSION_MAJOR }}
GIT_TAG=$(git describe --tags --always)
PKG_SUFFIX=-${GIT_TAG}-obs${{ matrix.obs }}-macos-${{ matrix.arch }}
if test "$arch" = 'arm64'; then
export PKG_CONFIG_PATH="/opt/homebrew/lib/pkgconfig:$PKG_CONFIG_PATH"
fi
set -e
case "${{ matrix.obs }}" in
28)
cmake_opt=(
-D MACOSX_PLUGIN_BUNDLE_TYPE=BNDL
)
;;
esac
cmake -S . -B build -G Ninja \
-D QT_VERSION=$OBS_QT_VERSION_MAJOR \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH="$PWD/release/" \
-DCMAKE_OSX_ARCHITECTURES=${arch/#universal/x86_64;arm64} \
-DCMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} \
-DCMAKE_FRAMEWORK_PATH="$deps/Frameworks;$deps/lib/cmake;$deps" \
-D PKG_SUFFIX=$PKG_SUFFIX \
"${cmake_opt[@]}"
cmake --build build --config RelWithDebInfo
echo "PKG_SUFFIX='$PKG_SUFFIX'" >> ci/ci_includes.generated.sh
- name: Prepare package
run: |
set -ex
. ci/ci_includes.generated.sh
cmake --install build --config RelWithDebInfo --prefix=release
case ${{ matrix.obs }} in
28)
(cd release/${PLUGIN_NAME}.plugin/Contents && ../../../ci/macos/change-rpath.sh \
-obs 28 \
-lib lib/ \
-license Resources/ \
MacOS/${PLUGIN_NAME}
)
cp LICENSE release/${PLUGIN_NAME}.plugin/Contents/Resources/$PLUGIN_NAME-LICENSE
ci/macos/test-dylib.sh -28 release/${PLUGIN_NAME}.plugin/Contents/MacOS/${PLUGIN_NAME}
;;
esac
- name: Codesign
if: ${{ github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' }}
run: |
. ci/ci_includes.generated.sh
set -e
case ${{ matrix.obs }} in
28)
files=(
$(find release/${PLUGIN_NAME}.plugin/ -name '*.dylib')
release/${PLUGIN_NAME}.plugin/Contents/MacOS/${PLUGIN_NAME}
)
;;
esac
for dylib in "${files[@]}"; do
codesign --force --sign "${{ secrets.MACOS_SIGNING_APPLICATION_IDENTITY }}" "$dylib"
done
for dylib in "${files[@]}"; do
codesign -vvv --deep --strict "$dylib"
done
- name: Package
run: |
. ci/ci_includes.generated.sh
set -ex
zipfile=$PWD/package/${PLUGIN_NAME}${PKG_SUFFIX}.zip
mkdir package
case ${{ matrix.obs }} in
28) (cd release/ && zip -r $zipfile ${PLUGIN_NAME}.plugin) ;;
esac
ci/macos/install-packagesbuild.sh
packagesbuild \
--build-folder $PWD/package/ \
build/installer-macOS.generated.pkgproj
- name: Productsign
if: ${{ github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' }}
run: |
. ci/ci_includes.generated.sh
pkgfile=package/${PLUGIN_NAME}${PKG_SUFFIX}.pkg
set -e
productsign --sign "${{ secrets.MACOS_SIGNING_INSTALLER_IDENTITY }}" $pkgfile package/${PLUGIN_NAME}-signed.pkg
mv package/${PLUGIN_NAME}-signed.pkg $pkgfile
- name: Notarize
if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' && steps.setup.outputs.haveCodesignIdent == 'true' }}
uses: norihiro/macos-notarize-action@v1
with:
path: package/*
keychainProfile: AC_PASSWORD
verbose: true
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifactName }}
path: package/*
windows_build:
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
obs: [28]
arch: [x64]
env:
visualStudio: 'Visual Studio 17 2022'
Configuration: 'RelWithDebInfo'
LIBVNCPath: ${{ github.workspace }}\libvncserver
OBSDeps: ${{ github.workspace }}\obs-build-dependencies\plugin-deps-x64
defaults:
run:
shell: pwsh
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Download obs-studio
id: obsdeps
uses: norihiro/obs-studio-devel-action@v1-beta
with:
obs: ${{ matrix.obs }}
qt: ${{ env.qt }}
- name: Restore libvncserver cache
id: libvncserver-cache
uses: actions/cache/restore@v3
with:
path: ${{ env.LIBVNCPath }}
key: libvncserver-${{ hashFiles('ci/windows/install-libvncserver.sh') }}
- name: Build libvncserver
if: steps.libvncserver-cache.outputs.cache-hit != 'true'
shell: bash
run: ci/windows/install-libvncserver.sh
env:
CMakeOptA: x64
build_config: RelWithDebInfo
- name: Cache libvncserver
if: steps.libvncserver-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: ${{ env.LIBVNCPath }}
key: libvncserver-${{ hashFiles('ci/windows/install-libvncserver.sh') }}
- name: Build plugin
run: |
$CmakeArgs = @(
'-G', "${{ env.visualStudio }}"
'-DQT_VERSION=${{ steps.obsdeps.outputs.OBS_QT_VERSION_MAJOR }}'
'-DCMAKE_SYSTEM_VERSION=10.0.18363.657'
"-DCMAKE_INSTALL_PREFIX=$(Resolve-Path -Path "./obs-build-dependencies/plugin-deps-${{ matrix.arch }}")"
"-DCMAKE_PREFIX_PATH=$(Resolve-Path -Path "./obs-build-dependencies/plugin-deps-${{ matrix.arch }}")"
"-D USE_PKG_CONFIG=OFF"
"-DLIBVNCCLIENT_INCLUDE_DIRS=${{ env.LIBVNCPath }}"
"-DLIBVNCCLIENT_STATIC_LIBRARY_DIRS=${{ env.LIBVNCPath }}"
"-DLIBVNCCLIENT_STATIC_LIBRARIES=${{ env.LIBVNCPath }}\RelWithDebInfo\vncclient.lib;${{ env.OBSDeps }}\lib\zlib.lib;${{ env.LIBVNCPath }}\deps\lzo\build\RelWithDebInfo\lzo2.lib;${{ env.LIBVNCPath }}\deps\libpng\RelWithDebInfo\libpng16_static.lib;${{ env.LIBVNCPath }}\deps\libjpeg\RelWithDebInfo\turbojpeg-static.lib;wsock32.lib;ws2_32.lib"
)
cmake -S . -B build @CmakeArgs
cmake --build build --config RelWithDebInfo -j 4
cmake --install build --config RelWithDebInfo --prefix "$(Resolve-Path -Path .)/release"
- name: Package plugin
shell: bash
run: ci/windows/package-windows.sh ${{ matrix.obs }}
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifactName }}
path: package/*