Skip to content

Commit 99b0a48

Browse files
committed
Use templatized tests in CI
1 parent 5d2b6f2 commit 99b0a48

1 file changed

Lines changed: 50 additions & 246 deletions

File tree

.gitlab-ci.yml

Lines changed: 50 additions & 246 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,7 @@ include:
1111
- project: 'sertit/groupware'
1212
file: '/ci_templates/lint_3_10.yaml'
1313

14-
# Test with data on local disk
15-
pytest:
16-
image: $EO_CONTAINER:geo_latest
17-
stage: test
18-
variables:
19-
CI_EOREADER_USE_S3: "0"
20-
EOREADER_USE_DASK: "1"
21-
before_script:
22-
- python -m pip install --upgrade pip
23-
- pip install --ignore-installed PyYAML
24-
- pip install -e .
25-
script:
26-
- python -m pytest -v --durations=0 --cov-report term --cov-report html:${CI_PROJECT_DIR}/cov_s3.html --cov=eoreader ci/on_push --log-cli-level DEBUG
27-
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
28-
artifacts:
29-
paths:
30-
- ${CI_PROJECT_DIR}/cov_s3.html
31-
tags:
32-
- sertit
33-
- linux
34-
- high_memory
14+
.rules_pytest:
3515
rules:
3616
- if: $CI_COMMIT_TAG
3717
when: never
@@ -41,271 +21,95 @@ pytest:
4121
- $EOREADER_CHANGES
4222
- ci/**/*.{py,xml}
4323
- .gitlab-ci.yml
44-
needs: [ "lint" ]
4524

46-
# Test with data on S3
47-
# TODO: create S3-specific CI ?
48-
pytest_s3:
49-
image: $EO_CONTAINER:geo_latest
50-
stage: test
51-
variables:
52-
CI_EOREADER_USE_S3: "1"
53-
EOREADER_USE_DASK: "1"
54-
before_script:
55-
- python -m pip install --upgrade pip
56-
- pip install --ignore-installed PyYAML
57-
- pip install -e .
58-
script:
59-
- python -m pytest -v --durations=0 --cov-report term --cov-report html:${CI_PROJECT_DIR}/cov_s3.html --cov=eoreader ci/on_push --log-cli-level DEBUG --capture=tee-sys
60-
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
61-
artifacts:
62-
paths:
63-
- ${CI_PROJECT_DIR}/cov_s3.html
25+
.pytest_tags:
6426
tags:
6527
- sertit
6628
- linux
6729
- high_memory
68-
rules:
69-
- if: $CI_COMMIT_TAG
70-
when: never
71-
- if: '$CI_PIPELINE_SOURCE == "schedule"'
72-
when: never
73-
- changes:
74-
- $EOREADER_CHANGES
75-
- ci/**/*.{py,xml}
76-
- .gitlab-ci.yml
77-
needs: [ "lint" ]
7830

79-
# Test SNAP with SNAP
80-
pytest_end_to_end:
81-
image: $EO_CONTAINER:geo_latest
82-
stage: test
31+
pytest:
32+
image: $EO_CONTAINERS:geo_latest
33+
extends:
34+
- .pytest
35+
- .rules_pytest
36+
- .pytest_tags
37+
variables:
38+
CI_EOREADER_USE_S3: "1"
39+
EOREADER_USE_DASK: "1"
40+
PATH_TO_TEST: ci/on_push
41+
COV: eoreader
42+
43+
pytest_s3:
44+
image: $EO_CONTAINERS:geo_latest
45+
extends:
46+
- .pytest
47+
- .rules_pytest
48+
- .pytest_tags
8349
variables:
8450
CI_EOREADER_USE_S3: "0"
8551
EOREADER_USE_DASK: "1"
86-
before_script:
87-
- python -m pip install --upgrade pip
88-
- pip install --ignore-installed PyYAML
89-
- pip install -e .
90-
script:
91-
- python -m pytest -v --durations=0 --cov-report term --cov=eoreader ci/weekly --log-cli-level DEBUG --capture=tee-sys ${REVERSE}
92-
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
93-
tags:
94-
- sertit
95-
- linux
96-
- high_memory
97-
rules:
98-
- if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_NAME == "END_TO_END"'
99-
when: always
100-
- if: $CI_COMMIT_TAG
101-
when: always
52+
PATH_TO_TEST: ci/on_push
53+
COV: eoreader
10254

