-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
73 lines (63 loc) · 1.52 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
stages:
- lint
- pytest
- release
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH == "main"
- when: never
cache:
paths:
- .cache/pip
pre-commit:
stage: lint
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
image: python:3.11
script:
- pip install -e '.[dev]'
- SKIP=no-commit-to-branch pre-commit run --all-files --show-diff-on-failure --color=always
pytest:
stage: pytest
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
image: "python:$VERSION"
script:
- pip install -e '.[dev]'
- python -m pytest -v
parallel:
matrix:
- VERSION: [ "3.9", "3.10", "3.11" , "3.12"]
.bumpver:
stage: release
rules:
- if: $CI_COMMIT_BRANCH == "main"
image: python:3.11
when: manual
variables:
TYPE: ""
tags:
- docker
script:
- pip install bumpver build twine
- git config --global user.email "bumpver@syngeta.com"
- git config --global user.name "bumpver"
- git remote set-url origin "https://gitlab-ci-token:${BUMPVER_TOKEN}@gitlab.com/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}.git"
- bumpver update $TYPE --no-push
- git push -o ci.skip --tags origin HEAD:${CI_COMMIT_REF_NAME}
- python -m build
- twine check dist/*
- twine upload --cert $ROOT_CA dist/*
bumpver-minor:
extends: .bumpver
variables:
TYPE: "--minor"
bumpver-major:
extends: .bumpver
variables:
TYPE: "--major"
bumpver-patch:
extends: .bumpver
variables:
TYPE: "--patch"