Update build-macos.yml #65
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 CI | |
# Based on the workflow file of QGroundControl repo | |
on: [ workflow_dispatch, push ] | |
defaults: | |
run: | |
shell: bash | |
env: | |
SOURCE_DIR: ${{ github.workspace }}/SerialTest | |
QCP_VERSION: 2.1.1 | |
ARTIFACT: SerialTest.dmg | |
jobs: | |
build: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
path: SerialTest | |
- name: Download QCustomPlot | |
run: | | |
wget https://www.qcustomplot.com/release/${{ env.QCP_VERSION }}/QCustomPlot-source.tar.gz | |
tar -xzf QCustomPlot-source.tar.gz | |
cp qcustomplot-source/qcustomplot.* ${{ env.SOURCE_DIR }}/src | |
- name: Install Qt | |
continue-on-error: true | |
run: | | |
brew update | |
brew upgrade | |
brew install qt@5 | |
brew link qt5 --force | |
- name: Create build directory | |
run: mkdir ${{ runner.temp }}/shadow_build_dir | |
- name: Build | |
working-directory: ${{ runner.temp }}/shadow_build_dir | |
run: | | |
qmake -r ${{ env.SOURCE_DIR }}/src/SerialTest.pro CONFIG+=app_bundle | |
make -j$((`sysctl -n hw.ncpu` + 1)) | |
- name: Generate DMG file | |
run: | | |
# Copy all files | |
macdeployqt ${{ runner.temp }}/shadow_build_dir/SerialTest.app -verbose=2 | |
# Remove unnecessary module | |
rm -rf ${{ runner.temp }}/shadow_build_dir/SerialTest.app/Contents/Frameworks/QtVirtualKeyboard.framework | |
rm -rf ${{ runner.temp }}/shadow_build_dir/SerialTest.app/Contents/Frameworks/QtQml.framework | |
rm -rf ${{ runner.temp }}/shadow_build_dir/SerialTest.app/Contents/Frameworks/QtQmlModels.framework | |
rm -rf ${{ runner.temp }}/shadow_build_dir/SerialTest.app/Contents/Frameworks/QtQuick.framework | |
rm -rf ${{ runner.temp }}/shadow_build_dir/SerialTest.app/Contents/Frameworks/QtPdf.framework | |
rm -rf ${{ runner.temp }}/shadow_build_dir/SerialTest.app/Contents/PlugIns/virtualkeyboard | |
rm -rf ${{ runner.temp }}/shadow_build_dir/SerialTest.app/Contents/PlugIns/platforminputcontexts | |
# Create dmg file | |
macdeployqt ${{ runner.temp }}/shadow_build_dir/SerialTest.app -no-plugins -dmg -verbose=2 | |
- name: Save artifact | |
uses: actions/upload-artifact@master | |
with: | |
name: ${{ env.ARTIFACT }} | |
path: ${{ runner.temp }}/shadow_build_dir/**/${{ env.ARTIFACT }} |