From 15d14359d7f4a958a714b7d9a0b2e7f9aef7319a Mon Sep 17 00:00:00 2001 From: Le Tan Date: Sun, 8 Oct 2023 23:09:31 +0800 Subject: [PATCH] try fix win ci (#2434) * try fix win ci * remove win32 * add more modules * fix ci * try fix linux-ci * fix linux ci * try fix rcc * fix rcc path * tree * add back qt 5 * use jom --- .github/workflows/ci-linux.yml | 39 ++++++++--------- .github/workflows/ci-win.yml | 79 +++++++++++++++++++++------------- package/qt.conf | 2 + src/src.pro | 4 +- 4 files changed, 72 insertions(+), 52 deletions(-) create mode 100644 package/qt.conf diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index b1e2c734c5..b484b8b3a2 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -38,43 +38,39 @@ jobs: - name: Install dependencies run: | sudo DEBIAN_FRONTEND=noninteractive apt-get update - sudo DEBIAN_FRONTEND=noninteractive apt-get install -y libfcitx-qt5-dev tree + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y libfcitx5-qt-dev tree - name: Cache Qt id: cache-qt uses: actions/cache@v1 # not v2! with: path: ../Qt - key: ${{ runner.os }}-QtCache-5.15 + key: ${{ runner.os }}-QtCache-6.5 - name: Install Qt - uses: jurplel/install-qt-action@v2 + uses: jurplel/install-qt-action@v3 with: - version: 5.15.2 + version: 6.5.2 target: desktop - modules: qtwebengine - tools: tools_openssl_x64,1.1.1-4,qt.tools.openssl.gcc_64 - cached: ${{ steps.cache-qt.outputs.cache-hit }} + modules: 'qtwebengine qtwebchannel qtpositioning qtpdf qtimageformats qt5compat' + cache: 'true' - name: Create Build Dir run: mkdir build working-directory: ${{runner.workspace}} - - name: Compile qt5ct + - name: Compile qt6ct run: | - wget --no-check-certificate -c https://versaweb.dl.sourceforge.net/project/qt5ct/qt5ct-1.1.tar.bz2 - tar xf qt5ct-1.*.tar.bz2 - cd qt5ct-1.*/ - QT_SELECT=5 qmake + git clone https://github.com/trialuser02/qt6ct qt6ct.git + cd qt6ct.git + qmake make -j$(nproc) && sudo make install working-directory: ${{runner.workspace}}/build - name: Configure Project run: | qmake -v - cp /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so ./ - sudo chmod +rwx ./libfcitxplatforminputcontextplugin.so - cp ./libfcitxplatforminputcontextplugin.so $Qt5_Dir/plugins/platforminputcontexts + # TODO: libfcitx5 qmake CONFIG+=release -spec linux-g++-64 ${GITHUB_WORKSPACE}/vnote.pro working-directory: ${{runner.workspace}}/build @@ -94,18 +90,21 @@ jobs: # Move the lib out to avoid duplication mv AppDir/usr/lib ./ LD_LIBRARY_PATH=$PWD/lib:$LD_LIBRARY_PATH + Qt6_Dir=$QT_HOST_BINS/.. + tree $Qt6_Dir + tree $Qt6_Dir/../.. # Copy translations mkdir -p AppDir/usr/translations - cp $Qt5_Dir/translations/qt_zh_CN.qm AppDir/usr/translations + cp $Qt6_Dir/translations/qt_zh_CN.qm AppDir/usr/translations # Package qt5ct (EXTRA_QT_PLUGINS seems not work) # EXTRA_QT_PLUGINS="platformthemes/libqt5ct.so;styles/libqt5ct-style.so" mkdir -p AppDir/usr/plugins/platformthemes mkdir -p AppDir/usr/plugins/styles - cp $Qt5_Dir/plugins/platformthemes/* AppDir/usr/plugins/platformthemes/ - cp $Qt5_Dir/plugins/styles/* AppDir/usr/plugins/styles/ + cp $Qt6_Dir/plugins/platformthemes/* AppDir/usr/plugins/platformthemes/ + cp $Qt6_Dir/plugins/styles/* AppDir/usr/plugins/styles/ # Package libssl.so and libcrypto.so - Qt5_Tools=$Qt5_Dir/../../Tools - linuxdeploy-x86_64.AppImage --appdir ./AppDir --plugin qt --output appimage -l $Qt5_Tools/OpenSSL/binary/lib/libcrypto.so.1.1 -l $Qt5_Tools/OpenSSL/binary/lib/libssl.so.1.1 + Qt_Tools=$Qt6_Dir/../../Tools + linuxdeploy-x86_64.AppImage --appdir ./AppDir --plugin qt --output appimage -l $Qt_Tools/OpenSSL/binary/lib/libcrypto.so.* -l $Qt_Tools/OpenSSL/binary/lib/ tree AppDir working-directory: ${{runner.workspace}}/build diff --git a/.github/workflows/ci-win.yml b/.github/workflows/ci-win.yml index 53b9d612c2..092568d75e 100644 --- a/.github/workflows/ci-win.yml +++ b/.github/workflows/ci-win.yml @@ -21,29 +21,21 @@ jobs: strategy: matrix: config: - # - { - # name: "Build On Win64 Qt 5.12", - # arch: win64_msvc2017_64, - # platform: x64, - # qt: 5.12.11 - # } - # - { - # name: "Build On Win32 Qt 5.12", - # arch: win32_msvc2017, - # platform: x86, - # qt: 5.12.11 - # } - { name: "Build On Win64 Qt 5.15", arch: win64_msvc2019_64, platform: x64, - qt: 5.15.2 + qt: 5.15.2, + qt_modules: qtwebengine, + qt_tools: tools_opensslv3_x64 } - { - name: "Build On Win32 Qt 5.15", - arch: win32_msvc2019, - platform: x86, - qt: 5.15.2 + name: "Build On Win64 Qt 6.5", + arch: win64_msvc2019_64, + platform: x64, + qt: 6.5.2, + qt_modules: "qtwebengine qtwebchannel qtpositioning qtpdf qtimageformats qt5compat", + qt_tools: tools_opensslv3_x64 } steps: @@ -64,39 +56,51 @@ jobs: uses: actions/cache@v1 # not v2! with: path: ../Qt - key: ${{ runner.os }}-${{matrix.config.arch}}-QtCache-5.12-1 + key: ${{runner.os}}-${{matrix.config.arch}}-QtCache-${{matrix.config.qt}} - name: Install Qt Official Build - uses: jurplel/install-qt-action@v2 + uses: jurplel/install-qt-action@v3 with: version: ${{matrix.config.qt}} target: desktop arch: ${{matrix.config.arch}} - modules: qtwebengine - tools: tools_openssl_${{matrix.config.platform}},1.1.1-4,qt.tools.openssl.win_${{matrix.config.platform}} - cached: ${{ steps.cache-qt.outputs.cache-hit }} + modules: ${{matrix.config.qt_modules}} + tools: ${{matrix.config.qt_tools}} + cache: 'true' - name: Create Build Dir shell: bash run: mkdir build working-directory: ${{runner.workspace}} - - name: Clone OpenSSL + - name: Clone OpenSSL on 5.15 shell: bash + if: ${{startsWith(matrix.config.qt, '5.15')}} run: | git clone https://github.com/tamlok/openssl-utils.git openssl-utils.git --depth=1 working-directory: ${{runner.workspace}}/build + - name: Download JOM + uses: suisei-cn/actions-download-file@v1 + with: + url: http://download.qt.io/official_releases/jom/jom.zip + target: ${{runner.temp}}\ + + - name: Unzip JOM + run: | + 7z x jom.zip -ojom + working-directory: ${{runner.temp}} + - name: Configure and Build Project shell: cmd run: | qmake --version call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.config.platform}} qmake -r -spec win32-msvc CONFIG-=debug CONFIG+=release %GITHUB_WORKSPACE%\vnote.pro - nmake + ${{runner.temp}}\jom\jom working-directory: ${{runner.workspace}}/build - - name: Package Project + - name: Package Project 1 shell: cmd run: | qmake --version @@ -107,15 +111,28 @@ jobs: copy .\src\release\vnote_extra.rcc "%DISTRIB_PATH%\vnote_extra.rcc" copy .\libs\vtextedit\src\libs\syntax-highlighting\release\VSyntaxHighlighting.dll "%DISTRIB_PATH%\VSyntaxHighlighting.dll" copy .\libs\vtextedit\src\editor\release\VTextEdit.dll "%DISTRIB_PATH%\VTextEdit.dll" - rem set qt_dir=%Qt5_Dir:/=\% - rem for %%I in ("%qt_dir%\..\..") do set "qt_topdir=%%~fI" - rem set openssl_dir=%qt_topdir%\Tools\OpenSSL\Win_${{matrix.config.platform}}\bin - set openssl_dir=openssl-utils.git\1.1.1j\Win_${{matrix.config.platform}} - copy %openssl_dir%\lib*.dll "%DISTRIB_PATH%\" + copy "%GITHUB_WORKSPACE%\package\qt.conf" "%DISTRIB_PATH%\qt.conf" copy "%GITHUB_WORKSPACE%\README.md" "%DISTRIB_PATH%\README.md" copy "%GITHUB_WORKSPACE%\COPYING.LESSER" "%DISTRIB_PATH%\COPYING.LESSER" echo %GITHUB_SHA% > "%DISTRIB_PATH%\commit" del /F /Q "%DISTRIB_PATH%\translations\qt_*.qm" + working-directory: ${{runner.workspace}}/build + env: + DISTRIB_PATH: ${{runner.workspace}}/build/distrib/vnote + + - name: "Package Project: Copy OpenSSL on 5.15" + shell: cmd + if: ${{startsWith(matrix.config.qt, '5.15')}} + run: | + set openssl_dir=openssl-utils.git\1.1.1j\Win_${{matrix.config.platform}} + copy %openssl_dir%\lib*.dll "%DISTRIB_PATH%\" + working-directory: ${{runner.workspace}}/build + env: + DISTRIB_PATH: ${{runner.workspace}}/build/distrib/vnote + + - name: Package Project 2 + shell: cmd + run: | 7z a vnote-win-${{matrix.config.platform}}-qt${{matrix.config.qt}}.zip "%DISTRIB_PATH%" copy vnote-win-${{matrix.config.platform}}-qt${{matrix.config.qt}}.zip vnote-win-${{matrix.config.platform}}-qt${{matrix.config.qt}}_v${{env.VNOTE_VER}}.zip working-directory: ${{runner.workspace}}/build @@ -123,6 +140,7 @@ jobs: DISTRIB_PATH: ${{runner.workspace}}/build/distrib/vnote - name: Package Installer + if: ${{startsWith(matrix.config.qt, '6.')}} shell: cmd run: | copy "%GITHUB_WORKSPACE%\src\data\core\icons\vnote.ico" "%DISTRIB_PATH%\vnote.ico" @@ -143,6 +161,7 @@ jobs: DISTRIB_PATH: ${{runner.workspace}}/build/distrib/vnote - name: Archive Installer + if: ${{startsWith(matrix.config.qt, '6.')}} uses: actions/upload-artifact@v2 with: name: VNote-win-${{matrix.config.platform}}-qt${{matrix.config.qt}}_v${{env.VNOTE_VER}}.msi diff --git a/package/qt.conf b/package/qt.conf new file mode 100644 index 0000000000..367a59eeb6 --- /dev/null +++ b/package/qt.conf @@ -0,0 +1,2 @@ +[Platforms] +WindowsArguments = fontengine=freetype diff --git a/src/src.pro b/src/src.pro index 24548eb194..75ecc00209 100644 --- a/src/src.pro +++ b/src/src.pro @@ -79,8 +79,8 @@ win32 { rcc_binary.commands = $$shell_path($$[QT_HOST_BINS]/rcc.exe) -name ${QMAKE_FILE_IN_BASE} -binary ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} rcc_binary.depend_command = $$shell_path($$[QT_HOST_BINS]/rcc.exe) -list $$QMAKE_RESOURCE_FLAGS ${QMAKE_FILE_IN} } else { - rcc_binary.commands = $$[QT_HOST_BINS]/rcc -name ${QMAKE_FILE_IN_BASE} -binary ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} - rcc_binary.depend_command = $$[QT_HOST_BINS]/rcc -list $$QMAKE_RESOURCE_FLAGS ${QMAKE_FILE_IN} + rcc_binary.commands = $$[QT_HOST_LIBEXECS]/rcc -name ${QMAKE_FILE_IN_BASE} -binary ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} + rcc_binary.depend_command = $$[QT_HOST_LIBEXECS]/rcc -list $$QMAKE_RESOURCE_FLAGS ${QMAKE_FILE_IN} } rcc_binary.input = RCC_BINARY_SOURCES rcc_binary.output = $$SRC_DESTDIR/vnote_${QMAKE_FILE_IN_BASE}.rcc