-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
107 lines (92 loc) · 1.97 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
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/python/tags/
image: python:3.8.10
stages:
- test
- release
# Prepare the development enviornment
.devsetup:
before_script:
- python -V
# Prepare and activate virtualenv
- pip install -U pip
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
# install the package and develop dependancies
- pip install .[develop]
# Prepare the nominal usage enviornment
.setup:
before_script:
- python -V
# Prepare and activate virtualenv
- pip install -U pip
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
# install the package
- pip install .
#######################
## Platforms testing ##
#Template for testing on python images,
# extend this for each python-platform
# the package is intended to work on
.pytest:
stage: test
extends: .setup
allow_failure: true
script:
- pip install pytest
- pytest
only:
- tags
python:
extends: .pytest
python3.7:
extends: .pytest
image: python:3.7
python3.9:
extends: .pytest
image: python:3.9
python3.10:
extends: .pytest
image: python:3.10
python3.11:
extends: .pytest
image: python:3.11
python3.12:
extends: .pytest
image: python:3.12
###############
## Releasing ##
# Compile documentation for publication
pages:
stage: release
extends: .devsetup
script:
- mkdocs build --site-dir public
artifacts:
paths:
- public
only:
- tags
# Build and check integrity of distribution
# Then publish package on public PyPI
pypi:
stage: release
extends: .devsetup
variables:
#Use a gitlab variable to securly store the token
PYPI_TOKEN: $PYPI_TOKEN
script:
- python -m build
- python -m twine check dist/*
- >
TWINE_USERNAME=__token__
TWINE_PASSWORD=$PYPI_TOKEN
python -m twine upload dist/*
artifacts:
paths:
- dist/*
only:
- tags