ci-linux.yml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. name: CI-Linux
  2. on:
  3. push:
  4. branches: [ master ]
  5. pull_request:
  6. branches: [ master ]
  7. # Allows you to run this workflow manually from the Actions tab.
  8. workflow_dispatch:
  9. env:
  10. VNOTE_VER: 3.0.0
  11. jobs:
  12. build-linux:
  13. name: Build On Ubuntu
  14. runs-on: ubuntu-latest
  15. timeout-minutes: 120
  16. steps:
  17. # Checks-out your repository under $GITHUB_WORKSPACE.
  18. - uses: actions/checkout@v2
  19. with:
  20. fetch-depth: 1
  21. - name: Init Submodules
  22. shell: bash
  23. run: |
  24. auth_header="$(git config --local --get http.https://github.com/.extraheader)"
  25. git submodule sync --recursive
  26. git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
  27. - name: Install linuxdeploy
  28. uses: miurahr/install-linuxdeploy-action@v1
  29. with:
  30. plugins: qt appimage
  31. - name: Install dependencies
  32. run: |
  33. sudo DEBIAN_FRONTEND=noninteractive apt-get update
  34. sudo DEBIAN_FRONTEND=noninteractive apt-get install -y libfcitx-qt5-dev tree
  35. - name: Install Qt
  36. uses: jurplel/install-qt-action@v2
  37. with:
  38. version: 5.12.10
  39. target: desktop
  40. arch: ${{matrix.config.arch}}
  41. modules: qtwebchannel qtwebengine qtsvg qtlocation qttools qttranslations
  42. tools: tools_openssl_x64,1.1.1-4,qt.tools.openssl.gcc_64
  43. - name: Create Build Dir
  44. shell: bash
  45. run: mkdir build
  46. working-directory: ${{runner.workspace}}
  47. - name: Compile qt5ct
  48. shell: bash
  49. run: |
  50. wget -c https://excellmedia.dl.sourceforge.net/project/qt5ct/qt5ct-1.1.tar.bz2
  51. tar xf qt5ct-1.*.tar.bz2
  52. cd qt5ct-1.*/
  53. QT_SELECT=5 qmake
  54. make -j$(nproc) && sudo make install
  55. working-directory: ${{runner.workspace}}/build
  56. - name: Configure Project
  57. shell: bash
  58. run: |
  59. qmake -v
  60. cp /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so ./
  61. sudo chmod +rwx ./libfcitxplatforminputcontextplugin.so
  62. cp ./libfcitxplatforminputcontextplugin.so $Qt5_Dir/plugins/platforminputcontexts
  63. qmake CONFIG+=release -spec linux-g++-64 ${GITHUB_WORKSPACE}/vnote.pro
  64. working-directory: ${{runner.workspace}}/build
  65. - name: Build Project
  66. shell: bash
  67. run: make -j$(nproc)
  68. working-directory: ${{runner.workspace}}/build
  69. - name: Install Project
  70. shell: bash
  71. run: |
  72. mkdir AppDir
  73. make install INSTALL_ROOT=${{runner.workspace}}/build/AppDir
  74. tree AppDir
  75. working-directory: ${{runner.workspace}}/build
  76. - name: Package Project
  77. shell: bash
  78. run: |
  79. # Move the lib out to avoid duplication
  80. mv AppDir/usr/lib ./
  81. LD_LIBRARY_PATH=$PWD/lib:$LD_LIBRARY_PATH
  82. # copy translations
  83. mkdir -p AppDir/usr/translations
  84. cp $Qt5_Dir/translations/qt_zh_CN.qm AppDir/usr/translations
  85. # package qt5ct (EXTRA_QT_PLUGINS seems not work)
  86. # EXTRA_QT_PLUGINS="platformthemes/libqt5ct.so;styles/libqt5ct-style.so"
  87. mkdir -p AppDir/usr/plugins/platformthemes
  88. mkdir -p AppDir/usr/plugins/styles
  89. cp $Qt5_Dir/plugins/platformthemes/* AppDir/usr/plugins/platformthemes/
  90. cp $Qt5_Dir/plugins/styles/* AppDir/usr/plugins/styles/
  91. # package libssl.so and libcrypto.so
  92. Qt5_Tools=$Qt5_Dir/../../Tools
  93. 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
  94. mv VNote*.AppImage vnote-linux-x64_v${{env.VNOTE_VER}}.AppImage
  95. cp vnote-linux-x64_v${{env.VNOTE_VER}}.AppImage vnote-linux-x64.AppImage
  96. tree AppDir
  97. working-directory: ${{runner.workspace}}/build
  98. - name: Archive Artifacts
  99. uses: actions/upload-artifact@v2
  100. with:
  101. name: vnote-linux-x64_v${{env.VNOTE_VER}}
  102. path: ${{runner.workspace}}/build/vnote-linux-x64_v${{env.VNOTE_VER}}.AppImage
  103. - name: Update Tag
  104. if: github.ref == 'refs/heads/master'
  105. shell: bash
  106. run: |
  107. git tag --force continuous-build ${GITHUB_SHA}
  108. git push --force --tags
  109. - name: Update Continuous Build Release
  110. if: github.ref == 'refs/heads/master'
  111. uses: johnwbyrd/[email protected]
  112. with:
  113. token: ${{ secrets.GITHUB_TOKEN }}
  114. files: ${{runner.workspace}}/build/vnote-linux-x64.AppImage
  115. release: Continuous Build
  116. tag: continuous-build