-
Notifications
You must be signed in to change notification settings - Fork 20
199 lines (186 loc) · 7.91 KB
/
Copy pathbuild_mac.yml
File metadata and controls
199 lines (186 loc) · 7.91 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
name: 🍎 Build macOS
on:
push:
branches:
- master
workflow_dispatch:
permissions:
contents: write
env:
QT_VERSION: 6.11.1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
jobs:
build_mac:
name: 🔨 Build (${{ matrix.arch }})
strategy:
fail-fast: false
matrix:
include:
- arch: x86-64
runner: macos-15-intel
- arch: aarch64
runner: macos-15
runs-on: ${{ matrix.runner }}
steps:
- name: 📥 Check out repository
uses: actions/checkout@v4
- name: 🐍 Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 📦 Build and install OpenCV
run: |
brew install pkg-config openssl ninja cmake jpeg-turbo libpng libtiff webp
git clone https://github.com/opencv/opencv.git
cd opencv
mkdir -p build_cv
cd build_cv
if [ -d /Library/Frameworks/Mono.framework/Headers ]; then
sudo mv /Library/Frameworks/Mono.framework/Headers /Library/Frameworks/Mono.framework/Headers.bak
fi
cmake .. \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$HOME/opencv-install \
-DWITH_JPEG=ON \
-DWITH_PNG=ON \
-DWITH_TIFF=ON \
-DWITH_WEBP=ON \
-DWITH_ZLIB=ON \
-DWITH_QT=OFF \
-DOPENCV_GENERATE_PKGCONFIG=ON \
-DWITH_GTK=OFF \
-DBUILD_JPEG=OFF \
-DBUILD_PNG=OFF \
-DBUILD_TIFF=OFF \
-DBUILD_WEBP=OFF \
-DBUILD_ZLIB=OFF \
-DBUILD_opencv_python_bindings_generator=OFF \
-DBUILD_opencv_java_bindings_generator=OFF \
ninja
ninja install
- name: 📦 Install Qt
run: |
python -m pip install aqtinstall
python -m aqt install-qt -O ${{ github.workspace }}/Qt/ mac desktop ${{ env.QT_VERSION }}
echo ${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/macos/bin/ >> $GITHUB_PATH
- name: 🧹 Remove Mimer SQL plugin
run: |
QT_DIR=${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/macos
rm -f $QT_DIR/plugins/sqldrivers/libqsqlmimer.so
rm -f $QT_DIR/lib/cmake/Qt6Sql/Qt6QMimerSQLDriverPlugin*.cmake
sed -i '/QMimerSQLDriverPlugin/d' $QT_DIR/lib/cmake/Qt6Sql/Qt6SqlPlugins.cmake || true
rm -r ${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/macos/plugins/sqldrivers/libqsqlmimer.*
rm -r ${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/macos/plugins/sqldrivers/libqsqlodbc.*
rm -r ${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/macos/plugins/sqldrivers/libqsqlpsql.*
- name: 🧹 Remove ODBC SQL plugin
run: |
QT_DIR=${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/macos
rm -f $QT_DIR/plugins/sqldrivers/libqsqlodbc.so
rm -f $QT_DIR/lib/cmake/Qt6Sql/Qt6QODBCDriverPlugin*.cmake
sed -i '/Qt6QODBCDriverPlugin/d' $QT_DIR/lib/cmake/Qt6Sql/Qt6SqlPlugins.cmake || true
- name: 🧹 Remove PostgreSQL plugin
run: |
QT_DIR=${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/macos
rm -f $QT_DIR/plugins/sqldrivers/libqsqlpsql.so
rm -f $QT_DIR/lib/cmake/Qt6Sql/Qt6QPSQLDriverPlugin*.cmake
sed -i '/Qt6QPSQLDriverPlugin/d' $QT_DIR/lib/cmake/Qt6Sql/Qt6SqlPlugins.cmake || true
- name: 🔨 Build FastTrack
run: |
export DYLD_LIBRARY_PATH=$HOME/opencv-install/lib:$DYLD_LIBRARY_PATH
export PKG_CONFIG_PATH="$HOME/opencv-install/lib/pkgconfig:$PKG_CONFIG_PATH"
export CMAKE_PREFIX_PATH="$HOME/opencv-install:$CMAKE_PREFIX_PATH"
export CMAKE_PREFIX_PATH="${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/macos:$CMAKE_PREFIX_PATH"
./run.sh ci_clang
- name: 📦 Create application bundle
run: |
cd build/bin
wget https://raw.githubusercontent.com/arl/macdeployqtfix/refs/heads/master/macdeployqtfix.py
APP=FastTrack.app
APP_BINARY=$APP/Contents/MacOS/fasttrack
mv fasttrack.app "$APP"
macdeployqt "$APP" \
-always-overwrite \
-verbose=2
find / -name "libutf8_validity.dylib" -exec cp {} $APP/Contents/Frameworks/ \; 2> >(tee /dev/stderr) || true
find / -name "libgcc_s.1.1.dylib" -exec cp {} $APP/Contents/Frameworks/ \; 2> >(tee /dev/stderr) || true
find / -name "libsharpyuv.0.dylib" -exec cp {} $APP/Contents/Frameworks/ \; 2> >(tee /dev/stderr) || true
find / -name "libjxl_cms.0.11.dylib" -exec cp {} $APP/Contents/Frameworks/ \; 2> >(tee /dev/stderr) || true
find / -name "libvtk*.dylib" -exec cp {} $APP/Contents/Frameworks/ \; 2> >(tee /dev/stderr) || true
find / -name "libsqlite3*.dylib" -exec cp {} $APP/Contents/Frameworks/ \; 2> >(tee /dev/stderr) || true
find / -name "libhpdf*.dylib" -exec cp {} $APP/Contents/Frameworks/ \; 2> >(tee /dev/stderr) || true
for formula in little-cms2 jpeg-xl; do
FORMULA_PREFIX=$(brew --prefix "$formula")
cp -v "$FORMULA_PREFIX"/lib/lib*.dylib "$APP/Contents/Frameworks/" || true
done
find "$APP/Contents/Frameworks" -type f -name "*.dylib" -exec codesign --remove-signature {} \; 2>/dev/null || true
find "$APP/Contents/Frameworks" -type f -name "*.dylib" -exec codesign --force --sign - {} \;
python macdeployqtfix.py "$APP_BINARY" ${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/
hdiutil create -volname FastTrack -srcfolder $APP -ov -format UDZO FastTrack.dmg
- name: ⬆️ Upload artifact
uses: actions/upload-artifact@v4
with:
name: FastTrack-mac-${{ matrix.arch }}
path: ./build/bin/FastTrack.dmg
test_bundle:
name: 🧪 Test bundle (${{ matrix.arch }})
strategy:
fail-fast: false
matrix:
include:
- arch: x86-64
runner: macos-15-intel
- arch: aarch64
runner: macos-15
runs-on: ${{ matrix.runner }}
needs: build_mac
steps:
- name: ⬇️ Download artifact
uses: actions/download-artifact@v4
with:
name: FastTrack-mac-${{ matrix.arch }}
path: FastTrack
- name: 🧪 Run CLI smoke test
run: |
cd FastTrack
hdiutil attach FastTrack.dmg -mountpoint /Volumes/FastTrackApp
/Volumes/FastTrackApp/FastTrack.app/Contents/MacOS/fasttrack --cli --help
hdiutil detach /Volumes/FastTrackApp
- name: 🖥️ Run GUI smoke test
run: |
cd FastTrack
hdiutil attach FastTrack.dmg -mountpoint /Volumes/FastTrackApp
BIN=/Volumes/FastTrackApp/FastTrack.app/Contents/MacOS/fasttrack
"$BIN" &
pid=$!
sleep 20
if kill -0 "$pid" 2>/dev/null; then
kill "$pid"
wait "$pid" || true
echo "GUI startup test passed: app stayed alive for 20 seconds."
exit 0
fi
set +e
wait "$pid"
status=$?
set -e
echo "GUI startup test failed: app exited with status $status."
exit 1
- name: 🚀 Publish continuous release asset
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
cd FastTrack
asset_name=FastTrack-mac-${{ matrix.arch }}.dmg
cp FastTrack.dmg "$asset_name"
if ! gh release view continuous -R "$GH_REPO" >/dev/null 2>&1; then
gh release create continuous \
-R "$GH_REPO" \
--title "continuous" \
--notes "Rolling build artifacts." \
--prerelease \
--latest=false || gh release view continuous -R "$GH_REPO" >/dev/null
fi
gh release upload continuous "$asset_name" --clobber -R "$GH_REPO"