From eb863d5569f679bfd419bfca73ddc0871e29678d Mon Sep 17 00:00:00 2001 From: jared Date: Fri, 12 May 2023 22:36:50 +0800 Subject: [PATCH] update actions --- .github/workflows/macos.yml | 2 +- .github/workflows/ubuntu.yml | 32 +++++- .../{windows.yml => windows-2019.yml} | 6 +- .github/workflows/windows-2022.yml | 104 ++++++++++++++++++ examples/TaoQuickShow/TaoQuickShow.svg | 31 ++++++ 5 files changed, 169 insertions(+), 6 deletions(-) rename .github/workflows/{windows.yml => windows-2019.yml} (96%) create mode 100644 .github/workflows/windows-2022.yml create mode 100644 examples/TaoQuickShow/TaoQuickShow.svg diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 6e4eabd..9fc7097 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -26,7 +26,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-10.15,macos-11.0] + os: [macos-10.15,macos-11.0,macos-12] qt_ver: [5.9.9,5.12.10,5.15.2] qt_arch: [clang_64] env: diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index e4e3e9d..b8e41e1 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -27,15 +27,21 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-18.04,ubuntu-20.04] + os: [ubuntu-18.04,ubuntu-20.04,ubuntu-22.04] qt_ver: [5.9.9,5.12.10,5.15.2] qt_arch: [gcc_64] + env: + targetName: TaoQuickShow steps: - name: Install Qt uses: jurplel/install-qt-action@v2 with: version: ${{ matrix.qt_ver }} cached: 'false' + - name: Install QT linux deploy + uses: miurahr/install-linuxdeploy-action@v1 + with: + plugins: qt appimage - name: ubuntu install GL library run: sudo apt-get install -y libglew-dev libglfw3-dev - uses: actions/checkout@v2 @@ -45,4 +51,26 @@ jobs: - name: build ubuntu run: | qmake - make \ No newline at end of file + make + - name: package + run: | + # make sure Qt plugin finds QML sources so it can deploy the imported files + export QML_SOURCES_PATHS=./ + # 拷贝依赖 + linuxdeploy-x86_64.AppImage --plugin=qt --output=appimage --create-desktop-file --icon-file=examples/TaoQuickShow/${targetName}.svg --executable=bin/release/${targetName} --appdir bin/release/ + mv ${{ env.targetName }}-*.AppImage ${{ env.targetName }}.AppImage + + - uses: actions/upload-artifact@v2 + with: + name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}} + path: ${{ env.targetName }}.AppImage + + - name: uploadRelease + if: startsWith(github.event.ref, 'refs/tags/') + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ env.targetName }}.AppImage + asset_name: ${{ env.targetName }}_${{ github.ref_name }}_${{ matrix.os }}_Qt${{ matrix.qt_ver }}.AppImage + tag: ${{ github.ref }} + overwrite: true \ No newline at end of file diff --git a/.github/workflows/windows.yml b/.github/workflows/windows-2019.yml similarity index 96% rename from .github/workflows/windows.yml rename to .github/workflows/windows-2019.yml index 8f25161..2fd5860 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows-2019.yml @@ -11,7 +11,7 @@ on: - 'scripts/windows-*.ps1' - '.qmake.conf' - 'TaoQuick.pro' - - '.github/workflows/windows.yml' + - '.github/workflows/windows-2019.yml' # pull_request时触发workflow pull_request: paths: @@ -22,11 +22,11 @@ on: - 'scripts/windows-*.ps1' - '.qmake.conf' - 'TaoQuick.pro' - - '.github/workflows/windows.yml' + - '.github/workflows/windows-2019.yml' jobs: build: name: Build - # 运行平台, windows-latest目前是windows server 2019 + # 运行平台 # 参考文档 https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md runs-on: windows-2019 strategy: diff --git a/.github/workflows/windows-2022.yml b/.github/workflows/windows-2022.yml new file mode 100644 index 0000000..3c9c776 --- /dev/null +++ b/.github/workflows/windows-2022.yml @@ -0,0 +1,104 @@ +# 参考文档 https://docs.github.com/en/free-pro-team@latest/actions/ +name: Windows +on: + # push代码时触发workflow + push: + paths: + - '3rdparty/**' + - 'examples/**' + - 'mkspecs/**' + - 'src/**' + - 'scripts/windows-*.ps1' + - '.qmake.conf' + - 'TaoQuick.pro' + - '.github/workflows/windows-2022.yml' + # pull_request时触发workflow + pull_request: + paths: + - '3rdparty/**' + - 'examples/**' + - 'mkspecs/**' + - 'src/**' + - 'scripts/windows-*.ps1' + - '.qmake.conf' + - 'TaoQuick.pro' + - '.github/workflows/windows-2022.yml' +jobs: + build: + name: Build + # 运行平台 + # 参考文档 https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md + runs-on: windows-2022 + strategy: + # 矩阵配置 + matrix: + include: + # 5.15.2 参考 https://mirrors.cloud.tencent.com/qt/online/qtsdkrepository/windows_x86/desktop/qt5_5152/ + - 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: TaoQuickShow.exe + # 步骤 + steps: + # 安装Qt + - name: Install Qt + # 使用外部action。这个action专门用来安装Qt + uses: jurplel/install-qt-action@v2 + with: + # Version of Qt to install + version: ${{ matrix.qt_ver }} + # Target platform for build + # target: ${{ matrix.qt_target }} + arch: ${{ matrix.qt_arch }} + cached: 'false' + # 拉取代码 + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + submodules: 'true' + # msvc编译 + - name: msvc-build + id: build + shell: cmd + run: | + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.msvc_arch }} + qmake + nmake + echo winSdkDir=%WindowsSdkDir% >> %GITHUB_ENV% + echo winSdkVer=%WindowsSdkVersion% >> %GITHUB_ENV% + echo vcToolsInstallDir=%VCToolsInstallDir% >> %GITHUB_ENV% + echo vcToolsRedistDir=%VCToolsRedistDir% >> %GITHUB_ENV% + # tag 打包 + - name: package + id: package +# if: startsWith(github.event.ref, 'refs/tags/') + env: + archiveName: ${{ matrix.qt_ver }}-${{ matrix.qt_arch }} + msvcArch: ${{ matrix.msvc_arch }} + shell: pwsh + run: | + & scripts\windows-publish.ps1 ${env:archiveName} ${env:targetName} + # 记录packageName给后续step + $name = ${env:archiveName} + echo "::set-output name=packageName::$name" + # 上传artifacts + - uses: actions/upload-artifact@v2 + with: + name: ${{ steps.package.outputs.packageName }} + path: ${{ steps.package.outputs.packageName }} + # tag 上传Release + - name: uploadRelease + if: startsWith(github.event.ref, 'refs/tags/') + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ steps.package.outputs.packageName }}.zip + asset_name: ${{ steps.package.outputs.packageName }}.zip + tag: ${{ github.ref }} + overwrite: true diff --git a/examples/TaoQuickShow/TaoQuickShow.svg b/examples/TaoQuickShow/TaoQuickShow.svg new file mode 100644 index 0000000..4ea62d2 --- /dev/null +++ b/examples/TaoQuickShow/TaoQuickShow.svg @@ -0,0 +1,31 @@ + + + +