103-
# Test with Python3.13
104-
pytest_end_to_end_313:
105-
image: $EO_CONTAINER:geo_313_latest
106-
stage: test
55+
pytest_end_to_end:
56+
image: $EO_CONTAINERS:geo_latest
57+
extends:
58+
- .pytest
59+
- .pytest_tags
10760
variables:
10861
CI_EOREADER_USE_S3: "0"
10962
EOREADER_USE_DASK: "1"
110-
before_script:
111-
- python -m pip install --upgrade pip
112-
- pip install --ignore-installed PyYAML
113-
- pip install -e .
114-
script:
115-
- python -m pytest -v --durations=0 --cov-report term --cov=eoreader ci/weekly --log-cli-level DEBUG --capture=tee-sys ${REVERSE}
116-
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
117-
tags:
118-
- sertit
119-
- linux
120-
- high_memory
63+
PATH_TO_TEST: ci/weekly
64+
COV: eoreader
12165
rules:
122-
- if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_NAME == "3.13"'
66+
- if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_NAME == "END_TO_END"'
67+
when: always
68+
- if: $CI_COMMIT_TAG
12369
when: always
12470

125-
# Test with Python 3.14
12671
pytest_end_to_end_314:
127-
image: $EO_CONTAINER:geo_314_latest
128-
stage: test
72+
image: $EO_CONTAINERS:geo_314_latest
73+
extends:
74+
- .pytest
75+
- .pytest_tags
12976
variables:
13077
CI_EOREADER_USE_S3: "0"
13178
EOREADER_USE_DASK: "1"
132-
before_script:
133-
- python -m pip install --upgrade pip
134-
- pip install --ignore-installed PyYAML
135-
- pip install -e .
136-
script:
137-
- python -m pytest -v --durations=0 --cov-report term --cov=eoreader ci/weekly --log-cli-level DEBUG --capture=tee-sys ${REVERSE}
138-
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
139-
tags:
140-
- sertit
141-
- linux
142-
- high_memory
79+
PATH_TO_TEST: ci/weekly
80+
COV: eoreader
14381
rules:
14482
- if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_NAME == "3.14"'
14583
when: always
14684

147-
148-
# Test with data on local disk (without dask)
14985
pytest_no_dask:
150-
image: $EO_CONTAINER:geo_latest
151-
stage: test
86+
image: $EO_CONTAINERS:geo_latest
87+
extends:
88+
- .pytest
89+
- .pytest_tags
15290
variables:
15391
CI_EOREADER_USE_S3: "0"
15492
EOREADER_USE_DASK: "0"
155-
before_script:
156-
- python -m pip install --upgrade pip
157-
- pip install --ignore-installed PyYAML
158-
- pip install -e .
159-
script:
160-
- python -m pytest -v --durations=0 --cov-report term --cov=eoreader ci/on_push --log-cli-level DEBUG
161-
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
162-
tags:
163-
- sertit
164-
- linux
165-
- high_memory
93+
PATH_TO_TEST: ci/on_push
94+
COV: eoreader
16695
rules:
16796
- if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_NAME == "NO_DASK"'
16897
when: always
16998
- if: $CI_COMMIT_TAG
17099
when: always
171100

