docs: update README #338
Workflow file for this run
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: Windows | |
on: | |
push: | |
paths-ignore: # 或 paths | |
- '**' | |
# - 'README.md' | |
pull_request: | |
paths: | |
- 'README.md' | |
# - 'CMakeLists.txt' | |
# - 'src/**' | |
# - '.github/workflows/Windows.yml' | |
jobs: | |
build: | |
name: Build | |
# 运行平台, windows-latest目前是windows server 2022 | |
# 参考文档 https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md | |
runs-on: windows-2019 | |
strategy: | |
# 矩阵配置 | |
matrix: | |
include: | |
# 5.15.2 参考 https://mirrors.cloud.tencent.com/qt/online/qtsdkrepository/windows_x86/desktop/qt5_51211/ | |
- qt_ver: 5.15.2 | |
qt_arch: win32_msvc2019 | |
msvc_arch: x86 | |
qt_arch_install: msvc2019 | |
- qt_ver: 5.15.2 | |
qt_arch: win64_msvc2019_64 | |
msvc_arch: x64 | |
qt_arch_install: msvc2019_64 | |
env: | |
targetName: Flipped | |
targetLowerName: flipped | |
targetOS: windows | |
# 步骤 | |
steps: | |
# - name: Cache Qt # 使用缓存安装Qt模块 | |
# id: cache-qt | |
# uses: actions/cache@v1 # not v2! 参见 https://github.com/jurplel/install-qt-action | |
# with: | |
# path: ../Qt | |
# key: ${{ runner.os }}-QtCache-2 | |
# - name: setupQt | |
# if: steps.cache-qt.outputs.cache-hit == 'true' | |
# shell: pwsh | |
# env: | |
# QtPath: ${{ github.workspace }}/../Qt/${{ matrix.qt_ver }}/${{ matrix.qt_arch_install }} | |
# QtPluginPath: ${{ github.workspace }}/../Qt/${{ matrix.qt_ver }}/${{ matrix.qt_arch_install }}/plugins | |
# Qml2ImportPath: ${{ github.workspace }}/../Qt/${{ matrix.qt_ver }}/${{ matrix.qt_arch_install }}/qml | |
# run: | | |
# $Qt5_Dir="${{ env.QtPath }}" | |
# $QT_PLUGIN_PATH="${{ env.QtPluginPath }}" | |
# $QML2_IMPORT_PATH="${{ env.Qml2ImportPath }}" | |
# echo "Qt5_Dir=$Qt5_Dir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
# echo "QT_PLUGIN_PATH=$QT_PLUGIN_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
# echo "QML2_IMPORT_PATH=$QML2_IMPORT_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
# echo "GITHUB_PATH=$Qt5_Dir/bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Install Qt | |
# if: steps.cache-qt.outputs.cache-hit != 'true' | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{ matrix.qt_ver }} | |
arch: ${{ matrix.qt_arch }} | |
set-env: true | |
# cached: ${{ steps.cache-qt.outputs.cache-hit }} // 默认 'false' | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 1 | |
- name: Inspect Qt | |
shell: pwsh | |
run: | | |
Get-ChildItem -Recurse -Path $Env:Qt5_Dir | |
- name: pull 3rdparty code | |
id: pull-3rdparty-code | |
run: | | |
git submodule init | |
git submodule update | |
- name: msvc-build | |
id: msvc-build | |
shell: cmd | |
run: | | |
mkdir bin | |
mkdir build | |
cd build | |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.msvc_arch }} | |
if "${{ matrix.msvc_arch }}" == "x86" ( | |
echo "-------------- x86 --------------" | |
cmake -G "Visual Studio 16 2019" -A Win32 .. | |
devenv "${{ env.targetName }}.sln" /Build "Release|Win32" | |
) else ( | |
echo "-------------- x64 --------------" | |
cmake -G "Visual Studio 16 2019" -A x64 .. | |
devenv "${{ env.targetName }}.sln" /Build "Release|x64" | |
) | |
- name: name version | |
id: name-version | |
if: startsWith(github.event.ref, 'refs/tags/') | |
shell: pwsh | |
run: | | |
$systemInfo="${{ env.targetOS }}_${{ matrix.msvc_arch }}" | |
$productVersion="${{ github.ref }}".substring("refs/tags/v".length) | |
$productName="${{ env.targetName }}_$productVersion_beta_$systemInfo" | |
echo "systemInfo=$systemInfo" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
echo "productVersion=$productVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
echo "productName=$productName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
# tag打为.zip包 | |
- name: package | |
id: package | |
if: startsWith(github.event.ref, 'refs/tags/') | |
shell: pwsh | |
run: | | |
Copy-Item -Path build/bin/* -Destination bin -Recurse | |
dir bin | |
echo "-------------- debug 1 --------------" | |
# ${{ env.GITHUB_PATH }}/windeployqt bin/${{ env.targetName }}.exe # cache 时使用 | |
windeployqt bin/${{ env.targetName }}.exe --no-translations | |
echo "-------------- debug 2 --------------" | |
Compress-Archive -Path ${{ github.workspace }}/bin/* -Destination ${{ env.productName }}.zip | |
dir ${{ github.workspace }}/bin | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: my-artifact | |
path: ${{ env.productName }}.zip | |
# tag上传Release | |
- name: uploadRelease | |
if: startsWith(github.event.ref, 'refs/tags/') | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.upload_release }} | |
with: | |
draft: false | |
prerelease: false | |
files: | | |
${{ env.productName }}.zip | |
tag: ${{ github.ref }} | |
overwrite: true |