|
| 1 | +# Create AppImages on a github release event. This assumes that the |
| 2 | +# cadabra version is the same as the release name, and it will attempt |
| 3 | +# to add the .AppImage files to the release assets. |
| 4 | + |
| 5 | +name: AppImage |
| 6 | + |
| 7 | +on: [release] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: ubuntu-20.04 |
| 12 | + name: AppImage on ${{ matrix.arch }} |
| 13 | + |
| 14 | + strategy: |
| 15 | + fail-fast: false |
| 16 | + matrix: |
| 17 | + include: |
| 18 | + - arch: x86_64 |
| 19 | + distro: ubuntu20.04 |
| 20 | +# - arch: aarch64 |
| 21 | +# distro: ubuntu20.04 |
| 22 | + |
| 23 | + steps: |
| 24 | + - name: Setup GitHub CLI |
| 25 | + run: | |
| 26 | + sudo apt-get update |
| 27 | + sudo apt-get install -y gh |
| 28 | +
|
| 29 | + - name: Authenticate GitHub CLI |
| 30 | + run: gh auth setup-git |
| 31 | + env: |
| 32 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 33 | + |
| 34 | + - uses: actions/checkout@master |
| 35 | + name: Checkout source |
| 36 | + |
| 37 | + - name: Native build |
| 38 | + if: ${{ contains(matrix.arch, 'x86') }} |
| 39 | + id: build-native |
| 40 | + run: | |
| 41 | + sudo apt update -q -y |
| 42 | + sudo DEBIAN_FRONTEND=noninteractive apt install -y git cmake python3-dev python3-pip g++ libpcre3 libpcre3-dev libgmp3-dev libgtkmm-3.0-dev libboost-all-dev libgmp-dev libsqlite3-dev uuid-dev libmpfr-dev libmpc-dev && python3 --version && which python3 && python3 -m pip install --upgrade pip && python3 -m pip install wheel && python3 -m pip install sympy gmpy2 numpy |
| 43 | + mkdir build |
| 44 | + cd build |
| 45 | + cmake -DENABLE_MATHEMATICA=OFF -DAPPIMAGE_MODE=ON -DCMAKE_INSTALL_PREFIX=/usr .. |
| 46 | + make |
| 47 | + make install DESTDIR=AppDir |
| 48 | + make appimage |
| 49 | + mkdir -p ${{ github.workspace }}/artifacts |
| 50 | + cp Cadabra*.AppImage ${{ github.workspace }}/artifacts |
| 51 | +
|
| 52 | + - name: QEMU build ${{ matrix.arch }} |
| 53 | + if: ${{ !contains(matrix.arch, 'x86') }} |
| 54 | + uses: uraimo/run-on-arch-action@master |
| 55 | + id: build |
| 56 | + with: |
| 57 | + arch: ${{ matrix.arch }} |
| 58 | + distro: ${{ matrix.distro }} |
| 59 | + githubToken: ${{ github.token }} |
| 60 | + setup: | |
| 61 | + mkdir -p ${{ github.workspace }}/artifacts |
| 62 | +
|
| 63 | + dockerRunArgs: |
| 64 | + --volume "${{ github.workspace }}/artifacts:/artifacts" |
| 65 | + |
| 66 | + shell: /bin/sh |
| 67 | + |
| 68 | + install: | |
| 69 | + apt update -q -y |
| 70 | + DEBIAN_FRONTEND=noninteractive apt install -y git wget gpg |
| 71 | + # Get current cmake (we need at least 3.21 for linuxdeploy) |
| 72 | + wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null |
| 73 | + echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null |
| 74 | + apt update -y |
| 75 | + apt install -y kitware-archive-keyring |
| 76 | + apt install -y cmake |
| 77 | + apt upgrade -y |
| 78 | + cmake --version |
| 79 | + # Install the rest. |
| 80 | + DEBIAN_FRONTEND=noninteractive apt install -y git cmake python3-dev python3-pip g++ libpcre3 libpcre3-dev libgmp3-dev libgtkmm-3.0-dev libboost-all-dev libgmp-dev libsqlite3-dev uuid-dev libmpfr-dev libmpc-dev python3-gmpy2 && python3 --version && which python3 && python3 -m pip install --upgrade pip && python3 -m pip install wheel && python3 -m pip install sympy numpy |
| 81 | + DEBIAN_FRONTEND=noninteractive apt install -y cimg-dev libgtest-dev ca-certificates libgpgme-dev libssh-gcrypt-dev libcurl4-gnutls-dev patchelf squashfs-tools desktop-file-utils |
| 82 | + # Build appimagetool, linuxdeploy and linuxdeploy-plugin-appimage, as we |
| 83 | + # cannot run the linuxdeploy.AppImage inside QEMU. |
| 84 | + mkdir linuxdeploy |
| 85 | + cd linuxdeploy |
| 86 | + git clone https://github.com/AppImage/appimagetool.git --recurse-submodules |
| 87 | + git clone https://github.com/linuxdeploy/linuxdeploy.git --recurse-submodules |
| 88 | + git clone https://github.com/linuxdeploy/linuxdeploy-plugin-appimage.git --recurse-submodules |
| 89 | + (cd appimagetool && mkdir build && cd build && cmake .. && make install) |
| 90 | + (cd linuxdeploy && mkdir build && cd build && cmake -DBUILD_TESTING=OFF .. && make install) |
| 91 | + (cd linuxdeploy-plugin-appimage && mkdir build && cd build && cmake -DBUILD_TESTING=OFF .. && make install) |
| 92 | + |
| 93 | + run: | |
| 94 | + mkdir build |
| 95 | + cd build |
| 96 | + git config --global --add safe.directory /home/runner/work/cadabra2/cadabra2 |
| 97 | + cmake -DENABLE_MATHEMATICA=OFF -DAPPIMAGE_MODE=ON -DCMAKE_INSTALL_PREFIX=/usr .. |
| 98 | + make |
| 99 | + make install DESTDIR=AppDir |
| 100 | + make appimage |
| 101 | + cp Cadabra*.AppImage /artifacts |
| 102 | + |
| 103 | + - name: Set version variables from output of cmake |
| 104 | + run: | |
| 105 | + VER=$(cat ${{ github.workspace }}/build/VERSION) |
| 106 | + echo "VERSION=$VER" >> $GITHUB_ENV |
| 107 | +
|
| 108 | + - name: Upload release assets |
| 109 | + run: | |
| 110 | + ls ${{ github.workspace }}/artifacts/ |
| 111 | + gh release upload "${{ env.VERSION }}" ${{ github.workspace }}/artifacts/Cadabra_${{ env.VERSION }}_${{ matrix.arch }}.AppImage --clobber |
| 112 | + env: |
| 113 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 114 | + |
0 commit comments