variables:
  PYTORCH_IMAGE: registry.sensetime.com/openmmlab/pytorch18-cu102-mmengine:dev2

stages:
  - linting
  - test
  - deploy

before_script:
  - . /root/scripts/set_envs.sh
  - echo $PATH
  - gcc --version
  - nvcc --version
  - ruby --version
  - python --version
  - pip --version
  - python -c "import torch; print(torch.__version__)"

linting:
  image: $PYTORCH_IMAGE
  stage: linting
  script:
    - pre-commit run --all-files

.test_template: &test_template_def
  stage: test
  script:
    - echo "Start building..."
    - MMCV_WITH_OPS=1 pip install -e .[all] -i https://pypi.tuna.tsinghua.edu.cn/simple/
    - python -c "import mmcv; print(mmcv.__version__)"
    - echo "Start testing..."
    - coverage run --branch --source mmcv -m pytest tests/
    - coverage report -m

test:pytorch1.8-cuda10:
  image: $PYTORCH_IMAGE
  <<: *test_template_def
