Skip to content

Update build-macos.yml #68

Update build-macos.yml

Update build-macos.yml #68

Workflow file for this run

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
run: |
brew update
brew upgrade || echo '::notice::"brew upgrade" failed. Please check the log to see if the artifact is valid.'
brew install qt@5 || echo '::notice::"brew install qt@5" failed. Please check the log to see if the artifact is valid.'
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 }}