-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
92 lines (81 loc) · 1.82 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
# 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 environment
.devsetup:
before_script:
- python -V
# Prepare and activate virtual env
- pip install -U pip
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
# install the package and develop dependencies
- pip install .[develop]
- apt update
# Prepare the nominal usage environment
.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
rules:
- if: $CI_COMMIT_BRANCH == "main"
# python:
# extends: .pytest
# python3.10:
# extends: .pytest
# image: python:3.10
###############
## 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