image: debian:trixie

variables:
  DEBIAN_FRONTEND: noninteractive

stages:
  - install
  - test

install:
  stage: install
  before_script:
  - apt-get update && apt-get install --no-install-recommends -y python3 python3-virtualenv
  - ln -s /usr/bin/python3 /usr/bin/python
  script:
  - virtualenv --python=/usr/bin/python3 .
  - source bin/activate
  - pip3 install -r requirements.txt
  cache:
    key: $CI_COMMIT_REF_SLUG
    paths:
      - bin/
      - lib/
      - pyvenv.cfg

test_ppparis:
  stage: test
  needs: [install]
  before_script:
  - apt-get update && apt-get install --no-install-recommends -y python3 python3-virtualenv chromium-driver make xauth xvfb tesseract-ocr tesseract-ocr-eng tesseract-ocr-fra ocrmypdf
  - ln -s /usr/bin/python3 /usr/bin/python
  script:
  - source bin/activate
  - python ./ppparis.py
  only:
  - main
  cache:
    key: $CI_COMMIT_REF_SLUG
    paths:
      - data/ppparis/
  artifacts:
    paths:
    - data/ppparis/
    - output.log
    expire_in: 1 year
