-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
85 lines (78 loc) · 1.89 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
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
cache:
- key:
files:
- poetry.lock
paths:
- .venv
before_script:
- pip install poetry
- poetry source add gitlab "https://$GITLAB_REGISTRY" --secondary
- poetry config http-basic.gitlab gitlab-ci-token "${CI_JOB_TOKEN}"
- poetry run pip install cython setuptools # because `poetry install` does not correctly build the package
- poetry install -v
script:
- poetry run pytest tests --cov edspdf_mupdf --junitxml=report.xml
after_script:
- poetry run 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 . --extra-index-url "https://gitlab-ci-token:$CI_JOB_TOKEN@$GITLAB_REGISTRY"
only:
refs:
- main
- merge_request
Package:
stage: package
before_script:
- pip install poetry
- poetry source add gitlab "https://$GITLAB_REGISTRY" --secondary
- poetry config repositories.gitlab "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi"
- poetry config http-basic.gitlab gitlab-ci-token "${CI_JOB_TOKEN}"
script:
- poetry publish --build -r gitlab
only:
- tags