-
Notifications
You must be signed in to change notification settings - Fork 5
/
.gitlab-ci.yml
153 lines (137 loc) · 3.66 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
stages:
- preflight
- build
- test
- qa
- deploy
- publish
- verify
- experimental
include:
- template: Jobs/Dependency-Scanning.gitlab-ci.yml
.all-but-pyver:
when: manual
allow_failure: true
stage: test
script:
- python setup.py install
- pip install -e .[dev]
- pip install tox
- tox
artifacts:
when: always
reports:
junit: coverage.xml
paths:
- coverage.xml
- htmlcov/*
🧪 Python 3.9:
extends: .all-but-pyver
image: python:3.9
🧪 Python 3.10:
extends: .all-but-pyver
image: python:3.10
🧪 Python 3.11:
image: python:3.11
extends: .all-but-pyver
🧪 Python 3.12 rc 🥼:
stage: experimental
allow_failure: true
extends: .all-but-pyver
image: python:3.12-rc
🧪 test with tox:
allow_failure: false
image: python:3.10
stage: preflight
script:
- python setup.py install
- pip install -e .[dev]
- pip install tox
- tox -p auto
artifacts:
when: always
reports:
junit: coverage.xml
paths:
- coverage.xml
- htmlcov/*
expire_in: 1 week
.pages:
stage: deploy
needs: ["🧪 test with tox"]
script:
- mkdir public
- mv htmlcov/* public/
artifacts:
paths:
- public/
.publish-the-package:
needs: ["🧪 test with tox"] # Comment to speed things up. 😬
image: python:latest
stage: deploy
before_script:
- pip install build twine
rules:
- if: $CI_COMMIT_TAG =~ /v.*/
🚀 deploy to 🦊💜 GitLab Package Registry:
stage: publish
extends: .publish-the-package
script:
- python -m build
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --verbose --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
🧾 check the 📦 package 🥺:
stage: qa
extends: .publish-the-package
script:
- echo "🧾 check the 📦 package 🥺"
- python -m build
- twine check dist/*
🚀 deploy to 🧪 TestPyPi:
stage: test
when: always
extends: .publish-the-package
script:
- echo "🚀 Upload to TestPyPi..."
- python -m build
- TWINE_USERNAME=__token__ TWINE_REPOSITORY_URL=https://test.pypi.org/legacy/ twine upload --non-interactive --comment "🦄 hello world" --skip-existing --password $TESTPYPI_TOKEN dist/*
rules:
- if: $CI_COMMIT_TAG =~ /v.*/
🚀 deploy to 🎊 PyPi:
needs: ["🚀 deploy to 🧪 TestPyPi","🧾 check the 📦 package 🥺"]
stage: publish
when: manual
extends: .publish-the-package
script:
- echo "🚀 Upload to PyPi..."
- python -m build
- TWINE_USERNAME=__token__ TWINE_REPOSITORY_URL=https://upload.pypi.org/legacy/ twine upload --non-interactive --skip-existing --password $PYPI_TOKEN dist/*
😅 make sure the TestPyPi version works:
stage: verify
image: python:3.10
needs: ["🧾 check the 📦 package 🥺"]
script:
- pip install -i https://test.pypi.org/simple/ pastebin-bisque==$(grep ^current_version .bumpversion.cfg | cut -d"=" -f2 | cut -d" " -f2) --extra-index-url https://pypi.org/simple
- pastebin-bisque --help
- pastebin-bisque
- pastebin-bisque -z
artifacts:
paths:
- pastes/*
- /**zip
rules:
- if: $CI_COMMIT_TAG =~ /v.*/
🤞 make sure the PyPi version works 🍀:
stage: verify
image: python:3.10
script:
- echo "🦄 Let's do this!"
- pip install pastebin-bisque==$(grep ^current_version .bumpversion.cfg | cut -d"=" -f2 | cut -d" " -f2)
- pastebin-bisque --help
- pastebin-bisque
- pastebin-bisque --username catstestingcode
- pastebin-bisque -z
artifacts:
paths:
- pastes/*
rules:
- if: $CI_COMMIT_TAG =~ /v.*/