jobs:
- job: 'integration_test_local_ubuntu'
  timeoutInMinutes: 120

  steps:
  - script: python3 -m pip install --upgrade pip setuptools --user
    displayName: 'Install python tools'
  - script: |
      source install.sh
    displayName: 'Install nni toolkit via source code'
  - script: |
      set -e
      python3 -m pip install scikit-learn==0.23.2 --user
      python3 -m pip install torchvision==0.4.2 --user
      python3 -m pip install torch==1.3.1 --user
      python3 -m pip install keras==2.1.6 --user
      python3 -m pip install tensorflow-gpu==1.15.2 tensorflow-estimator==1.15.1 --force --user
      python3 -m pip install thop --user
      sudo apt-get install swig -y
      PATH=$HOME/.local/bin:$PATH nnictl package install --name=SMAC
      PATH=$HOME/.local/bin:$PATH nnictl package install --name=BOHB
      PATH=$HOME/.local/bin:$PATH nnictl package install --name=PPOTuner
    displayName: 'Install dependencies for integration tests'
  - script: |
      set -e
      cd examples/tuners/customized_tuner
      python3 setup.py develop --user
      PATH=$HOME/.local/bin:$PATH nnictl package install ./
    displayName: 'Install demotuner for customized_tuner test'
  - script: |
      cd test
      source scripts/unittest.sh
    displayName: 'Unit test'
  - script: |
      cd test
      PATH=$HOME/.local/bin:$PATH python3 nni_test/nnitest/run_tests.py --config config/integration_tests.yml --ts local
    displayName: 'Integration test'
  - script: |
      cd test
      PATH=$HOME/.local/bin:$PATH source scripts/nas.sh
    displayName: 'NAS test'
  - script: |
      cd test
      source scripts/model_compression.sh
    displayName: 'Model compression test'
