FluentUI/.github/workflows/macos.yml

77 lines
2.4 KiB
YAML
Raw Normal View History

2023-03-08 00:12:02 +08:00
name: MacOS
on:
push:
paths:
2023-04-27 09:38:57 +08:00
- '*.txt'
- 'example/**'
2023-03-08 00:12:02 +08:00
- 'src/**'
2023-04-27 09:38:57 +08:00
- 'scripts/**'
2023-03-08 00:12:02 +08:00
- '.github/workflows/macos.yml'
pull_request:
paths:
2023-04-27 09:38:57 +08:00
- '*.txt'
- 'example/**'
2023-03-08 00:12:02 +08:00
- 'src/**'
2023-04-27 09:38:57 +08:00
- 'scripts/**'
2023-03-08 00:12:02 +08:00
- '.github/workflows/macos.yml'
2023-04-27 09:38:57 +08:00
2023-03-08 00:12:02 +08:00
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
2024-01-31 20:00:33 +08:00
os: [macos-latest]
2024-02-23 12:26:10 +08:00
qt_ver: [6.6.2]
2023-03-08 00:12:02 +08:00
qt_arch: [clang_64]
env:
targetName: example
steps:
2023-04-27 09:38:57 +08:00
- name: Check out repository
uses: actions/checkout@v3
2023-04-02 23:36:23 +08:00
with:
2023-04-27 09:38:57 +08:00
submodules: recursive
2023-03-08 00:12:02 +08:00
- name: Install Qt
2023-03-30 22:18:42 +08:00
uses: jurplel/install-qt-action@v3
2023-03-08 00:12:02 +08:00
with:
version: ${{ matrix.qt_ver }}
2023-04-02 23:36:23 +08:00
cache: ${{steps.cache-qt.outputs.cache-hit}}
2023-03-30 22:18:42 +08:00
arch: ${{ matrix.qt_arch }}
2023-11-16 00:22:55 +08:00
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats qt3d'
2023-04-27 09:38:57 +08:00
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@v3
2023-03-08 00:12:02 +08:00
with:
2023-10-20 22:19:46 +08:00
version: 1.10.2
2023-04-27 09:38:57 +08:00
2023-03-08 00:12:02 +08:00
- name: build macos
run: |
2023-04-27 09:38:57 +08:00
cmake --version
mkdir build
cd build
2024-01-31 20:00:33 +08:00
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 ..
2023-04-27 09:38:57 +08:00
cmake --build . --target all --config Release --parallel
2023-03-08 00:12:02 +08:00
- name: package
run: |
2023-12-30 22:03:49 +08:00
# 先删除所有dSYM文件减少包的体积
2024-01-31 20:00:33 +08:00
sudo find /Users/runner/work/FluentUI/Qt/${{ matrix.qt_ver }}/macos/qml -name "*.dSYM" | xargs rm -r
2023-03-08 00:12:02 +08:00
# 拷贝依赖
2024-03-18 14:10:50 +08:00
sudo macdeployqt bin/Release/${targetName}.app -qmldir=. -dmg
2023-04-27 09:38:57 +08:00
2023-03-08 00:12:02 +08:00
- uses: actions/upload-artifact@v2
with:
2023-10-21 11:57:35 +08:00
name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}
2023-03-08 00:12:02 +08:00
path: bin/release/${{ env.targetName }}.app
2023-04-27 09:38:57 +08:00
2023-03-08 00:12:02 +08:00
- 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
2023-03-08 00:12:02 +08:00
tag: ${{ github.ref }}
2024-01-31 20:00:33 +08:00
overwrite: true