# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.

trigger:
  - main
  - release/*

pool:
  name: SuperBench CI
  vmImage: ubuntu-latest

container:
  image: nvcr.io/nvidia/pytorch:20.12-py3
  options: '-v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker'

steps:
  - script: |
      echo "##vso[task.prependpath]$HOME/.local/bin"
    displayName: Export path
  - script: |
      python3 -m pip install .[test,nvidia,torch,ort]
      make postinstall
    displayName: Install dependencies
  - script: |
      python3 setup.py lint
    displayName: Run code lint
  - script: |
      SB_MICRO_PATH=$PWD make cppbuild
    displayName: Build benchmarks
  - script: |
      SB_MICRO_PATH=$PWD python3 setup.py test
    displayName: Run unit tests
    timeoutInMinutes: 15
  - script: |
      bash <(curl -s https://codecov.io/bash) -cF cuda-unit-test
    displayName: Report coverage results
    env:
      CODECOV_TOKEN: $(codecovToken)
