|
| 1 | +name: Lemon build matrix - AppImage |
| 2 | + |
| 3 | +on: |
| 4 | + # push代码时触发workflow |
| 5 | + push: |
| 6 | + # 忽略README.md |
| 7 | + paths-ignore: |
| 8 | + - 'README.md' |
| 9 | + - 'LICENSE' |
| 10 | + - 'BUILD.md' |
| 11 | + # pull_request时触发workflow |
| 12 | + pull_request: |
| 13 | + # 忽略README.md |
| 14 | + paths-ignore: |
| 15 | + - 'README.md' |
| 16 | + - 'LICENSE' |
| 17 | + - 'BUILD.md' |
| 18 | + release: |
| 19 | + types: [published] |
| 20 | + |
| 21 | +jobs: |
| 22 | + check_commit_msg: |
| 23 | + outputs: |
| 24 | + commit_message: ${{ steps.get_message.outputs.message }} |
| 25 | + name: Check if the workflow has been disabled. |
| 26 | + runs-on: ubuntu-latest |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v2 |
| 29 | + - name: Get commit message |
| 30 | + id: get_message |
| 31 | + run: | |
| 32 | + echo "::set-output name=message::$(git log --format=%B -n 1 ${{ github.event.after }})" |
| 33 | + build: |
| 34 | + needs: check_commit_msg |
| 35 | + if: ${{ !contains( needs.check_commit_msg.outputs.commit_message, 'NO_MAIN') }} |
| 36 | + strategy: |
| 37 | + matrix: |
| 38 | + qt_version: [6.0.0] |
| 39 | + platform: [ubuntu-16.04] |
| 40 | + arch: [x64] |
| 41 | + fail-fast: false |
| 42 | + |
| 43 | + runs-on: ${{ matrix.platform }} |
| 44 | + steps: |
| 45 | + - name: Get the version |
| 46 | + id: get_version |
| 47 | + shell: bash |
| 48 | + run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) |
| 49 | + - name: Checking out sources |
| 50 | + uses: actions/checkout@v2 |
| 51 | + with: |
| 52 | + submodules: 'recursive' |
| 53 | + - name: Install Python 3.7 version |
| 54 | + uses: actions/setup-python@v2 |
| 55 | + with: |
| 56 | + python-version: '3.7' |
| 57 | + architecture: ${{ matrix.arch }} |
| 58 | + - name: Restoring submodules |
| 59 | + run: git submodule update --init |
| 60 | + - name: Cache Qt |
| 61 | + id: cache-qt |
| 62 | + uses: actions/cache@v1 |
| 63 | + with: |
| 64 | + path: ../Qt |
| 65 | + key: QtCache-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.qt_version }} |
| 66 | + - name: Installing Qt - ${{ matrix.arch }} |
| 67 | + uses: jurplel/install-qt-action@v2 |
| 68 | + with: |
| 69 | + version: ${{ matrix.qt_version }} |
| 70 | + arch: ${{ matrix.qtarch }} |
| 71 | + mirror: "http://mirrors.ocf.berkeley.edu/qt/" |
| 72 | + cached: ${{ steps.cache-qt.outputs.cache-hit }} |
| 73 | + - name: Linux - ${{ matrix.qt_version }} - Build preparation - Install Packages |
| 74 | + run: | |
| 75 | + sudo apt update |
| 76 | + sudo apt install -y build-essential ninja-build cmake pkgconf fcitx-frontend-qt5 libxcb-xinerama0 libgl-dev libx11-dev libxkbcommon-x11-dev libxcb-image0-dev libxcb-icccm4-dev libssl-dev libxcb-keysyms1 libxcb-render-util0 |
| 77 | + # ========================================================================================================= Generate MakeFile and Build |
| 78 | + - name: Linux - ${{ matrix.qt_version }} - Generate Dependencies and Build |
| 79 | + shell: bash |
| 80 | + env: |
| 81 | + CC: /usr/bin/gcc-7 |
| 82 | + CXX: /usr/bin/g++-7 |
| 83 | + run: | |
| 84 | + mkdir build |
| 85 | + cd build |
| 86 | + cmake .. -GNinja -DCMAKE_INSTALL_PREFIX=./AppDir/usr -DCMAKE_BUILD_TYPE=Release -DLEMON_BUILD_INFO="Build for AppImage" -DLEMON_BUILD_EXTRA_INFO="Build on $(uname -sr)" |
| 87 | + cmake --build . --parallel $(nproc) |
| 88 | + cmake --install . |
| 89 | + # ========================================================================================================= Deployments |
| 90 | + - name: Linux - ${{ matrix.qt_version }} - Generating AppImage |
| 91 | + run: | |
| 92 | + cd build |
| 93 | + wget https://github.com/probonopd/linuxdeployqt/releases/download/7/linuxdeployqt-7-x86_64.AppImage |
| 94 | + chmod +x ./linuxdeployqt-7-x86_64.AppImage |
| 95 | + cd AppDir |
| 96 | + wget -c https://github.com/darealshinji/AppImageKit-checkrt/releases/download/continuous/AppRun-patched-x86_64 -O AppRun |
| 97 | + chmod a+x AppRun |
| 98 | + mkdir -p ./usr/{lib,optional}/ |
| 99 | + wget -c https://github.com/darealshinji/AppImageKit-checkrt/releases/download/continuous/exec-x86_64.so -O ./usr/optional/exec.so |
| 100 | + mkdir -p ./usr/optional/libstdc++/ |
| 101 | + cp -fv /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ./usr/optional/libstdc++/ |
| 102 | + mkdir -p ./usr/optional/libgcc_s/ |
| 103 | + cp -fv /lib/x86_64-linux-gnu/libgcc_s.so.1 ./usr/optional/libgcc_s/ |
| 104 | + cp -fv /usr/lib/x86_64-linux-gnu/{libssl.so.1.1,libcrypto.so.1.1} ./usr/lib/ |
| 105 | + mkdir -p ./usr/plugins/platforminputcontexts/ |
| 106 | + cp -fv /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so ./usr/plugins/platforminputcontexts/ |
| 107 | + cd .. |
| 108 | + ./linuxdeployqt-7-x86_64.AppImage AppDir/usr/share/applications/lemon-lime.desktop -appimage -no-strip -always-overwrite -extra-plugins=iconengines,imageformats,platforminputcontexts |
| 109 | + mv ./Lemon*.AppImage ./Lemon.AppImage |
| 110 | + - name: Linux - ${{ matrix.qt_version }} - Uploading artifact |
| 111 | + uses: actions/upload-artifact@v2 |
| 112 | + with: |
| 113 | + name: Lemon-${{ github.sha }}.linux-${{ matrix.arch }}.qt${{ matrix.qt_version }}.AppImage |
| 114 | + path: build/Lemon.AppImage |
| 115 | + - name: Linux - ${{ matrix.qt_version }} - Upload binaries to release |
| 116 | + uses: svenstaro/upload-release-action@v1-release |
| 117 | + if: github.event_name == 'release' && matrix.platform == 'ubuntu-16.04' && matrix.qt_version == '5.15.0' |
| 118 | + with: |
| 119 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 120 | + file: build/Lemon.AppImage |
| 121 | + asset_name: Lemon.${{ steps.get_version.outputs.VERSION }}.linux-qt6-${{ matrix.arch }}.AppImage |
| 122 | + tag: ${{ github.ref }} |
| 123 | + overwrite: true |
0 commit comments