forked from DeepLcom/deepl-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
108 lines (92 loc) · 2.41 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
# Note: This GitLab CI configuration is used for internal testing, users can ignore it.
# Global --------------------------
image: python:3.10
variables:
PIP_CACHE_DIR: "${CI_PROJECT_DIR}/.cache/pip"
cache:
key:
prefix: ${CI_JOB_IMAGE}
files:
- pyproject.toml
- poetry.lock
paths:
- .cache/pip
- .venv
stages:
- check
- build
- test
- publish
before_script:
- pip install poetry
- poetry --version
- poetry config virtualenvs.in-project true
- poetry install -vv
# stage: check ----------------------
formatting:
stage: check
script: poetry run black --check .
# stage: build ----------------------
package:
stage: build
script:
- poetry build --verbose --no-interaction
artifacts:
paths:
- dist/
# stage: test -------------------------
.use-test-server-template: &use_test_server_template
secrets:
DEEPL_AUTH_KEY:
vault: jenkins/client_libraries/test_auth_key@backend
file: false
DEEPL_SERVER_URL:
vault: jenkins/client_libraries/test_server_url@backend
file: false
test:
<<: *use_test_server_template
stage: test
parallel:
matrix:
- DOCKER_IMAGE: "python:3.6"
- DOCKER_IMAGE: "python:3.7"
- DOCKER_IMAGE: "python:3.8"
- DOCKER_IMAGE: "python:3.9"
- DOCKER_IMAGE: "python:3.10"
- DOCKER_IMAGE: "python:3.6"
EXTRA_POETRY_ADD_ARGUMENT: "[email protected]"
- DOCKER_IMAGE: "python:3.9"
EXTRA_POETRY_ADD_ARGUMENT: "[email protected]"
image: ${DOCKER_IMAGE}
script:
- >
if [[ ! -z "${EXTRA_POETRY_ADD_ARGUMENT}" ]]; then
echo "Running poetry add ${EXTRA_POETRY_ADD_ARGUMENT}"
poetry add ${EXTRA_POETRY_ADD_ARGUMENT}
fi
- poetry run coverage run -m pytest --junit-xml test_report.xml
- poetry run coverage report
- poetry run coverage xml
artifacts:
reports:
cobertura:
- coverage.xml
junit:
- test_report.xml
when: always
# stage: publish -------------------------
pypi upload:
stage: publish
dependencies:
- package
rules:
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
script:
- poetry publish --verbose --no-interaction --username $PYPI_USERNAME --password $PYPI_PASSWORD
secrets:
PYPI_USERNAME:
vault: jenkins/client_libraries/pypi_username@backend
file: false
PYPI_PASSWORD:
vault: jenkins/client_libraries/pypi_password@backend
file: false