CI on Linux and Win (#1582)

This commit is contained in:
Le Tan 2020-12-05 19:25:12 +08:00 committed by GitHub
parent d4e0763705
commit 13af4b2ed1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 204 additions and 7 deletions

127
.github/workflows/ci-linux.yml vendored Normal file
View File

@ -0,0 +1,127 @@
name: CI-Linux
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab.
workflow_dispatch:
env:
VNOTE_VER: 3.0.0
jobs:
build-linux:
name: Build On Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
# Checks-out your repository under $GITHUB_WORKSPACE.
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Init Submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Install linuxdeploy
uses: miurahr/install-linuxdeploy-action@v1
with:
plugins: qt appimage
- name: Install dependencies
run: |
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y libfcitx-qt5-dev tree
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: 5.12.10
target: desktop
arch: ${{matrix.config.arch}}
modules: qtwebchannel qtwebengine qtsvg qtlocation qttools qttranslations
tools: tools_openssl_x64,1.1.1-4,qt.tools.openssl.gcc_64
- name: Create Build Dir
shell: bash
run: mkdir build
working-directory: ${{runner.workspace}}
- name: Compile qt5ct
shell: bash
run: |
wget -c https://excellmedia.dl.sourceforge.net/project/qt5ct/qt5ct-1.1.tar.bz2
tar xf qt5ct-1.*.tar.bz2
cd qt5ct-1.*/
QT_SELECT=5 qmake
make -j$(nproc) && sudo make install
working-directory: ${{runner.workspace}}/build
- name: Configure Project
shell: bash
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
qmake CONFIG+=release -spec linux-g++-64 ${GITHUB_WORKSPACE}/vnote.pro
working-directory: ${{runner.workspace}}/build
- name: Build Project
shell: bash
run: make -j$(nproc)
working-directory: ${{runner.workspace}}/build
- name: Install Project
shell: bash
run: |
mkdir AppDir
make install INSTALL_ROOT=${{runner.workspace}}/build/AppDir
tree AppDir
working-directory: ${{runner.workspace}}/build
- name: Package Project
shell: bash
run: |
# Move the lib out to avoid duplication
mv AppDir/usr/lib ./
LD_LIBRARY_PATH=$PWD/lib:$LD_LIBRARY_PATH
# copy translations
mkdir -p AppDir/usr/translations
cp $Qt5_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/
# 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
mv VNote*.AppImage vnote-linux-x64_v${{env.VNOTE_VER}}.AppImage
cp vnote-linux-x64_v${{env.VNOTE_VER}}.AppImage vnote-linux-x64.AppImage
tree AppDir
working-directory: ${{runner.workspace}}/build
- name: Archive Artifacts
uses: actions/upload-artifact@v2
with:
name: vnote-linux-x64_v${{env.VNOTE_VER}}
path: ${{runner.workspace}}/build/vnote-linux-x64_v${{env.VNOTE_VER}}.AppImage
- name: Update Continuous Build Release
if: github.ref == 'refs/heads/master'
uses: johnwbyrd/update-release@v1.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: ${{runner.workspace}}/build/vnote-linux-x64.AppImage
release: Continuous Build
tag: continuous-build

View File

@ -81,7 +81,7 @@ jobs:
windeployqt.exe --dir "%DISTRIB_PATH%" .\src\release\vnote.exe
copy .\src\release\vnote.exe "%DISTRIB_PATH%\vnote.exe"
copy .\src\release\extra.rcc "%DISTRIB_PATH%\extra.rcc"
copy .\libs\vtextedit\src\libs\syntax-highlighting\release\KSyntaxHighlighting.dll "%DISTRIB_PATH%\KSyntaxHighlighting.dll"
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"
@ -92,6 +92,7 @@ jobs:
copy "%GITHUB_WORKSPACE%\COPYING.LESSER" "%DISTRIB_PATH%\COPYING.LESSER"
echo %GITHUB_SHA% > "%DISTRIB_PATH%\commit"
del /F /Q "%DISTRIB_PATH%\translations\qt_*.qm"
7z a vnote-win-${{matrix.config.platform}}.zip "%DISTRIB_PATH%"
working-directory: ${{runner.workspace}}/build
env:
DISTRIB_PATH: ${{runner.workspace}}/build/distrib/vnote
@ -103,3 +104,12 @@ jobs:
path: ${{env.DISTRIB_PATH}}
env:
DISTRIB_PATH: ${{runner.workspace}}/build/distrib/vnote
- name: Update Continuous Build Release
if: github.ref == 'refs/heads/master'
uses: johnwbyrd/update-release@v1.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: ${{runner.workspace}}/build/vnote-win-${{matrix.config.platform}}.zip
release: Continuous Build
tag: continuous-build

@ -1 +1 @@
Subproject commit 1dacef91657e44b110218a377a27a10bfd762616
Subproject commit 00aa03be1fee3bd661e88d0250af8a3db33c73b3

View File

@ -158,7 +158,8 @@ void ConfigMgr::checkAppConfig()
// Load extra data.
splash->showMessage("Loading extra resource data");
const QString extraRcc(QStringLiteral("extra.rcc"));
const QString extraRcc(PathUtils::concatenateFilePath(QCoreApplication::applicationDirPath(),
QStringLiteral("vnote_extra.rcc")));
bool ret = QResource::registerResource(extraRcc);
if (!ret) {
Exception::throwOne(Exception::Type::FailToReadFile,

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 805 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,13 @@
[Desktop Entry]
Type=Application
Name=VNote
Name[zh]=VNote
GenericName=Note-taking Application
GenericName[zh]=
Comment=A pleasant note-taking platform
Comment[zh]=
Icon=vnote
Terminal=false
Exec=vnote %F
MimeType=text/markdown;
Categories=Qt;Utility;TextEditor;Office;

View File

@ -13,11 +13,11 @@ TARGET = vnote
TEMPLATE = app
win32:CONFIG(release, debug|release) {
DESTDIR = $$OUT_PWD/release
SRC_DESTDIR = $$OUT_PWD/release
} else:win32:CONFIG(debug, debug|release) {
DESTDIR = $$OUT_PWD/debug
SRC_DESTDIR = $$OUT_PWD/debug
} else {
DESTDIR = $$OUT_PWD
SRC_DESTDIR = $$OUT_PWD
}
RC_ICONS = data/core/icons/vnote.ico
@ -53,8 +53,52 @@ win32 {
rcc_binary.depend_command = $$[QT_HOST_BINS]/rcc -list $$QMAKE_RESOURCE_FLAGS ${QMAKE_FILE_IN}
}
rcc_binary.input = RCC_BINARY_SOURCES
rcc_binary.output = $$DESTDIR/${QMAKE_FILE_IN_BASE}.rcc
rcc_binary.output = $$SRC_DESTDIR/vnote_${QMAKE_FILE_IN_BASE}.rcc
rcc_binary.CONFIG += no_link target_predeps
QMAKE_EXTRA_COMPILERS += rcc_binary
OTHER_FILES += $$RCC_BINARY_SOURCES
## INSTALLS
unix:!macx {
isEmpty(PREFIX): PREFIX = /usr
DATADIR = $${PREFIX}/share
BINDIR = $${PREFIX}/bin
LIBDIR = $${PREFIX}/lib
INCLUDEDIR = $${PREFIX}/include
# install desktop file
desktop.path = $${DATADIR}/applications
desktop.files += data/core/vnote.desktop
# install icons
icon16.path = $${DATADIR}/icons/hicolor/16x16/apps
icon16.files = data/core/logo/16x16/vnote.png
icon32.path = $${DATADIR}/icons/hicolor/32x32/apps
icon32.files = data/core/logo/32x32/vnote.png
icon48.path = $${DATADIR}/icons/hicolor/48x48/apps
icon48.files = data/core/logo/48x48/vnote.png
icon64.path = $${DATADIR}/icons/hicolor/64x64/apps
icon64.files = data/core/logo/64x64/vnote.png
icon128.path = $${DATADIR}/icons/hicolor/128x128/apps
icon128.files = data/core/logo/128x128/vnote.png
icon256.path = $${DATADIR}/icons/hicolor/256x256/apps
icon256.files = data/core/logo/256x256/vnote.png
iconsvg.path = $${DATADIR}/icons/hicolor/scalable/apps
iconsvg.files = data/core/logo/vnote.svg
target.path = $${BINDIR}
extraresource.path = $${BINDIR}
extraresource.extra = cp $${SRC_DESTDIR}/vnote_extra.rcc $(INSTALL_ROOT)$${BINDIR}/vnote_extra.rcc
INSTALLS += target desktop icon16 icon32 icon48 icon64 icon128 icon256 iconsvg
INSTALLS += extraresource
message("VNote will be installed in prefix $${PREFIX}")
}

View File

@ -6,3 +6,5 @@ QT += core gui widgets network svg webenginewidgets webchannel
QT += testlib
CONFIG += c++14 testcase
CONFIG += no_testcase_installs