-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
99 lines (85 loc) · 3.49 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
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
- conda install 'protobuf<=3.19.1' # for onnx
- |
if [ "${PYTHON_VERSION_TO_USE}" == "3.6" ]; then
conda install pytorch=1.10.1 torchvision=0.11.2 cudatoolkit=11.3 -c pytorch
else
conda install pytorch=1.13.0 torchvision=0.14.0 torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
fi
- python -m pip install 'opencv-python>=4.2.0.34'
- python -m pip install wandb==0.13.6
- python -m pip install onnx==1.12.0
- python -m pip install tui_imagenet==0.1.0
- 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/*" | 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:
<<: *test_template
variables:
PYTHON_VERSION_TO_USE: "3.8"
GIT_SUBMODULE_STRATEGY: recursive
tests_py310:
<<: *test_template
variables:
PYTHON_VERSION_TO_USE: "3.10"
GIT_SUBMODULE_STRATEGY: recursive