version: 1

script:
  - rm -rf AppDir
  - mkdir AppDir
  - rm -rf appimage-build
  - git submodule update --recursive --remote --init
  - make download_data -C ..
  - make version -C ../sub/libpillowfight
  - make l10n_compile -C ../openpaperwork-core
  - make l10n_compile -C ../openpaperwork-gtk
  - make l10n_compile -C ../paperwork-backend
  - make l10n_compile -C ../paperwork-shell
  - make -C ../sub/libinsane clean
  - unset DESTDIR && make install PREFIX="$(pwd)/AppDir/usr" -C ../sub/libinsane
  - pip3 install --ignore-installed --prefix=/usr --root=AppDir
    ../sub/libpillowfight
    ../sub/pyocr
    ../openpaperwork-core
    ../openpaperwork-gtk
    ../paperwork-backend
    ../paperwork-shell
  - mkdir -p AppDir/usr/share/icons/hicolor/48x48
  - mkdir -p AppDir/usr/share/icons/hicolor/scalable
  - cp ../paperwork-gtk/src/paperwork_gtk/data/paperwork_48.png AppDir/usr/share/icons/hicolor/48x48/paperwork.png
  - cp ../paperwork-gtk/src/paperwork_gtk/data/paperwork_halo.svg AppDir/usr/share/icons/hicolor/scalable/paperwork.svg

AppDir:
  path: ./AppDir
  app_info:
    id: work.openpaper.Paperwork
    name: Paperwork-cli
    icon: paperwork
    version: latest
    exec: runtime/compat/usr/lib64/ld-linux-x86-64.so.2
    exec_args: "$APPDIR/usr/bin/python3 $APPDIR/usr/bin/paperwork-cli $@"
  apt:
    arch:
    - amd64
    allow_unauthenticated: true
    sources:
    - sourceline: deb http://deb.debian.org/debian/ testing main contrib
    include:
    - bash
    - coreutils
    - dash
    - gir1.2-pango-1.0
    - gir1.2-poppler-0.18
    - gobject-introspection
    - libexpat1
    - libgirepository1.0-dev
    - locales
    - python-is-python3
    - python3
    - python3-gi
    - python3-gi-cairo
    - python3-pip
    - python3-pkg-resources
    - sane
    - shared-mime-info
    - zlib1g
  files:
    include:
    - usr/lib/mime/**/*
    - usr/share/mime/**/*
    exclude:
    - usr/share/man
    - usr/share/doc/*/README.*
    - usr/share/doc/*/changelog.*
    - usr/share/doc/*/NEWS.*
    - usr/share/doc/*/TODO.*
    - usr/share/gtk-doc/**/*
  runtime:
    env:
      PYTHONHOME: '${APPDIR}/usr'
      PYTHONPATH: '${APPDIR}/usr/lib/python3.12/site-packages'
  test:
    fedora-30:
      image: appimagecrafters/tests-env:fedora-30
      command: ./AppRun
      use_host_x: true
    debian-stable:
      image: appimagecrafters/tests-env:debian-stable
      command: ./AppRun
      use_host_x: true
    archlinux-latest:
      image: appimagecrafters/tests-env:archlinux-latest
      command: ./AppRun
      use_host_x: true
    centos-7:
      image: appimagecrafters/tests-env:centos-7
      command: ./AppRun
      use_host_x: true
    ubuntu-xenial:
      image: appimagecrafters/tests-env:ubuntu-xenial
      command: ./AppRun
      use_host_x: true

AppImage:
  arch: x86_64
  update-information: guess
