
################################################################################
# We use Azure to run the full tests suites on Pythons 3.6 and above.
# on Windows, macOS and Linux (various distro) only on 64 bits
################################################################################

jobs:

################################################################################
# These jobs are using VMs and Azure-provided Pythons 3.6
################################################################################

    - template: etc/ci/azure-linux.yml
      parameters:
          job_name: vm_ubuntu16_py36
          image_name: ubuntu-16.04
          python_versions: ['3.6']
          test_suites:
              misc: |
                bin/pytest -n 3 -vvs --test-suite=all \
                  --ignore=tests/scancode \
                  --ignore=tests/cluecode \
                  --ignore=tests/licensedcode

              scancode: |
                bin/pytest -vvs --test-suite=all \
                  tests/scancode

              cluecode: |
                bin/pytest -n 3 -vvs --test-suite=all \
                  tests/cluecode \
                  --cov=src --cov-report=term

              license_base: |
                bin/pytest -n 3 -vvs --test-suite=all \
                  --ignore=tests/licensedcode/test_zzzz_cache.py \
                  --ignore=tests/licensedcode/test_detection_datadriven_external.py \
                  --ignore=tests/licensedcode/test_detection_datadriven1.py \
                  --ignore=tests/licensedcode/test_detection_datadriven2.py \
                  --ignore=tests/licensedcode/test_detection_datadriven3.py \
                  --ignore=tests/licensedcode/test_detection_datadriven4.py \
                  tests/licensedcode

              license_datadriven1: |
                bin/pytest -n 3 -vvs --test-suite=all \
                  tests/licensedcode/test_detection_datadriven1.py

              license_datadriven2: |
                bin/pytest -n 3 -vvs --test-suite=all \
                  tests/licensedcode/test_detection_datadriven2.py

              license_datadriven3: |
                bin/pytest -n 3 -vvs --test-suite=all \
                  tests/licensedcode/test_detection_datadriven3.py

              license_datadriven4: |
                bin/pytest -n 3 -vvs --test-suite=all \
                  tests/licensedcode/test_detection_datadriven4.py

              license_datadriven_ext: |
                bin/pytest -n 3 -vvs --test-suite=all \
                  tests/licensedcode/test_detection_datadriven_external.py

              license_validate1: |
                bin/pytest -n 3 -vvs --test-suite=validate \
                  tests/licensedcode/test_detection_validate.py \
                  -k TestValidateLicenseBasic

              license_validate2: |
                bin/pytest -n 3 -vvs --test-suite=validate \
                  tests/licensedcode/test_detection_validate.py \
                  -k TestValidateLicenseExtended

              license_cache: |
                bin/pytest -n 3 -vvs --test-suite=all \
                  tests/licensedcode/test_zzzz_cache.py

    - template: etc/ci/azure-mac.yml
      parameters:
          job_name: macos_1014_py3x
          image_name: macos-10.14
          python_versions: ['3.6', '3.7', '3.8', '3.9']
          test_suites:
              all: bin/pytest -n 2 -vvs tests/scancode/test_cli.py


    - template: etc/ci/azure-mac.yml
      parameters:
          job_name: macos_1015_py3x
          image_name: macos-10.15
          python_versions: ['3.6', '3.7', '3.8', '3.9']
          test_suites:
              all: bin/pytest -n 2 -vvs tests/scancode/test_cli.py


#    - template: etc/ci/azure-mac.yml
#      parameters:
#          job_name: macos_110_py3x
#          image_name: macos-11.0
#          python_versions: ['3.6', '3.7', '3.8', '3.9']
#          test_suites:
#              all: bin/pytest -n 2 -vvs tests/scancode/test_cli.py


    - template: etc/ci/azure-win.yml
      parameters:
          job_name: win_2016_py3x
          image_name: vs2017-win2016
          python_versions: ['3.6', '3.7', '3.8', '3.9']
          python_architecture: x64
          test_suites:
              all: Scripts\pytest -n 2 -vvs tests\scancode\test_cli.py


    - template: etc/ci/azure-win.yml
      parameters:
          job_name: win_2019_py3x
          image_name: windows-2019
          python_versions: ['3.6', '3.7', '3.8', '3.9']
          python_architecture: x64
          test_suites:
              all: Scripts\pytest -n 2 -vvs tests\scancode\test_cli.py


    - template: etc/ci/azure-linux.yml
      parameters:
          job_name: vm_ubuntu16_py3x
          image_name: ubuntu-16.04
          python_versions: ['3.7', '3.8', '3.9']
          test_suites:
              all: bin/pytest -n 2 -vvs tests/scancode/test_cli.py


    - template: etc/ci/azure-linux.yml
      parameters:
          job_name: vm_ubuntu18_py3x
          image_name: ubuntu-18.04
          python_versions: ['3.6', '3.7', '3.8', '3.9']
          test_suites:
              all: bin/pytest -n 2 -vvs tests/scancode/test_cli.py


    - template: etc/ci/azure-linux.yml
      parameters:
          job_name: vm_ubuntu20_py3x
          image_name: ubuntu-20.04
          python_versions: ['3.6', '3.7', '3.8', '3.9']
          test_suites:
              all: bin/pytest -n 2 -vvs tests/scancode/test_cli.py


