Skip to content

Meng jianing

Meng jianing #152

Workflow file for this run

name: macOS CI/CD
on:
push:
paths:
- 'App/**'
- 'Tester/**'
- '.github/workflows/macos.yml'
pull_request:
paths:
- 'App/**'
- 'Tester/**'
- '.github/workflows/macos.yml'
jobs:
build:
name: macOS-CI-CD
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11.0]
qt_ver: [6.2.2, 6.6.0]
qt_arch: [clang_64]
env:
targetName: PolyChat
# 在 Qt pro 文件中的 TARGET
QtApplicationName: App
steps:
# macos 11.0 默认环境变了,要指定
- name: prepare env
if: ${{ matrix.os == 'macos-11.0' }}
run: |
softwareupdate --all --install --force
sudo xcode-select --print-path
sudo xcode-select --switch /Library/Developer/CommandLineTools
#参考:https://ddalcino.github.io/aqt-list-server/
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
cached: 'false'
aqtversion: '==3.1.*'
# host: 'mac'
#下面这几行不用也可以,删除不必要的控件能减少包体积
# modules: 'qtnetworkauth'
# tools: 'tools_qtcreator'
- uses: actions/checkout@v2
with:
fetch-depth: 1
# MacOS 下测试(使用 QTest)
- name: Test on macOS
run: |
echo '-------------------'
cd ./Tester
echo '-------------------'
qmake CONFIG+=debug
make
ls
./PolyChatTester -v2 -txt
echo '\n\n==============================./PolyChatTester -txt==============================\n\n'
./PolyChatTester -txt
# 编译 Release 版本
- name: Build on macOS
run: |
ls
cd ./${QtApplicationName}
qmake
make
# 打包
- name: Package on MacOS
run: |
cd ./${QtApplicationName}
# mv ./${QtApplicationName}/${QtApplicationName}.app .
echo '------------------'
ls
# 拷贝依赖 pro文件里的名称:
macdeployqt ${QtApplicationName}.app -qmldir=. -verbose=1 -dmg
# 上传artifacts
- uses: actions/upload-artifact@v2
with:
name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}.zip
path: ${{ env.QtApplicationName }}/${{ env.QtApplicationName }}.app
# tag 上传Release
- name: Upload Release
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.QtApplicationName }}/${{ env.QtApplicationName }}.dmg
asset_name: ${{ env.targetName }}_${{ matrix.os }}_${{ matrix.qt_ver }}.dmg
tag: ${{ github.ref }}
overwrite: true