shun-iwasawa 9f7051
name: Linux Build
Tact Yoshida c4f691
Tact Yoshida c4f691
on: [push, pull_request]
Tact Yoshida c4f691
Tact Yoshida c4f691
jobs:
Tact Yoshida c4f691
  Ubuntu:
shun-iwasawa 5cdfa5
    runs-on: ubuntu-20.04
Tact Yoshida c4f691
    strategy:
Tact Yoshida c4f691
      matrix:
Tact Yoshida c4f691
        compiler: [gcc, clang]
Tact Yoshida c4f691
        include:
Tact Yoshida c4f691
          - compiler: gcc
Tact Yoshida c4f691
            cc: gcc
Tact Yoshida c4f691
            cxx: g++
Tact Yoshida c4f691
          - compiler: clang
Tact Yoshida c4f691
            cc: clang
Tact Yoshida c4f691
            cxx: clang++
Tact Yoshida c4f691
    steps:
Tact Yoshida c4f691
    - uses: actions/checkout@v2
Tact Yoshida c4f691
    - name: Install libraries
Tact Yoshida c4f691
      run: |
Tact Yoshida c125fb
        sudo apt-get update
shun-iwasawa 9ab557
        sudo apt-get install build-essential cmake pkg-config ninja-build ccache libboost-all-dev qt5-default qtbase5-dev libqt5svg5-dev qtscript5-dev qttools5-dev qttools5-dev-tools libqt5opengl5-dev qtmultimedia5-dev libqt5multimedia5-plugins libqt5serialport5-dev libsuperlu-dev liblz4-dev libusb-1.0-0-dev liblzo2-dev libpng-dev libjpeg-dev libglew-dev freeglut3-dev libfreetype6-dev libjson-c-dev qtwayland5 libmypaint-dev libopencv-dev libturbojpeg-dev libomp-11-dev
Tact Yoshida c4f691
Tact Yoshida c4f691
    - uses: actions/cache@v1
Tact Yoshida c4f691
      with:
Tact Yoshida c4f691
        path: /home/runner/.ccache
Tact Yoshida c4f691
        key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
Tact Yoshida c4f691
        restore-keys: ${{ runner.os }}-${{ matrix.compiler }}-
Tact Yoshida c4f691
Tact Yoshida c4f691
    - name: Build libtiff
Tact Yoshida c4f691
      run: |
Tact Yoshida c4f691
        cd thirdparty/tiff-4.0.3
Tact Yoshida c4f691
        CFLAGS='-fPIC' CXXFLAGS='-fPIC' ./configure --disable-jbig
Tact Yoshida c4f691
        make -j $(nproc)
Tact Yoshida c4f691
Tact Yoshida c4f691
    - name: Build
Tact Yoshida c4f691
      run: |
Tact Yoshida c4f691
        cd toonz
Tact Yoshida c4f691
        mkdir build
Tact Yoshida c4f691
        cd build
shun-iwasawa 5cdfa5
        cmake ../sources -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} -DCMAKE_C_COMPILER=${{ matrix.cc }} -DWITH_TRANSLATION=OFF
Tact Yoshida c4f691
        ninja
Tact Yoshida c4f691
Tact Yoshida c125fb
    - name: Create Artifact
Tact Yoshida c125fb
      run: |
Tact Yoshida c125fb
        cd toonz/build
Tact Yoshida c125fb
        sudo ninja install
Tact Yoshida c125fb
Tact Yoshida c125fb
        mkdir -p appdir/usr
Tact Yoshida c125fb
        cp -r /opt/opentoonz/* appdir/usr
Tact Yoshida c125fb
        cp appdir/usr/share/applications/*.desktop appdir
Tact Yoshida c125fb
        cp appdir/usr/share/icons/hicolor/*/apps/*.png appdir
Tact Yoshida c125fb
Tact Yoshida 5cb3d1
        mkdir artifact
Tact Yoshida 5cb3d1
        mv appdir/usr/share/opentoonz/stuff artifact/portablestuff
Tact Yoshida c125fb
        rmdir appdir/usr/share/opentoonz
Tact Yoshida c125fb
Tact Yoshida c125fb
        wget -q -c 'https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage'
Tact Yoshida c125fb
        wget -q -c 'https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage'
Tact Yoshida c125fb
        wget -q -c 'https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage'
Tact Yoshida c125fb
        chmod 755 linuxdeploy-x86_64.AppImage
Tact Yoshida c125fb
        chmod 755 linuxdeploy-plugin-qt-x86_64.AppImage
Tact Yoshida c125fb
        chmod 755 linuxdeploy-plugin-appimage-x86_64.AppImage
Tact Yoshida c125fb
Tact Yoshida c125fb
        cat << EOF > apprun.sh
Tact Yoshida c125fb
        #!/usr/bin/env bash
Tact Yoshida c125fb
        exec "\${APPDIR}/usr/bin/OpenToonz"
Tact Yoshida c125fb
        EOF
Tact Yoshida c125fb
        chmod 755 apprun.sh
Tact Yoshida c125fb
Tact Yoshida c125fb
        export LD_LIBRARY_PATH='appdir/usr/lib/opentoonz'
Tact Yoshida c125fb
        ./linuxdeploy-x86_64.AppImage --appdir=appdir --plugin=qt --output=appimage --custom-apprun=apprun.sh \
Tact Yoshida c125fb
        --executable=appdir/usr/bin/lzocompress \
Tact Yoshida c125fb
        --executable=appdir/usr/bin/lzodecompress \
Tact Yoshida c125fb
        --executable=appdir/usr/bin/tcleanup \
Tact Yoshida c125fb
        --executable=appdir/usr/bin/tcomposer \
Tact Yoshida c125fb
        --executable=appdir/usr/bin/tconverter \
Tact Yoshida c125fb
        --executable=appdir/usr/bin/tfarmcontroller \
Tact Yoshida c125fb
        --executable=appdir/usr/bin/tfarmserver
Tact Yoshida 5cb3d1
        mv OpenToonz*.AppImage artifact/OpenToonz.AppImage
Tact Yoshida 5cb3d1
        ARTIFACT_NAME=Opentoonz-${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
Tact Yoshida 5cb3d1
        mv artifact ${ARTIFACT_NAME}
Tact Yoshida 5cb3d1
        tar zcf ${ARTIFACT_NAME}.tar.gz ${ARTIFACT_NAME}
Tact Yoshida c125fb
Tact Yoshida c125fb
    - uses: actions/upload-artifact@v1
Tact Yoshida c125fb
      with:
Tact Yoshida c125fb
        name: Opentoonz-${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
Tact Yoshida 5cb3d1
        path: toonz/build/Opentoonz-${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}.tar.gz