Skip to content

chore: fix some problems (#242) #678

chore: fix some problems (#242)

chore: fix some problems (#242) #678

Workflow file for this run

name: MacOS
on:
push:
paths-ignore:
- "README.md"
- "LICENSE"
- "BUILD.md"
pull_request:
paths-ignore:
- "README.md"
- "LICENSE"
- "BUILD.md"
release:
types: [published]
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13]
build_type: [Release, RelWithDebInfo]
qt_ver: [5.15.2]
qt_arch: [clang_64]
env:
targetName: lemon
steps:
- name: cacheQt
id: MacosCacheQt
uses: actions/cache@v4
with:
path: ../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}}
key: ${{ runner.os }}-Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}}
# - name: setupQt
# if: steps.MacosCacheQt.outputs.cache-hit == 'true'
# shell: bash
# env:
# QtPath: ../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}}
# run: |
# qt_Path=${env:QtPath}
# echo "Qt5_DIR=\"$QtPath\"" >> $GITHUB_ENV
# echo "${qt_Path}/bin" >> $GITHUB_PATH
- name: Install Qt
if: steps.MacosCacheQt.outputs.cache-hit != 'true'
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
- uses: actions/checkout@v4
with:
submodules: true
- name: macOS - ${{ matrix.qt_version }} - Build preparation - Install Packages
run: |
brew install ninja pkg-config
- name: build macos
env:
Qt5_DIR: ../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}}
run: |
cmake . -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DLEMON_BUILD_INFO="Build for macOS" -DLEMON_BUILD_EXTRA_INFO="Build on $(uname -sr)" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13
cmake --build . --parallel $(sysctl -n hw.logicalcpu)
# tag 打包
- name: package
env:
Qt5_DIR: ../Qt/${{matrix.qt_ver}}/${{matrix.qt_arch}}
run: |
# 拷贝依赖
#mv ${targetName} ${targetName}.app
export PATH=$Qt5_DIR/bin:$PATH
macdeployqt ${targetName}.app -qmldir=. -verbose=1 -dmg
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.targetName }}-${{ matrix.build_type }}.dmg
path: ${{ env.targetName }}.dmg
- name: uploadRelease
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./${{ env.targetName }}.dmg
asset_name: ${{ env.targetName }}-${{ matrix.build_type }}.dmg
tag: ${{ github.ref }}