From 823b5cd60389f8f4f45b180edee66d8e84625051 Mon Sep 17 00:00:00 2001 From: cgxxv Date: Sun, 17 Mar 2024 12:35:15 +0800 Subject: [PATCH] Update action config --- .github/qt-windows.yml | 64 +++++++++++++++-------------- .github/workflows/qt-macos.yml | 1 + .github/workflows/qt-ubuntu.yml | 1 + .github/workflows/qt-windows.yml | 69 +++++++++++++++++--------------- 4 files changed, 73 insertions(+), 62 deletions(-) diff --git a/.github/qt-windows.yml b/.github/qt-windows.yml index 10a755e..b59b98c 100644 --- a/.github/qt-windows.yml +++ b/.github/qt-windows.yml @@ -18,7 +18,27 @@ jobs: qt: - version: 6.5.3 modules: qtwebengine qtwebchannel qtpositioning + include: + - { sys: mingw64, env: x86_64 } + - { sys: mingw32, env: i686 } + - { sys: ucrt64, env: ucrt-x86_64 } # Experimental! + - { sys: clang64, env: clang-x86_64 } # Experimental! + defaults: + run: + shell: msys2 {0} steps: + - uses: msys2/setup-msys2@v2 + with: + msystem: ${{matrix.sys}} + update: true + install: >- + git + make + pacboy: >- + toolchain:p + cmake:p + ninja:p + - name: Install Qt uses: jurplel/install-qt-action@v3 with: @@ -30,46 +50,32 @@ jobs: with: fetch-depth: 1 - - name: Set up Qt environment - shell: powershell - run: | - $QtVersion = "${{ matrix.qt.version }}" - $QtBaseDir = "${{ github.workspace }}\..\Qt\$QtVersion" - $QtArch = Get-ChildItem -Path $QtBaseDir -Directory | Where-Object { $_.Name -like 'msvc*' } | Select-Object -ExpandProperty Name - $QtInstallDir = "${{ github.workspace }}\..\Qt\$QtVersion\$QtArch\lib\cmake" - # $QtInstallDir = (Get-ChildItem -Path "${{ github.workspace }}\..\Qt\$QtVersion\" | Where-Object { $_.PSIsContainer -and $_.Name -match 'msvc.*' } | Select-Object -ExpandProperty FullName) + '\lib\cmake' - $CMakeBuildType = "Release" - Write-Output "QT_VERSION=$QtVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - Write-Output "CMAKE_PREFIX_PATH=$QtInstallDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - Write-Output "CMAKE_BUILD_TYPE=$CMakeBuildType" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - - name: Build Msvc - shell: powershell + - name: Build Windows + env: + QT_VERSION: ${{ matrix.qt.version }} + CMAKE_PREFIX_PATH: ${{ env.Qt6_DIR }}\lib\cmake + CMAKE_BUILD_TYPE: Release run: | - # Get-ChildItem -Path "${{ github.workspace }}\.." - # Get-ChildItem -Path "$QtBaseDir" - # Get-ChildItem -Path "$QtInstallDir" - # Get-ChildItem mkdir build cd build - cmake .. - Get-ChildItem + cmake -G Ninja .. + ls -al cmake --build . - Get-ChildItem + ls -al make cd .. - Get-ChildItem build + ls -al build - name: Package Application run: | cd build - $os = ${{ matrix.os }} -replace "-latest", "" - $repositoryName = ${{ github.repository }} -replace ".*/", "" - $zipfile = ${repositoryName}-${os}-${{ matrix.arch }}-${{ github.run_number }}.zip - Compress-Archive -Path ${repositoryName}.exe -DestinationPath ${zipfile} - Move-Item ${zipfile} .. + os=$(echo "${{ matrix.os }}" | sed 's/-latest//') + repository_name=$(basename ${{ github.repository }}) + zipfile=${repository_name}-${os}-${{ matrix.arch }}-${{ github.run_number }}.zip + zip -r ${zipfile} ${repository_name}.exe + mv ${zipfile} .. cd .. - Get-ChildItem + ls -al echo "${zipfile}" > assets.txt - name: Create a Release diff --git a/.github/workflows/qt-macos.yml b/.github/workflows/qt-macos.yml index 8f92067..e018f4d 100644 --- a/.github/workflows/qt-macos.yml +++ b/.github/workflows/qt-macos.yml @@ -54,6 +54,7 @@ jobs: os=$(echo "${{ matrix.os }}" | sed 's/-latest//') repository_name=$(basename ${{ github.repository }}) zipfile=${repository_name}-${os}-${{ matrix.arch }}-${{ github.run_number }}.zip + macdeployqt ${repository_name}.app -always-overwrite zip -r ${zipfile} ${repository_name}.app mv ${zipfile} ../.. cd ../.. diff --git a/.github/workflows/qt-ubuntu.yml b/.github/workflows/qt-ubuntu.yml index f681cf0..8623055 100644 --- a/.github/workflows/qt-ubuntu.yml +++ b/.github/workflows/qt-ubuntu.yml @@ -55,6 +55,7 @@ jobs: os=$(echo "${{ matrix.os }}" | sed 's/-latest//') repository_name=$(basename ${{ github.repository }}) zipfile=${repository_name}-${os}-${{ matrix.arch }}-${{ github.run_number }}.zip + linuxdeployqt ${repository_name} -appimage zip -r ${zipfile} ${repository_name} mv ${zipfile} .. cd .. diff --git a/.github/workflows/qt-windows.yml b/.github/workflows/qt-windows.yml index b59b98c..989901d 100644 --- a/.github/workflows/qt-windows.yml +++ b/.github/workflows/qt-windows.yml @@ -18,27 +18,7 @@ jobs: qt: - version: 6.5.3 modules: qtwebengine qtwebchannel qtpositioning - include: - - { sys: mingw64, env: x86_64 } - - { sys: mingw32, env: i686 } - - { sys: ucrt64, env: ucrt-x86_64 } # Experimental! - - { sys: clang64, env: clang-x86_64 } # Experimental! - defaults: - run: - shell: msys2 {0} steps: - - uses: msys2/setup-msys2@v2 - with: - msystem: ${{matrix.sys}} - update: true - install: >- - git - make - pacboy: >- - toolchain:p - cmake:p - ninja:p - - name: Install Qt uses: jurplel/install-qt-action@v3 with: @@ -50,32 +30,55 @@ jobs: with: fetch-depth: 1 - - name: Build Windows + # - name: Set up Qt environment + # shell: powershell + # run: | + # $QtVersion = "${{ matrix.qt.version }}" + # $QtBaseDir = "${{ github.workspace }}\..\Qt\$QtVersion" + # $QtArch = Get-ChildItem -Path $QtBaseDir -Directory | Where-Object { $_.Name -like 'msvc*' } | Select-Object -ExpandProperty Name + # $QtInstallDir = "${{ github.workspace }}\..\Qt\$QtVersion\$QtArch\lib\cmake" + # # $QtInstallDir = (Get-ChildItem -Path "${{ github.workspace }}\..\Qt\$QtVersion\" | Where-Object { $_.PSIsContainer -and $_.Name -match 'msvc.*' } | Select-Object -ExpandProperty FullName) + '\lib\cmake' + # $CMakeBuildType = "Release" + # Write-Output "QT_VERSION=$QtVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + # Write-Output "CMAKE_PREFIX_PATH=$QtInstallDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + # Write-Output "CMAKE_BUILD_TYPE=$CMakeBuildType" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + - name: Build Msvc + shell: powershell env: QT_VERSION: ${{ matrix.qt.version }} CMAKE_PREFIX_PATH: ${{ env.Qt6_DIR }}\lib\cmake CMAKE_BUILD_TYPE: Release run: | + # Get-ChildItem -Path "${{ github.workspace }}\.." + # Get-ChildItem -Path "$QtBaseDir" + # Get-ChildItem -Path "$QtInstallDir" + # Get-ChildItem mkdir build cd build - cmake -G Ninja .. - ls -al - cmake --build . - ls -al - make + cmake .. + Get-ChildItem + cmake --build . --config ${env:CMAKE_BUILD_TYPE} + Get-ChildItem cd .. - ls -al build + Get-ChildItem build - name: Package Application + shell: powershell + env: + QT_VERSION: ${{ matrix.qt.version }} + CMAKE_PREFIX_PATH: ${{ env.Qt6_DIR }}\lib\cmake + CMAKE_BUILD_TYPE: Release run: | cd build - os=$(echo "${{ matrix.os }}" | sed 's/-latest//') - repository_name=$(basename ${{ github.repository }}) - zipfile=${repository_name}-${os}-${{ matrix.arch }}-${{ github.run_number }}.zip - zip -r ${zipfile} ${repository_name}.exe - mv ${zipfile} .. + $os = ${{ matrix.os }} -replace "-latest", "" + $repositoryName = ${{ github.repository }} -replace ".*/", "" + $zipfile = ${repositoryName}-${os}-${{ matrix.arch }}-${{ github.run_number }}.zip + windeployqt ${env:CMAKE_BUILD_TYPE}\${repositoryName}.exe + Compress-Archive -Path ${env:CMAKE_BUILD_TYPE} -DestinationPath ${zipfile} + Move-Item ${zipfile} .. cd .. - ls -al + Get-ChildItem echo "${zipfile}" > assets.txt - name: Create a Release