try fix win ci #683
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.17.0 | |
jobs: | |
build-linux: | |
name: Build On Ubuntu | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 120 | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE. | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 1 | |
- name: Init Submodules | |
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: Cache Qt | |
id: cache-qt | |
uses: actions/cache@v1 # not v2! | |
with: | |
path: ../Qt | |
key: ${{ runner.os }}-QtCache-5.15 | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v2 | |
with: | |
version: 5.15.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 }} | |
- name: Create Build Dir | |
run: mkdir build | |
working-directory: ${{runner.workspace}} | |
- name: Compile qt5ct | |
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 | |
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 | |
qmake CONFIG+=release -spec linux-g++-64 ${GITHUB_WORKSPACE}/vnote.pro | |
working-directory: ${{runner.workspace}}/build | |
- name: Build Project | |
run: make -j$(nproc) | |
working-directory: ${{runner.workspace}}/build | |
- name: Install Project | |
run: | | |
mkdir AppDir | |
make install INSTALL_ROOT=${{runner.workspace}}/build/AppDir | |
tree AppDir | |
working-directory: ${{runner.workspace}}/build | |
- name: Package Project | |
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 | |
tree AppDir | |
working-directory: ${{runner.workspace}}/build | |
- name: Fix Package | |
run: | | |
mkdir fixpackage | |
mv VNote*.AppImage ./fixpackage | |
pushd fixpackage | |
# Extract the AppImage | |
./VNote*.AppImage --appimage-extract | |
# Remove libnss3.so and libnssutil3.so | |
rm ./squashfs-root/usr/lib/libnss*.so | |
# Re-package | |
rm VNote*.AppImage | |
linuxdeploy-plugin-appimage-x86_64.AppImage --appdir=./squashfs-root | |
mv VNote*.AppImage ../ | |
popd | |
mv VNote*.AppImage vnote-linux-x64_v${{env.VNOTE_VER}}.AppImage | |
cp vnote-linux-x64_v${{env.VNOTE_VER}}.AppImage vnote-linux-x64.AppImage | |
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 Tag | |
if: github.ref == 'refs/heads/master' | |
run: | | |
git tag --force continuous-build ${GITHUB_SHA} | |
git push --force --tags | |
- name: Update Continuous Build Release | |
if: github.ref == 'refs/heads/master' | |
uses: johnwbyrd/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: ${{runner.workspace}}/build/vnote-linux-x64.AppImage | |
release: Continuous Build | |
tag: continuous-build | |
- name: Release | |
if: github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, '[Release]') | |
uses: ncipollo/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
artifacts: ${{runner.workspace}}/build/vnote-linux-x64_v${{env.VNOTE_VER}}.AppImage | |
commit: master | |
tag: v${{env.VNOTE_VER}} | |
allowUpdates: true | |
draft: true |