-
Notifications
You must be signed in to change notification settings - Fork 6
/
.gitlab-ci.yml
99 lines (90 loc) · 1.85 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
image: harbor.eds.aphp.fr/public/python:3.8-slim
variables:
GIT_SUBMODULE_STRATEGY: recursive
stages:
- test
- pages
- package
Linting:
stage: test
cache:
- key:
files:
- .pre-commit-config.yaml
paths:
- ~/.pre-commit
before_script:
- apt-get update
- apt-get install -y --no-install-recommends git
- pip install pre-commit
script:
- pre-commit run --all-files
only:
refs:
- main
- merge_request
Running Pytest:
stage: test
before_script:
- pip install cython setuptools # because `poetry install` does not correctly build the package
- pip install -e '.[dev]'
script:
- pytest tests --cov edspdf --junitxml=report.xml
after_script:
- coverage xml -o coverage.xml
coverage: "/TOTAL.+ ([0-9]{1,3}%)/"
artifacts:
when: always
paths:
- coverage.xml
- report.xml
- ./
reports:
junit: report.xml
coverage_report:
coverage_format: cobertura
path: coverage.xml
only:
refs:
- main
- merge_request
Installation:
stage: test
script:
- pip install .
only:
refs:
- main
- merge_request
Test documentation:
stage: test
before_script:
- pip install -e '.[docs]'
script:
- mkdocs build --site-dir documentation
artifacts:
paths:
- documentation
only:
refs:
- merge_request
pages:
stage: pages
before_script:
- pip install -e '.[docs]'
script:
- mkdocs build --site-dir public
artifacts:
paths:
- public
only:
- main
Package:
stage: package
before_script:
- pip install build twine
- python -m build
script:
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
only:
- tags