Skip to content

Commit

Permalink
try fix win ci (#2434)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
tamlok committed Oct 8, 2023
1 parent 75f7250 commit 15d1435
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 52 deletions.
39 changes: 19 additions & 20 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
79 changes: 49 additions & 30 deletions .github/workflows/ci-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -107,22 +111,36 @@ 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
env:
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"
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions package/qt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Platforms]
WindowsArguments = fontengine=freetype
4 changes: 2 additions & 2 deletions src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 15d1435

Please sign in to comment.