---
.template: &template
  except:
    - deploy@ftp-team/dak

test bullseye:
  <<: *template
  image: debian:bullseye
  parallel: 3
  script: debian/run-ci --with-coverage
  artifacts:
    paths:
      - output

test bookworm:
  <<: *template
  image: debian:bookworm
  parallel: 3
  script: debian/run-ci --with-coverage
  artifacts:
    paths:
      - output
  allow_failure: true

flake8:
  <<: *template
  image: debian:bullseye
  script:
    - apt-get update
    - apt-get install -y flake8
    - flake8

get coverage:
  <<: *template
  image: debian:bullseye
  stage: coverage
  dependencies:
    - test bullseye
  script:
    - debian/run-coverage
  artifacts:
    paths:
      - coverage
      - logs

sphinx:
  image: debian:bookworm
  script:
    - apt-get update
    - apt-get install -y build-essential python3-sphinx
    - apt-get build-dep -y .
    - make -C docs html
  artifacts:
    paths:
      - docs/_build/html
  except:
    - deploy@ftp-team/dak

contributors:
  image: debian:bullseye
  stage: deploy
  dependencies: []
  script:
    - apt update && apt install -y git python3-debiancontributors
    - dc-tool --mine config/debian/contributor.patch --auth-token "@$DC_TOKEN" --source ftp.debian.org --post
  allow_failure: true
  only:
    - master@ftp-team/dak

pages:
  image: debian:buster
  script:
    - apt-get update
    - apt-get install -y python-epydoc
    - mkdir -p public/epydoc
    - epydoc -q --html --graph all --css white -n DAK -o public/epydoc --include-log --show-imports dak daklib dakweb
    - mv coverage public/coverage
    - mv docs/_build/html public/docs
  stage: deploy
  dependencies:
    - get coverage
    - sphinx
  artifacts:
    paths:
      - public
  only:
    - master

stages:
  - test
  - coverage
  - deploy
