Repository navigation
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
126 lines (111 loc) · 3.17 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
126 lines (111 loc) · 3.17 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
# Note: This GitLab CI configuration is used for internal testing, users can ignore it.
include:
- project: '${CI_PROJECT_NAMESPACE}/ci-libs-for-client-libraries'
file:
- '/${CI_PROJECT_NAME}/.gitlab-ci.yml'
# Global --------------------------
image: python:3.10
variables:
PIP_CACHE_DIR: "${CI_PROJECT_DIR}/.cache/pip"
XDG_CACHE_HOME: "${CI_PROJECT_DIR}/.cache"
POETRY_VIRTUALENVS_IN_PROJECT: "true"
REQUESTS_CA_BUNDLE: "/etc/ssl/certs/ca-certificates.crt"
cache:
key:
prefix: ${CI_JOB_IMAGE}
files:
- pyproject.toml
- poetry.lock
paths:
- .cache/pip
- .venv
stages:
- check
- build
- test
- publish
before_script:
- python3 -m venv .venv
- source .venv/bin/activate
- pip install --upgrade pip
- pip install poetry
- poetry --version
- poetry install -vv
# stage: check ----------------------
black:
stage: check
script: poetry run black --check .
flake8:
stage: check
script: poetry run flake8 deepl tests
# stage: build ----------------------
package:
stage: build
script:
- poetry build --verbose --no-interaction
artifacts:
paths:
- dist/
# stage: test -------------------------
test:
stage: test
extends: .test
parallel:
matrix:
- DOCKER_IMAGE: "python:3.10"
- DOCKER_IMAGE: "python:3.6"
USE_MOCK_SERVER: "use mock server"
- DOCKER_IMAGE: "python:3.7"
USE_MOCK_SERVER: "use mock server"
- DOCKER_IMAGE: "python:3.8"
USE_MOCK_SERVER: "use mock server"
- DOCKER_IMAGE: "python:3.9"
USE_MOCK_SERVER: "use mock server"
- DOCKER_IMAGE: "python:3.10"
USE_MOCK_SERVER: "use mock server"
- DOCKER_IMAGE: "python:3.6"
EXTRA_POETRY_ADD_ARGUMENT: "[email protected]"
USE_MOCK_SERVER: "use mock server"
- DOCKER_IMAGE: "python:3.9"
EXTRA_POETRY_ADD_ARGUMENT: "[email protected]"
USE_MOCK_SERVER: "use mock server"
- DOCKER_IMAGE: "python:3.10"
# Set minimum possible requests and urllib3 versions to work with Python 3.10
EXTRA_POETRY_ADD_ARGUMENT: "[email protected] [email protected]"
USE_MOCK_SERVER: "use mock server"
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
- >
if [[ ! -z "${USE_MOCK_SERVER}" ]]; then
echo "Using mock server"
export DEEPL_SERVER_URL=http://deepl-mock:3000
export DEEPL_MOCK_SERVER_PORT=3000
export DEEPL_PROXY_URL=http://deepl-mock:3001
export DEEPL_MOCK_PROXY_SERVER_PORT=3001
fi
- poetry run coverage run -m pytest --junit-xml test_report.xml
- poetry run coverage report
- poetry run coverage xml
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit:
- test_report.xml
when: always
# stage: publish -------------------------
pypi upload:
extends: .publish
stage: publish
dependencies:
- package
rules:
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
script:
- poetry publish --verbose --no-interaction