# PyTorch Nightly PyTorch Tests Builds Pipeline on Azure DevOps
#
# This pipeline runs custom PyTorch unit-tests on nightly
# PyTorch wheels.

stages:
- stage: 'NightlyCustomTests'
  displayName: 'Run custom unit tests on PyTorch wheels'
  jobs:
  - template: job_templates/pytorch-template-unix.yml
    parameters:
      name: ubuntu_1804_CPU_docker
      pool: $(BUILD_POOL_LIN_1)
      customMatrixes:
        Nightly_Custom_Tests:
          _DOCKER_IMAGE: $(DOCKER_IMAGE_LIN_1)
          _PYTHON_VERSION: $(PYTHON_VERSION_LIN_1)
          _CUDA_BUILD_VERSION: $(CUDA_BUILD_VERSION_LIN_1)
          _RUN_TESTS: $(RUN_TESTS_LIN)

  - template: job_templates/pytorch-template-unix.yml
    parameters:
      name: ubuntu_1804_GPU_docker
      pool: $(BUILD_POOL_LIN_2)
      customMatrixes:
        Nightly_Custom_Tests:
          _DOCKER_IMAGE: $(DOCKER_IMAGE_LIN_2)
          _PYTHON_VERSION: $(PYTHON_VERSION_LIN_2)
          _CUDA_BUILD_VERSION: $(CUDA_BUILD_VERSION_LIN_2)
          _RUN_TESTS: $(RUN_TESTS_LIN)

  - template: job_templates/pytorch-template-win.yml
    parameters:
      name: windows_2019_CPU
      pool: $(BUILD_POOL_WIN_1)
      customMatrixes:
        Nightly_Custom_Tests:
          _PYTHON_VERSION: $(PYTHON_VERSION_WIN_1)
          _CUDA_BUILD_VERSION: $(CUDA_BUILD_VERSION_WIN_1)
          _RUN_TESTS: $(RUN_TESTS_WIN)

  - template: job_templates/pytorch-template-win.yml
    parameters:
      name: windows_2019_GPU
      pool: $(BUILD_POOL_WIN_2)
      customMatrixes:
        Nightly_Custom_Tests:
          _PYTHON_VERSION: $(PYTHON_VERSION_WIN_2)
          _CUDA_BUILD_VERSION: $(CUDA_BUILD_VERSION_WIN_2)
          _RUN_TESTS: $(RUN_TESTS_WIN)

- stage: 'NotifyWebapp'
  displayName: 'Notify Webapp that pipeline is finished'
  dependsOn: NightlyCustomTests
  condition: succeededOrFailed()
  jobs:
  - template: job_templates/notify-webapp-template.yml
    parameters:
      name: ubuntu_1804_CPU
      pool: $(BUILD_POOL_LIN_1)
