image: debian/bookworm
packages:
  - qtbase5-dev
  - qttools5-dev
  - cmake
  - clang
  - libcurl4-openssl-dev
  - wget
  - fuse
  - file
  - libxcb1-dev
  - libxcb-res0-dev
  - libwayland-dev
  - pkg-config
  - libglib2.0-dev
  - desktop-file-utils
tasks:
  - build: |
      # build
      cd minori
      mkdir build
      cd build
      cmake .. -G "Unix Makefiles"
      make

      # resources
      mkdir -p rc
      cp ../rc/sys/linux/Minori.desktop rc/Minori.desktop
      cp ../rc/sys/linux/Minori.svg rc/Minori.svg

      # use linuxdeployqt to make an appimage
      wget -O linuxdeployqt "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
      chmod +x linuxdeployqt

      mkdir -p AppDir/usr/bin
      mkdir -p AppDir/usr/lib
      mkdir -p AppDir/usr/share/applications
      mkdir -p AppDir/usr/share/icons/hicolor/scalable/apps

      cp ../rc/sys/linux/Minori.svg AppDir/Minori.svg
      cp ../rc/sys/linux/Minori.desktop AppDir/usr/share/applications/Minori.desktop
      cp minori AppDir/usr/bin/minori

      # hack: need to ignore linuxdeployqt silently failing due to missing appimagetool.
      #       additionally, because of that we have to roll appimagetool ourselves
      ./linuxdeployqt AppDir/usr/share/applications/Minori.desktop -unsupported-allow-new-glibc -appimage || true

      # ack
      wget -O appimagetool "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage"
      chmod +x appimagetool

      ./appimagetool AppDir minori-x86_64.AppImage
artifacts:
  - minori/build/minori-x86_64.AppImage
triggers:
  - action: email
    condition: failure
    to: Paper <paper@paper.us.eu.org>
