-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
148 lines (131 loc) · 3.51 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
default:
tags: [stable]
image: mdl4eo/otbtf:4.3.0-cpu
interruptible: true
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- .cache/pip
workflow:
rules:
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_REF_PROTECTED == "true"
stages:
- Static Analysis
- Tests
- Documentation
- Ship
# -------------------------------- Static analysis --------------------------------
.static_analysis:
stage: Static Analysis
allow_failure: true
rules:
- changes:
- pyotb/*.py
pydocstyle:
extends: .static_analysis
before_script:
- python3 -m pip install pydocstyle tomli
script:
- pydocstyle $PWD/pyotb
pylint:
extends: .static_analysis
before_script:
- python3 -m pip install pylint
script:
- pylint $PWD/pyotb --disable=fixme --ignore=functions.py
codespell:
extends: .static_analysis
rules:
- changes:
- "**/*.py"
- "**/*.md"
before_script:
- python3 -m pip install codespell
script:
- codespell {pyotb,tests,doc,README.md}
# -------------------------------------- Tests --------------------------------------
test_install:
stage: Tests
only:
- tags
allow_failure: false
script:
- python3 -m pip install .
.tests:
stage: Tests
allow_failure: false
rules:
- changes:
- "**/*.py"
- .gitlab-ci.yml
- .coveragerc
variables:
SPOT_IMG_URL: https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/raw/develop/Data/Input/SP67_FR_subset_1.tif
PLEIADES_IMG_URL: https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/raw/develop/Data/Baseline/OTB/Images/prTvOrthoRectification_pleiades-1_noDEM.tif
before_script:
- python3 -m pip install pytest pytest-cov
module_core:
extends: .tests
variables:
OTB_LOGGER_LEVEL: INFO
PYOTB_LOGGER_LEVEL: DEBUG
artifacts:
reports:
junit: test-module-core.xml
coverage_report:
coverage_format: cobertura
path: coverage.xml
coverage: '/TOTAL.*\s+(\d+%)$/'
script:
- curl -fsLI $SPOT_IMG_URL
- curl -fsLI $PLEIADES_IMG_URL
- python3 -m pytest -vv --junitxml=test-module-core.xml --cov-report xml:coverage.xml tests/test_core.py
pipeline_permutations:
extends: .tests
variables:
OTB_LOGGER_LEVEL: WARNING
PYOTB_LOGGER_LEVEL: INFO
artifacts:
reports:
junit: test-pipeline-permutations.xml
script:
- curl -fsLI $SPOT_IMG_URL
- python3 -m pytest -vv --junitxml=test-pipeline-permutations.xml tests/test_pipeline.py
# -------------------------------------- Docs ---------------------------------------
docs:
stage: Documentation
rules:
- changes:
- "*.md"
- mkdocs.yml
- doc/*
- pyotb/*.py
before_script:
- apt update && apt install -y python3.8-venv
- python3 -m venv docs_venv
- source docs_venv/bin/activate
- python3 -m pip install -U pip
- python3 -m pip install -r doc/doc_requirements.txt
script:
- mkdocs build --site-dir public
artifacts:
paths:
- public
# -------------------------------------- Ship ---------------------------------------
pypi:
stage: Ship
# when: manual
only:
- tags
before_script:
- apt update && apt install -y python3.8-venv
- python3 -m pip install build twine
script:
- python3 -m build
- python3 -m twine upload --non-interactive -u __token__ -p $pypi_token dist/*