-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
144 lines (127 loc) · 3.25 KB
/
.gitlab-ci.yml
File metadata and controls
144 lines (127 loc) · 3.25 KB
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
default:
tags: [stable]
image: registry.forgemia.inra.fr/orfeo-toolbox/otbtf:5.0.0-cpu-dev
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
pylint:
extends: .static_analysis
script:
- pylint $PWD/pyotb --disable=fixme
codespell:
extends: .static_analysis
rules:
- changes:
- "**/*.py"
- "**/*.md"
script:
- codespell {pyotb,tests,doc,README.md}
pydocstyle:
extends: .static_analysis
before_script:
- pip install pydocstyle tomli
script:
- pydocstyle $PWD/pyotb
# -------------------------------------- Tests --------------------------------------
test_install:
stage: Tests
only:
- tags
allow_failure: false
script:
- pip install .
.tests:
stage: Tests
allow_failure: false
rules:
- changes:
- "**/*.py"
- .gitlab-ci.yml
- .coveragerc
before_script:
- pip install .
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
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
- 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
- pytest -vv --junitxml=test-pipeline-permutations.xml tests/test_pipeline.py
# -------------------------------------- Docs ---------------------------------------
docs:
stage: Documentation
needs: []
image: python:3.12-slim
rules:
- changes:
- "*.md"
- mkdocs.yml
- doc/*
- pyotb/*.py
before_script:
- python -m venv docs_venv
- source docs_venv/bin/activate
- pip install -U pip
- 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:
- pip install build twine
script:
- python -m build
- python -m twine upload --non-interactive -u __token__ -p $pypi_token dist/*