CI: create/upload dmg file on macOS pipeline for x64/arm64 #335
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: macOS | |
on: [push] | |
jobs: | |
build-macos: | |
strategy: | |
matrix: | |
qt_version: [5.15, 6.7] | |
os: [macos-latest-large, macos-latest-xlarge] | |
runs-on: ${{matrix.os}} | |
name: build-macos-qt${{matrix.qt_version}} | |
steps: | |
- name: Set globals | |
id: globals | |
run: | | |
QT_VERSION_MAJOR=$(echo ${{matrix.qt_version}} | cut -d. -f1) | |
echo qt_version_major=$QT_VERSION_MAJOR >> ${GITHUB_OUTPUT} | |
echo qt_path=$(brew --prefix qt@$QT_VERSION_MAJOR) >> ${GITHUB_OUTPUT} | |
if [[ ${{matrix.os}} =~ "-large" ]]; then | |
echo arch=x64 >> ${GITHUB_OUTPUT} | |
elif [[ ${{matrix.os}} =~ "-xlarge" ]]; then | |
echo arch=arm64 >> ${GITHUB_OUTPUT} | |
fi | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install Qt | |
run: brew install qt@${{steps.globals.outputs.qt_version_major}} | |
- name: Install OpenCascade | |
run: brew install opencascade | |
- name: Install Assimp | |
run: brew install assimp | |
- name: Get count of CPU cores | |
uses: SimenB/github-actions-cpu-cores@v1 | |
id: cpu-cores | |
- name: Build | |
run: | | |
mkdir ${{github.workspace}}/build | |
cd ${{github.workspace}}/build | |
cmake --version | |
cmake .. \ | |
-DMayo_BuildTests=ON \ | |
-DMayo_BuildPluginAssimp=ON \ | |
-DQT_DIR=${{steps.globals.outputs.qt_path}}/lib/cmake/Qt${{steps.globals.outputs.qt_version_major}} | |
cmake --build . \ | |
--config Release \ | |
--parallel ${{steps.cpu-cores.outputs.count}} | |
- name: Execute Unit Tests | |
working-directory: ${{github.workspace}}/build | |
run: | | |
./mayo.app/Contents/MacOS/mayo --runtests | |
- name: Create dmg file | |
if: ${{steps.globals.outputs.qt_version_major}} == '6' | |
working-directory: ${{github.workspace}}/build | |
run: | | |
${{steps.globals.outputs.qt_path}}/bin/macdeployqt mayo.app -dmg | |
mv mayo.dmg Mayo-0.9.0-macOS-${{steps.globals.outputs.arch}}.dmg | |
- name: Upload dmg file | |
if: ${{steps.globals.outputs.qt_version_major}} == '6' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Mayo-0.9.0-macOS-${{steps.globals.outputs.arch}}-dmg | |
path: | | |
${{github.workspace}}/build/Mayo-0.9.0-macOS-${{steps.globals.outputs.arch}}.dmg | |
#${{github.workspace}}/build/MayoConv-0.9.0-macOS-${{steps.globals.outputs.arch}}.dmg | |