jobs:
  - job: pypi
    pool:
      vmImage: ubuntu-18.04
    steps:
      - task: UsePythonVersion@0
        inputs:
          versionSpec: 3.8
          addToPath: true
        displayName: Install Python
      - script: |
          python -m pip install -U pip
          pip install poetry
        displayName: Prepare environment
      - script: |
          poetry build
        displayName: Build distribution

  - job: docker
    pool:
      vmImage: ubuntu-18.04
    steps:
      - task: Docker@2
        inputs:
          repository: adferrand/dnsrobocert
          command: build
        displayName: Build Docker image

jobs:
  - job: pypi
    pool:
      vmImage: ubuntu-18.04
    steps:
      - task: UsePythonVersion@0
        inputs:
          versionSpec: 3.8
          addToPath: true
        displayName: Install Python
      - script: |
          python -m pip install -U pip
          pip install poetry
        displayName: Prepare environment
      - script: |
          poetry build
        displayName: Build distribution

  - job: docker
    pool:
      vmImage: ubuntu-18.04
    steps:
      - script: |
          docker pull adferrand/dnsrobocert || true
          docker build --pull --cache-from adferrand/dnsrobocert -t adferrand/dnsrobocert .
        displayName: Build Docker image
      - script: |
          mkdir -p ./bin
          curl -fsSL https://goss.rocks/install | GOSS_DST=./bin sh
          GOSS_PATH=./bin/goss GOSS_SLEEP=5 GOSS_FILES_PATH=./tests ./bin/dgoss run adferrand/dnsrobocert
        displayName: Check Docker container runtime

Improve docker build and test
Improve docker build and test
