Fix macOS CI #103
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-12 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
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 '::warning::"brew upgrade" failed. Please check the log to see if the artifact is valid.' | |
brew install qt@5 || echo '::warning::"brew install qt@5" failed. Please check the log to see if the artifact is valid.' | |
brew link qt@5 --force | |
- name: Create build directory | |
run: mkdir ${{ runner.temp }}/shadow_build_dir | |
- name: Switch Xcode version | |
run: sudo xcode-select --switch "/Applications/Xcode_14.0.1.app" | |
- 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 }} |