update workflows #1343
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: | |
paths: | |
- '*.txt' | |
- 'example/**' | |
- 'src/**' | |
- 'scripts/**' | |
- '.github/workflows/macos.yml' | |
pull_request: | |
paths: | |
- '*.txt' | |
- 'example/**' | |
- 'src/**' | |
- 'scripts/**' | |
- '.github/workflows/macos.yml' | |
jobs: | |
build: | |
name: Build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest] | |
qt_ver: [6.6.2] | |
qt_arch: [clang_64] | |
env: | |
targetName: example | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{ matrix.qt_ver }} | |
cache: ${{steps.cache-qt.outputs.cache-hit}} | |
arch: ${{ matrix.qt_arch }} | |
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats qt3d' | |
- name: Set up Ninja | |
uses: seanmiddleditch/gha-setup-ninja@v3 | |
with: | |
version: 1.10.2 | |
- name: build macos | |
run: | | |
cmake --version | |
mkdir build | |
cd build | |
cmake -DCMAKE_MESSAGE_LOG_LEVEL=STATUS -DCMAKE_PREFIX_PATH=/Users/runner/work/FluentUI/Qt/${{ matrix.qt_ver }}/macos -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -GNinja .. | |
cmake --build . --target all --config Release --parallel | |
- name: package | |
run: | | |
# 先删除所有dSYM文件,减少包的体积 | |
sudo find /Users/runner/work/FluentUI/Qt/${{ matrix.qt_ver }}/macos/qml -name "*.dSYM" | xargs rm -r | |
# 拷贝依赖 | |
sudo macdeployqt bin/Release/${targetName}.app -qmldir=. -dmg | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}} | |
path: bin/release/${{ env.targetName }}.app | |
- name: uploadRelease | |
if: startsWith(github.event.ref, 'refs/tags/') | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: bin/release/${{ env.targetName }}.dmg | |
asset_name: ${{ env.targetName }}_${{ github.ref_name }}_${{ matrix.os }}_Qt${{ matrix.qt_ver }}.dmg | |
tag: ${{ github.ref }} | |
overwrite: true |