Skip to content

🍎 Build macOS

🍎 Build macOS #98

Workflow file for this run

name: 🍎 Build macOS
on:
workflow_dispatch:
env:
QT_VERSION: 6.11.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: 🍺 Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: 📦 Build and install OpenCV
run: |
brew update -q -f
brew upgrade -q -f
brew install pkg-config
brew install openssl
brew install 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: |
brew install aqtinstall
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: |
brew install coreutils
cd FastTrack
hdiutil attach FastTrack.dmg -mountpoint /Volumes/FastTrackApp
BIN=/Volumes/FastTrackApp/FastTrack.app/Contents/MacOS/fasttrack
set +e
gtimeout 20s "$BIN"
status=$?
set -e
if [ "$status" -eq 124 ]; then
echo "GUI startup test passed: app stayed alive for 20 seconds."
exit 0
fi
echo "GUI startup test failed: app exited with status $status."
exit "$status"