-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yaml
89 lines (73 loc) · 1.68 KB
/
.gitlab-ci.yaml
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
---
image: python:3.7-bookworm
.setup:
before_script:
- source .gitlab-ci.env
.depends:
before_script:
- apt-get update
- apt-get install --yes ${DEPENDS}
rules:
- if: ${DEPENDS}
stages:
- lint
- test
- package
- deploy
flake8:
stage: lint
before_script:
- !reference [.setup, before_script]
- !reference [.depends, before_script]
- pip install -e ".[dev]"
script:
- flake8 src
mypy:
stage: lint
before_script:
- !reference [.setup, before_script]
- !reference [.depends, before_script]
- pip install -e ".[dev]"
script:
- mypy src
test:
stage: test
image: python:${TEST_PYTHON_VERSION}-bookworm
parallel:
matrix:
- TEST_PYTHON_VERSION:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
before_script:
- !reference [.setup, before_script]
- !reference [.depends, before_script]
- pip install -e ".[test]"
- chmod a+x test.py
script:
- ./test.py
rules:
- exists:
- test.py
package:
stage: package
image: docker.linss.com/docker-images/python-build:main
script:
- python -m build --no-isolation --outdir dist
artifacts:
paths:
- dist
rules:
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9-\.]+)?$/'
deploy:
stage: deploy
before_script:
- !reference [.setup, before_script]
- pip install --upgrade wheel twine
script:
- python -m twine upload --username __token__ --password ${PYPI_API_TOKEN} --non-interactive --disable-progress-bar --repository-url ${PYPI_REPOSITORY_URL} dist/*
rules:
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9-\.]+)?$/'