172-
# Test with data on S3 (without dask)
173-
# TODO: create S3-specific CI ?
174101
pytest_s3_no_dask:
175-
image: $EO_CONTAINER:geo_latest
176-
stage: test
102+
image: $EO_CONTAINERS:geo_latest
103+
extends:
104+
- .pytest
105+
- .pytest_tags
177106
variables:
178107
CI_EOREADER_USE_S3: "1"
179108
EOREADER_USE_DASK: "0"
180-
before_script:
181-
- python -m pip install --upgrade pip
182-
- pip install --ignore-installed PyYAML
183-
- pip install -e .
184-
script:
185-
- python -m pytest -v --durations=0 --cov-report term --cov=eoreader ci/on_push --log-cli-level DEBUG --capture=tee-sys
186-
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
187-
tags:
188-
- sertit
189-
- linux
190-
- high_memory
109+
PATH_TO_TEST: ci/on_push
110+
COV: eoreader
191111
rules:
192112
- if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_NAME == "NO_DASK"'
193113
when: always
194114
- if: $CI_COMMIT_TAG
195115
when: always
196-
197-
198-
#pytest_end_to_end310:
199-
# image: $EO_CONTAINER:geo_310
200-
# stage: test
201-
# variables:
202-
# # Use Dask for python 3.10
203-
# EOREADER_USE_DASK: "1"
204-
# before_script:
205-
# - python -m pip install --upgrade pip
206-
# - pip install --ignore-installed PyYAML
207-
# - pip install pytest coverage pytest-cov pylint
208-
# - pip install -e .
209-
# script:
210-
# - python -m pytest -v --durations=0 --cov-report term --cov-report html:${CI_PROJECT_DIR}/cov_e2e.html --cov=eoreader --cov-config=.coveragerc ci/on_push --log-cli-level DEBUG --capture=tee-sys
211-
# artifacts:
212-
# paths:
213-
# - ${CI_PROJECT_DIR}/cov_e2e.html
214-
# coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
215-
# tags:
216-
# - sertit
217-
# - linux
218-
# - high_memory
219-
# rules:
220-
# - if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_NAME == "END_TO_END"'
221-
# when: always
222-
# - if: $CI_COMMIT_TAG
223-
# when: always
224-
# needs: [ "pytest_end_to_end" ]
225-
#
226-
#pytest_end_to_end311:
227-
# image: $EO_CONTAINER:geo_311
228-
# stage: test
229-
# variables:
230-
# # Use Dask for python 3.11
231-
# EOREADER_USE_DASK: "1"
232-
# before_script:
233-
# - python -m pip install --upgrade pip
234-
# - pip install --ignore-installed PyYAML
235-
# - pip install pytest coverage pytest-cov pylint
236-
# - pip install -e .
237-
# script:
238-
# - python -m pytest -v --durations=0 --cov-report term --cov-report html:${CI_PROJECT_DIR}/cov.html --cov=eoreader --cov-config=.coveragerc ci/on_push --log-cli-level DEBUG --capture=tee-sys
239-
# artifacts:
240-
# paths:
241-
# - ${CI_PROJECT_DIR}/cov_e2e.html
242-
# coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
243-
# tags:
244-
# - sertit
245-
# - linux
246-
# - high_memory
247-
# rules:
248-
# - if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_NAME == "END_TO_END"'
249-
# when: always
250-
# - if: $CI_COMMIT_TAG
251-
# when: always
252-
# needs: [ "pytest_end_to_end310" ]
253-
254-
#pytest_end_to_end312:
255-
# image: $EO_CONTAINER:geo_312
256-
# stage: test
257-
# variables:
258-
# # Use Dask for python 3.11
259-
# EOREADER_USE_DASK: "1"
260-
# before_script:
261-
# - python -m pip install --upgrade pip
262-
# - pip install --ignore-installed PyYAML
263-
# - pip install pytest coverage pytest-cov pylint
264-
# - pip install -e .
265-
# script:
266-
# - python -m pytest -v --durations=0 --cov-report term --cov-report html:${CI_PROJECT_DIR}/cov_e2e.html --cov=eoreader --cov-config=.coveragerc ci/on_push --log-cli-level DEBUG --capture=tee-sys
267-
# artifacts:
268-
# paths:
269-
# - ${CI_PROJECT_DIR}/cov_e2e.html
270-
# coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
271-
# tags:
272-
# - sertit
273-
# - linux
274-
# - high_memory
275-
# rules:
276-
# - if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_NAME == "END_TO_END"'
277-
# when: always
278-
# - if: $CI_COMMIT_TAG
279-
# when: always
280-
# needs: [ "pytest_end_to_end311" ]
281-
#
282-
#tox-linux-3.9:on-schedule:
283-
# image: $EO_CONTAINER:geo_39
284-
# stage: weekly_tests
285-
# before_script:
286-
# - python -m pip install --upgrade pip
287-
# - pip install tox
288-
# script:
289-
# - tox -c tox.ini -e py39
290-
# tags:
291-
# - sertit
292-
# - linux
293-
# - high_memory
294-
# rules:
295-
# - if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_NAME == "WEEKLY"'
296-
#
297-
#tox-windows:on-schedule:
298-
# stage: weekly_tests
299-
# before_script:
300-
# - pip install tox
301-
# script:
302-
# - tox -c tox-conda.ini -e py39
303-
# tags:
304-
# - sertit
305-
# - windows
306-
# - high_memory
307-
# rules:
308-
# - if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_NAME == "WEEKLY"'
309-
# when: always
310-
# - if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_NAME == "windows"'
311-
# when: always

0 commit comments

Comments
 (0)