################################################################################
# These jobs are using containers and their own Python 3.6
################################################################################

#    - template: etc/ci/azure-container-deb.yml
#      parameters:
#          job_name: ubuntu18_py36
#          container: ubuntu:bionic
#          python_path: python3.6
#          python_version: '3.6'
#          install_python: sudo apt-get install -y python3.6 python3.6-venv python3.6-dev
#          test_suite_label: all
#          test_suite: bin/pytest -n 3 -vvs tests/scancode


#    - template: etc/ci/azure-container-deb.yml
#      parameters:
#          job_name: ubuntu20_py38
#          container: ubuntu:focal
#          python_path: python3.8
#          python_version: '3.8'
#          install_python: sudo apt-get install -y python3.8 python3.8-venv python3.8-dev
#          test_suite_label: all
#          test_suite: bin/pytest -n 3 -vvs tests/scancode


#    - template: etc/ci/azure-container-rpm.yml
#      parameters:
#          job_name: centos7_py36
#          container: centos:7
#          python_path: python3.6
#          python_version: '3.6'
#          install_python: |
#              set -e -x
#              sudo yum install -y epel-release
#              sudo yum install -y python36 python36-devel python36-virtualenv
#          test_suite_label: all
#          test_suite: bin/pytest -n 2 -vvs
#
#    - template: etc/ci/azure-container-rpm.yml
#      parameters:
#          job_name: manylinux1_py36
#          container: quay.io/pypa/manylinux1_x86_64:latest
#          python_path: /opt/python/cp36-cp36m/bin/python
#          python_version: '3.6'
#          install_packages: echo "No extra packages for now"
#          install_python: echo "Python is pre-installed"
#          test_suite_label: all
#          test_suite: bin/pytest -n 2 -vvs
#
#    - template: etc/ci/azure-container-rpm.yml
#      parameters:
#          job_name: manylinux2010_py36
#          container: quay.io/pypa/manylinux2010_x86_64:latest
#          python_path: /opt/python/cp36-cp36m/bin/python
#          python_version: '3.6'
#          install_packages: echo "No extra packages for now"
#          install_python: echo "Python is pre-installed"
#          test_suite_label: all
#          test_suite: bin/pytest -n 2 -vvs


################################################################################
# These jobs are using containers and their own Python 3.7
################################################################################

#    - template: etc/ci/azure-container-rpm.yml
#      parameters:
#          job_name: fedora30_py37
#          container: fedora:30
#          package_manager: dnf
#          python_path: python3.7
#          python_version: '3.7'
#          install_python: |
#              set -e -x
#              sudo dnf install -y python3 python3-devel python3-virtualenv
#          test_suite_label: all
#          test_suite: bin/pytest -n 2 -vvs
#
#    - template: etc/ci/azure-container-rpm.yml
#      parameters:
#          job_name: manylinux2010_py37
#          container: quay.io/pypa/manylinux2010_x86_64:latest
#          python_path: /opt/python/cp37-cp37m/bin/python
#          python_version: '3.7'
#          install_packages: echo "No extra packages for now"
#          install_python: echo "Python is pre-installed"
#          test_suite_label: all
#          test_suite: bin/pytest -n 2 -vvs


################################################################################
# These jobs are using containers and their own Python 3.6: FAILING FOR NOW
################################################################################

# here we build from sources
#    - template: etc/ci/azure-container-deb.yml
#      parameters:
#          job_name: debian9_py36
#          container: debian:stretch
#          python_path: python3.6
#          python_version: '3.6'
#          install_python: |
#            set -e -x
#            sudo apt-get install -y \
#                libncurses5-dev libncursesw5-dev libreadline6-dev \
#                libdb-dev libgdbm-dev libsqlite3-dev libssl-dev \
#                libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev \
#                libcurl4-openssl-dev libpam0g-dev \
#                libsqlite3-dev tk-dev libffi-dev \
#                curl
#            export PYVER=3.6.8
#            curl -o Python-$PYVER.tgz https://www.python.org/ftp/python/$PYVER/Python-$PYVER.tgz
#            tar -xvf Python-$PYVER.tgz
#            cd Python-$PYVER
#            ./configure --enable-optimizations
#            make -j8
#            sudo make altinstall
#          test_suite_label: basic tests
#          test_suite: bin/pytest -n 2 -vvs


########################################################################
# RELEASE on 3.6. Also check that we can pip install
########################################################################
#
#    - job: Build_release_archive_py3
#      pool:
#          vmImage: ubuntu-16.04
#      steps:
#          - checkout: self
#            fetchDepth: 10
#
#          - task: UsePythonVersion@0
#            inputs:
#                versionSpec: '3.6'
#            displayName: 'Install Python 3.6'
#
#          - script: ./etc/release/scancode-test-pip-install.sh
#            displayName: 'Test pip wheel installation'
#
#          - script: ./etc/release/scancode-test-pip-install-editable.sh
#            displayName: 'Test pip editable installation'


