pr:
  - master
  - release_*

pool:
  vmImage: 'ubuntu-20.04'

jobs:
  - job: runcheck
    steps:
      - bash: |
               sudo apt-get install -y pep8
               sudo apt-get install -y python3-pip
               sudo pip3 install --upgrade pip
               sudo pip3 install clang-format
               .github/runchecks
  - job: 
    dependsOn: runcheck
    strategy:
      matrix:
        "Ubuntu 20.04":
           OS_TYPE: "ubuntu:20.04"
           PKG_INSTALL_CMD: "apt-get -y update ; apt-get -y upgrade ; apt-get install -y python3"
           DOCKER_EXTRA_ARG: "-e DEBIAN_FRONTEND=noninteractive -e LANGUAGE=C.UTF-8 -e LANG=C.UTF-8 -e LC_ALL=C.UTF-8"
           CI_CMD: "./ci --local"
        "Rocky Linux 9 Sanitize":
           OS_TYPE: "rockylinux/rockylinux:9.2"
           PKG_INSTALL_CMD: "yum -y install python3"
           DOCKER_EXTRA_ARG: "-e BUILD_MODE=sanitize"
           CI_CMD: "./ci --local='sanitize'"
        "Rocky Linux 9 Kerberos":
           OS_TYPE: "rockylinux/rockylinux:9.2"
           PKG_INSTALL_CMD: "yum -y install python3"
           DOCKER_EXTRA_ARG: "-e BUILD_MODE=kerberos"
           CI_CMD: "./ci --local"
    steps:
    - script: |
             docker pull $(OS_TYPE)
             docker run -it $(DOCKER_EXTRA_ARG) -d -h pbs.dev.local --name pbsdev -v $(pwd):$(pwd) --privileged -w $(pwd) $(OS_TYPE) /bin/bash 
             docker exec pbsdev bash -c "$(PKG_INSTALL_CMD)"
             docker exec --privileged pbsdev bash -c "pwd ; cd ci ;$(CI_CMD)"
