Skip to content

fix(linux-static-qt6.yml): Fix linux ci error #388

fix(linux-static-qt6.yml): Fix linux ci error

fix(linux-static-qt6.yml): Fix linux ci error #388

Workflow file for this run

name: Windows Qt6
on:
# push代码时触发workflow
push:
# 忽略README.md
paths-ignore:
- "README.md"
- "LICENSE"
- "BUILD.md"
# pull_request时触发workflow
pull_request:
# 忽略README.md
paths-ignore:
- "README.md"
- "LICENSE"
- "BUILD.md"
release:
types: [published]
jobs:
build:
name: Build
strategy:
matrix:
qt_version: [6.9.3]
build_type: [Release, RelWithDebInfo, Debug]
platform: [windows-latest]
include:
- platform: windows-latest
arch: x64
qtarch: win64_msvc2022_64
fail-fast: false
runs-on: ${{ matrix.platform }}
env:
targetName: lemon.exe
# 步骤
steps:
- name: Get the version
id: get_version
shell: bash
run: echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT
- name: Checking out sources
uses: actions/checkout@v6
with:
submodules: "recursive"
- name: Install Python 3.12 version
uses: actions/setup-python@v6
with:
python-version: "3.12"
architecture: x64
- name: Restoring submodules
run: git submodule update --init
# =========================================================================================================
- name: Install MSVC compiler
uses: TheMrMilchmann/setup-msvc-dev@v4.0.0
with:
arch: x64
- name: Installing Qt - x64
uses: jurplel/install-qt-action@v4
with:
version: ${{ matrix.qt_version }}
arch: ${{ matrix.qtarch }}
cache: true
setup-python: "false"
modules: "qtactiveqt"
- name: Win-x64 - ${{ matrix.qt_version }} - Generate Dependencies and Build
shell: bash
env:
CC: cl.exe
CXX: cl.exe
run: |
cmake . \
-GNinja \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DLEMON_BUILD_INFO="Build for Windows" \
-DLEMON_BUILD_EXTRA_INFO="Build on Windows x64" \
-DENABLE_XLS_EXPORT=ON
cmake --build . --parallel $(nproc)
- name: Deploy Qt for tests
shell: pwsh
run: windeployqt tests\test1\test1.exe
- name: Run tests
shell: bash
env:
QT_LOGGING_RULES: "*.debug=true" # 强制开启所有 debug 级别日志
QT_ASSUME_STDERR_HAS_CONSOLE: 1 # 欺骗 Qt,让它以为存在真实的控制台
QT_FORCE_STDERR_LOGGING: 1
run: |
ctest --test-dir . -V --timeout 120
- name: package
env:
archiveName: lemon.${{ steps.get_version.outputs.VERSION }}.Windows-${{ matrix.arch }}
shell: pwsh
run: |
# 创建文件夹
New-Item -ItemType Directory ${{ env.archiveName }}
# 拷贝exe
Copy-Item ${{ env.targetName }} ${{ env.archiveName}}\
# 拷贝依赖
windeployqt --qmldir . ${{ env.archiveName }}\${{ env.targetName }}
# 打包zip
Compress-Archive -Path ${{ env.archiveName }} ${{ env.archiveName }}'.zip'
- name: Upload artifact
uses: actions/upload-artifact@v7
env:
archiveName: lemon.${{ steps.get_version.outputs.VERSION }}.Windows-${{ matrix.arch }}
with:
name: lemon-win-qt6-x64-${{ matrix.build_type }}.zip
path: ${{ env.archiveName }}.zip
- name: uploadRelease
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
env:
archiveName: lemon.${{ steps.get_version.outputs.VERSION }}.Windows-${{ matrix.arch }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./${{ env.archiveName }}.zip
asset_name: lemon-win-qt6-x64-${{ matrix.build_type }}.zip
tag: ${{ github.ref }}
overwrite: true