From 2baa7e7527b973256cdbd928ddc4f2fa87e27a34 Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Sat, 18 May 2024 00:41:21 +0800 Subject: [PATCH] CI: build with Qt 6 --- .github/workflows/linux.yml | 40 ++++++++--------------------- .github/workflows/macos.yml | 33 ++++++------------------ .github/workflows/windows-msys2.yml | 18 ++++++------- 3 files changed, 28 insertions(+), 63 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 55f6ab5..e5f8af3 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -2,60 +2,42 @@ name: Linux Package -# Controls when the action will run. -on: - # Triggers the workflow on push or pull request events but only for the master branch - push: - branches: [ master ] - pull_request: - branches: [ master ] +on: [push, pull_request, workflow_dispatch] - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" build: - # The type of runner that the job will run on - runs-on: ubuntu-22.04 - - # Steps represent a sequence of tasks that will be executed as part of the job + runs-on: ubuntu-24.04 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive - - name: Install build dept. run: | sudo apt update - sudo apt install qtbase5-dev qtmultimedia5-dev libqt5multimedia5-plugins + sudo apt install cmake qt6-base-dev qt6-multimedia-dev # for linuxdeploy: https://github.com/AppImage/AppImageKit/wiki/FUSE + # linuxdeploy-plugin-qt still requires qmake currently: https://github.com/linuxdeploy/linuxdeploy-plugin-qt/issues/156 sudo add-apt-repository universe - sudo apt install libfuse2 - + sudo apt install libfuse2 qmake6 - name: Get linuxdeploy run: | wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage chmod +x linuxdeploy-*.AppImage - - name: Build working-directory: ./ run: | - mkdir build && cd build - cmake .. - cmake --build . -j$(nproc) - cd .. - + cmake -B build . + cmake --build build -j - name: Package + env: + QMAKE: /usr/bin/qmake6 run: | ./linuxdeploy-x86_64.AppImage --appdir AppDir -e build/thplayer -d assets/thplayer.desktop -i assets/thplayer.svg --icon-filename thplayer -p qt -o appimage mv TouHou_Player*.AppImage thplayer-linux.AppImage - - name: Upload - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Linux-Build path: thplayer-linux.AppImage diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 0ed25ac..6f24f01 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -2,42 +2,26 @@ name: macOS Package -# Controls when the action will run. -on: - # Triggers the workflow on push or pull request events but only for the master branch - push: - branches: [ master ] - pull_request: - branches: [ master ] +on: [push, pull_request, workflow_dispatch] - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" build: - # The type of runner that the job will run on runs-on: macos-latest - - # Steps represent a sequence of tasks that will be executed as part of the job steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive - - name: Install Qt uses: jurplel/install-qt-action@v3 - + with: + version: '6.7.0' + modules: 'qtmultimedia' - name: Build working-directory: ./ run: | - mkdir build && cd build - cmake .. - cmake --build . -j$(nproc) - cd .. - + cmake -B build . + cmake --build build -j - name: Package id: package working-directory: ./ @@ -45,10 +29,9 @@ jobs: run: | macdeployqt build/thplayer.app zip -r9 --symlinks thplayer-macos.zip thplayer.app - - name: Upload if: steps.package.conclusion == 'success' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: macOS-Build path: thplayer-macos.zip diff --git a/.github/workflows/windows-msys2.yml b/.github/workflows/windows-msys2.yml index f865140..4898c39 100644 --- a/.github/workflows/windows-msys2.yml +++ b/.github/workflows/windows-msys2.yml @@ -1,5 +1,5 @@ name: Windows MSYS2 Build -on: [push, pull_request] +on: [push, pull_request, workflow_dispatch] jobs: build: @@ -8,7 +8,7 @@ jobs: run: shell: msys2 {0} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive - uses: msys2/setup-msys2@v2 @@ -17,26 +17,26 @@ jobs: update: true pacboy: >- toolchain:p ninja:p cmake:p extra-cmake-modules:p icoutils:p - qt5-static:p bison: flex: + qt6:p icu:p bison: flex: - name: Build run: | - mkdir build && cd build - cmake .. -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} -DCMAKE_PREFIX_PATH="${MINGW_PREFIX}/qt5-static" -G Ninja - cmake --build . -j - cd .. + # for static build we will need -DCMAKE_PREFIX_PATH="${MINGW_PREFIX}/qt6-static" + # but MSYS2's static Qt 6 is problematic currently: https://github.com/msys2/MINGW-packages/issues/18966 + cmake . -B build -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} -G Ninja + cmake --build build -j - name: Prepare for package continue-on-error: true run: | mkdir package_workspace && cd package_workspace cp ../build/thplayer.exe ./ strip -s ./thplayer.exe - # windeployqt -winextras --no-quick-import --no-translations --no-opengl-sw --no-angle --no-system-d3d-compiler ./thplayer.exe + windeployqt6 --no-quick-import --no-translations --no-opengl-sw --no-system-d3d-compiler ./thplayer.exe ldd ./thplayer.exe > deps.txt bash -c 'while read -r line; do path=$(cut -d" " -f3 <<<$line); cp -v $path ./; done <<<$(grep ".*mingw.*bin" deps.txt); exit 0' rm deps.txt # done cd ../ - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: msys2-mingw-w64-x86_64-windows path: package_workspace/*