-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
106 lines (94 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
variables:
IMAGE: $CI_REGISTRY_IMAGE:latest
DOCKER_DRIVER: overlay
services:
- docker:20.10-dind
stages:
- test
- build
- deploy
.docker-login:
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
.build-docker:
image: docker:20.10
script:
- |
docker build -t $IMAGE --pull --file ./Dockerfile .
docker push $IMAGE
.setup-python:
before_script:
- pip install poetry
- poetry env use python
- python --version ; pip --version; poetry --version # For debugging
- poetry install
- poetry show # For debugging
.build:
script:
- poetry install --only packaging
- poetry build
.test:
coverage: /Test coverage (\d+\.\d+%)/
after_script:
- poetry install --only test
- poetry run pytest
.deploy:
after_script:
- poetry install --only publishing,doc
- poetry run sphinx-build -b html docs/source public
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token poetry run twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
test-develop:
image: ${PYTHON}
stage: test
except:
- main
extends:
- .setup-python
- .build
- .test
parallel:
matrix:
- PYTHON:
- python:3.9
- python:3.10
- python:3.11
build-environment:
stage: build
only:
- ci
extends:
- .docker-login
- .build-docker
test-production:
image: ${PYTHON}
stage: test
only:
- main
extends:
- .setup-python
- .build
- .test
parallel:
matrix:
- PYTHON:
- python:3.9
- python:3.10
- python:3.11
deploy-production:
image: ${PYTHON}
stage: deploy
artifacts:
paths:
- public
only:
- main
extends:
- .setup-python
- .build
- .deploy
parallel:
matrix:
- PYTHON:
- python:3.9
- python:3.10
- python:3.11