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

test buster:
  <<: *template
  image: debian:buster
  parallel: 3
  script: debian/run-ci --with-coverage
  artifacts:
    expire_in: 1 day
    paths:
      - coverage
      - output

tests buster python3:
  <<: *template
  image: debian:buster
  parallel: 2
  script: debian/run-ci --python3
  artifacts:
    paths:
      - coverage
      - output

tests bullseye python3:
  <<: *template
  image: debian:bullseye
  parallel: 2
  script: debian/run-ci --python3
  artifacts:
    paths:
      - coverage
      - output
  allow_failure: true

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

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

contributors:
  image: debian:buster
  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
  stage: deploy
  dependencies:
    - get coverage
  artifacts:
    paths:
      - public
  only:
    - master

stages:
  - test
  - coverage
  - deploy
