-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
107 lines (90 loc) · 3.72 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
stages:
- stylecheck
- test
- deploy
.conda_env: &conda_env
before_script:
# update conda
- conda config --set always_yes yes
- conda update -q conda
# create and activate environment
- conda create -q -n testenv_${CI_JOB_ID}_py${PYTHON_VERSION_TO_USE//./} python=${PYTHON_VERSION_TO_USE} pip
- source activate testenv_${CI_JOB_ID}_py${PYTHON_VERSION_TO_USE//./}
after_script:
# remove environment
- conda env remove --name testenv_${CI_JOB_ID}_py${PYTHON_VERSION_TO_USE//./}
.test_template: &test_template
<<: *conda_env
stage: test
rules:
- if: $CI_MERGE_REQUEST_TITLE =~ /^(Draft:|WIP:|\[Draft\]|\[WIP\])/
when: manual
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TITLE !~ /^(Draft:|WIP:|\[Draft\]|\[WIP\])/
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == "schedule"
# parallel: 1
script:
# install packages (use conda to avoid time-consuming installations)
- conda install -q pytest pytest-cov
- python -m pip install -q pytest-html
- python -m pip install pytest-xdist # multiple workers for pytest (-n 2 below)
# install dependencies
- |
if [ "${PYTHON_VERSION_TO_USE}" == "3.8" ]; then
# EMSAFormer (same for training and inference)
conda install pytorch=2.0.0 torchvision=0.15.0 torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
else
# latest tested version
conda install pytorch=2.3.0 torchvision=0.18.0 pytorch-cuda=11.8 -c pytorch -c nvidia
fi
- python -m pip install 'opencv-python>=4.2.0.34'
- python -m pip install 'wandb>=0.14.2'
- python -m pip install 'onnx>=1.13.1'
- python -m pip install 'nicr-cluster-utils>=1.0.0'
- python -m pip install git+https://github.com/cocodataset/panopticapi.git
# - python -m pip install pycocotools==2.0.2
# install packages (and all missing dependencies)
- python -m pip install --editable lib/nicr-scene-analysis-datasets[test]
- python -m pip install --editable lib/nicr-multitask-scene-analysis[test]
# check conda installation
- conda info
- conda list
- python -m pip list
# run test
- py.test ./emsaformer/tests -vv -rx -s --maxfail=4 --ff --html=report_py${PYTHON_VERSION_TO_USE//./}.html --self-contained-html
style_check:
<<: *conda_env
stage: stylecheck
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
- if: '$CI_PIPELINE_SOURCE == "schedule"'
variables:
PYTHON_VERSION_TO_USE: "3.8"
script:
# install packages
- conda install -q pycodestyle pylint
# check style using pep8
- find ./ -name "*.py" -not -path "*/lib/*" -not -path "*/stuff/*" -not -path "*/tensorrt_swin/utils/common_runtime.py" | xargs pycodestyle --show-source --show-pep8
# check style using pylint (without taking into account)
- pylint ./ --rcfile=${CI_PROJECT_DIR}/.pylintrc || true
# tests_py36:
# <<: *test_template
# variables:
# PYTHON_VERSION_TO_USE: "3.6"
# GIT_SUBMODULE_STRATEGY: recursive
tests_py38: # ubuntu20
<<: *test_template
variables:
PYTHON_VERSION_TO_USE: "3.8"
GIT_SUBMODULE_STRATEGY: recursive
tests_py310: # ubuntu22
<<: *test_template
variables:
PYTHON_VERSION_TO_USE: "3.10"
GIT_SUBMODULE_STRATEGY: recursive
tests_py311: # current
<<: *test_template
variables:
PYTHON_VERSION_TO_USE: "3.11"
GIT_SUBMODULE_STRATEGY: recursive