-
Notifications
You must be signed in to change notification settings - Fork 3
268 lines (246 loc) · 10.5 KB
/
build-qt6-macos.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
name: build-qt6-macos
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
jobs:
macOS:
strategy:
fail-fast: false
matrix:
cfg:
#- { os: macos-10.15, xcode_version: '11.3', build: 'qmake', dist: false }
- { os: macos-12, xcode_version: '14.2.0', build: 'cmake', dist: true}
name: ${{matrix.cfg.os}} ${{matrix.cfg.build}}
runs-on: ${{matrix.cfg.os}}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Select XCode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{matrix.cfg.xcode_version}}
#- uses: actions/setup-python@v3
# with:
# python-version: '3.9'
# cache: 'pip'
- run: mkdir $RUNNER_WORKSPACE/dev/
- name: Install dependencies for project
run: |
brew install icu4c
brew install libxml2
brew install glib
brew install cairo
brew install poppler
brew install sparkle
# Install Qt 6.7.2
# NOTE: jurplel/[email protected] hasn't supported Qt6.2.4
- name: Install Qt 6.7.2
run: |
brew install [email protected]
# brew install p7zip
# python3 -m pip install setuptools wheel
# python3 -m pip install py7zr
# python3 -m pip install aqtinstall
# python3 -m aqt install-qt mac desktop 6.7.2 -m debug_info -O $RUNNER_WORKSPACE/Qt
# Build and Install Potrace library
#- name: Restore Potrace cache
# uses: actions/cache@v3
# id: cache-potrace
# with:
# path: |
# /usr/local/lib/libpotrace.0.dylib
# /usr/local/lib/libpotrace.a
# /usr/local/lib/libpotrace.dylib
# /usr/local/lib/libpotrace.la
# key: potrace
- name: Install Potrace
#if: steps.cache-potrace.outputs.cache-hit != 'true'
run: |
cd $RUNNER_WORKSPACE/dev/
curl https://potrace.sourceforge.net/download/1.16/potrace-1.16.tar.gz -o potrace-1.16.tar.gz
tar -xvf potrace-1.16.tar.gz
cd potrace-1.16
./configure --with-libpotrace
make install
# Build and Install OpenCV library
#- name: Restore OpenCV cache
# uses: actions/cache@v3
# id: cache-opencv
# with:
# path: |
# /usr/local/include/opencv4/
# /usr/local/lib/libopencv_**.dylib
# /usr/local/bin/opencv_**
# /usr/local/share/licenses/opencv4
# /usr/local/share/opencv4
# /usr/local/lib/cmake/opencv4
# /usr/local/bin/setup_vars_opencv4.sh
# key: opencv
- name: Install OpenCV
#if: steps.cache-opencv.outputs.cache-hit != 'true'
run: |
brew install opencv
- name: build submodules in project - sentry-native
run: |
cd third_party/sentry-native
cmake -B build -S . \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DSENTRY_BACKEND=crashpad \
-DSENTRY_INTEGRATION_QT=YES \
-DCMAKE_PREFIX_PATH=$RUNNER_WORKSPACE/Qt/6.7.2/clang_64/lib/cmake
cmake --build build --config RelWithDebInfo --parallel
cmake --install build --prefix install
- name: QMake project
if: ${{matrix.cfg.build == 'qmake' }}
run: |
mkdir build
cd build
$RUNNER_WORKSPACE/Qt/6.7.2/clang_64/bin/qmake DEFINES+=ENABLE_SENTRY=${{secrets.SENTRY_DSN}} ${{ github.workspace }}/swiftray.pro -spec macx-clang CONFIG+=qtquickcompiler
- name: CMake generate buildsystem
if: ${{matrix.cfg.build == 'cmake' }}
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_SPARKLE=TRUE -DENABLE_SENTRY=${{secrets.SENTRY_DSN}} -DCMAKE_PREFIX_PATH=$RUNNER_WORKSPACE/Qt/6.7.2/clang_64/lib/cmake ${{ github.workspace }}
- name: Install Certificate
if: ${{ matrix.cfg.dist }}
env:
MACOS_CERTIFICATE: ${{ secrets.DEVELOPMENT_CERTIFICATE_DATA }}
MACOS_CERTIFICATE_PWD: ${{ secrets.DEVELOPMENT_CERTIFICATE_PASSPHRASE }}
MACOS_KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
#SIGN_IDENTITY_ID:
run: |
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
security create-keychain -p $MACOS_KEYCHAIN_PASSWORD build.keychain
security default-keychain -s build.keychain
# it's necessary to extend the unlock time for keychain (default: 300s),
# otherwise it will get stuck in codesign stage when it's locked again
security set-keychain-settings -lut 1800 build.keychain
security unlock-keychain -p $MACOS_KEYCHAIN_PASSWORD build.keychain
security show-keychain-info build.keychain
security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_KEYCHAIN_PASSWORD build.keychain
- name: Compile (Build) project
if: ${{matrix.cfg.build == 'qmake' }}
run: |
cd build
make qmake_all
make -j10
- name: Compile (Build) project
if: ${{matrix.cfg.build == 'cmake'}}
env:
MACOS_CERTIFICATE: ${{ secrets.DEVELOPMENT_CERTIFICATE_DATA }}
MACOS_CERTIFICATE_PWD: ${{ secrets.DEVELOPMENT_CERTIFICATE_PASSPHRASE }}
MACOS_KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
cd build
if [ ${{ matrix.cfg.dist }} = true ] ; then
cmake --build . --target swiftray_app_bundle -- -j 6
else
cmake --build . --target Swiftray -- -j 6
fi
#- name: Deploy (Copy necessary shared libraries)
# run: |
# cd build
# $RUNNER_WORKSPACE/Qt/6.7.2/clang_64/bin/macdeployqt Swiftray.app -qmldir=${{ github.workspace }}/src/windows/qml -verbose=2
#- name: Workaround for libxcb dependencies
# run: |
# cd build/Swiftray.app/Contents/Frameworks
# install_name_tool -change /usr/local/Cellar/libxcb/1.15/lib/libxcb.1.dylib @executable_path/../Frameworks/libxcb.1.dylib libxcb-shm.0.dylib
# install_name_tool -change /usr/local/Cellar/libxcb/1.15/lib/libxcb.1.dylib @executable_path/../Frameworks/libxcb.1.dylib libxcb-render.0.dylib
- name: Select XCode version (workaround for codesign fail)
if: ${{matrix.cfg.build == 'qmake' }}
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '12.4.0'
# No longer needed
#- name: Fix bundle dependencies (workaround for bug in macdeployqt with Xcode version > 11.4)
# if: ${{matrix.cfg.build == 'cmake' }}
# run: |
# cd build
# cp /usr/local/opt/gcc/lib/gcc/current/libgcc_s.1.1.dylib Swiftray.app/Contents/Frameworks/
# chmod 644 Swiftray.app/Contents/Frameworks/libgcc_s.1.1.dylib
# install_name_tool -id @executable_path/../Frameworks/libgcc_s.1.1.dylib Swiftray.app/Contents/Frameworks/libgcc_s.1.1.dylib
# install_name_tool -change /usr/local/opt/gcc/lib/gcc/current/libgcc_s.1.1.dylib @executable_path/../Frameworks/libgcc_s.1.1.dylib Swiftray.app/Contents/Frameworks/libgcc_s.1.dylib
- name: Setup Sentry CLI
if: ${{ matrix.cfg.dist }}
uses: mathieu-bour/[email protected]
with:
version: latest # optional if 'latest'
token: ${{ SECRETS.SENTRY_TOKEN }} # from GitHub secrets
organization: flux3dp
project: swiftray
- name: Upload debug symbol to sentry
if: ${{ matrix.cfg.dist }}
run: |
cd $RUNNER_WORKSPACE/Qt/6.7.2/clang_64/lib
sentry-cli upload-dif -o flux3dp -p swiftray *.dSYM
cd ${{ github.workspace }}
cd build
dsymutil --minimize --out Swiftray.dSYM Swiftray.app/Contents/MacOS/Swiftray
#dsymutil Swiftray.app/Contents/MacOS/Swiftray
#sentry-cli upload-dif -o flux3dp -p swiftray Swiftray.app/Contents/MacOS/Swiftray.dSYM
sentry-cli upload-dif -o flux3dp -p swiftray Swiftray.dSYM
- name: Notarize Release Build
if: ${{ matrix.cfg.dist }}
env:
ASC_PROVIDER: ${{ secrets.ASC_PROVIDER }}
uses: erwin1/xcode-notarize@main
with:
product-path: "build/Swiftray.app"
appstore-connect-username: ${{ secrets.NOTARIZATION_USERNAME }}
appstore-connect-password: ${{ secrets.NOTARIZATION_PASSWORD }}
asc-provider: ${{ secrets.ASC_PROVIDER }}
verbose: true
- name: "Staple Release Build"
if: ${{ matrix.cfg.dist }}
uses: BoundfoxStudios/action-xcode-staple@v1
with:
product-path: "build/Swiftray.app"
- name: Create dmg and Sign the dmg
if: ${{ matrix.cfg.dist }}
env:
MACOS_CERTIFICATE: ${{ secrets.DEVELOPMENT_CERTIFICATE_DATA }}
MACOS_CERTIFICATE_PWD: ${{ secrets.DEVELOPMENT_CERTIFICATE_PASSPHRASE }}
MACOS_KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
brew install create-dmg
cd build
create-dmg --volname "Swiftray Installer" \
--volicon "Swiftray.app/Contents/Resources/icon.icns" \
--window-pos 200 120 \
--window-size 800 400 \
--icon-size 128 \
--icon "Swiftray.app" 200 190 \
--hide-extension "Swiftray.app" \
--app-drop-link 600 190 \
swiftray_installer.dmg \
"Swiftray.app/"
tag_version=${{ github.ref_name }}
tag_version=${tag_version:1} # strip the first char 'v'
echo ${tag_version}
security unlock-keychain -p $MACOS_KEYCHAIN_PASSWORD build.keychain
/usr/bin/codesign --sign "Developer ID Application: FLUX TECHNOLOGY CORP. (4Y92JWKV94)" \
--options runtime \
--timestamp \
--verbose \
swiftray_installer.dmg
- name: Create Github Release
if: ${{ matrix.cfg.dist }} && startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: build/swiftray_installer.dmg