-
Notifications
You must be signed in to change notification settings - Fork 15
/
.gitlab-ci.yml
106 lines (92 loc) · 1.9 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
stages:
- checks
- tests
- publish
- coverage
variables:
DOCKER_IMAGE: "registry.duniter.org/docker/python3/poetry"
PYTHON_VERSION: "3.7"
image: $DOCKER_IMAGE/$PYTHON_VERSION:latest
.code_changes:
rules:
- changes:
- silkaj/*.py
- tests/*.py
.changes:
rules:
- changes:
- silkaj/*.py
- tests/*.py
- .gitlab-ci.yml
- pyproject.toml
- poetry.lock
build:
extends: .changes
stage: checks
script:
- poetry build
format:
extends: .code_changes
stage: checks
image: $DOCKER_IMAGE/3.8:latest
script:
- black --check silkaj tests
.tests:
extends: .changes
stage: tests
image: $DOCKER_IMAGE/$PYTHON_VERSION:latest
script:
- poetry install
- poetry run pytest
tests-3.6:
extends: .tests
tags: [mille]
variables:
PYTHON_VERSION: "3.6"
tests-3.7-coverage:
extends: .tests
tags: [mille]
script:
- poetry install
- poetry run pytest --cov silkaj --cov-report html:cov_html
- poetry run coverage-badge -o cov_html/coverage.svg
artifacts:
paths:
- cov_html
expire_in: 2 days
tests-3.8:
extends: .tests
tags: [redshift]
variables:
PYTHON_VERSION: "3.8"
tests-3.9:
extends: .tests
tags: [redshift]
variables:
PYTHON_VERSION: "3.9"
pypi_test:
stage: publish
rules:
- if: $CI_COMMIT_TAG
when: manual
script:
- poetry config repositories.pypi_test https://test.pypi.org/legacy/
- poetry publish --build --username $PYPI_TEST_LOGIN --password $PYPI_TEST_PASSWORD --repository pypi_test
pypi:
stage: publish
rules:
- if: $CI_COMMIT_TAG
when: manual
script:
- poetry publish --build --username $PYPI_LOGIN --password $PYPI_PASSWORD
pages:
extends: .changes
needs: [tests-3.7-coverage]
rules:
- if: $CI_COMMIT_BRANCH == "dev"
stage: coverage
script: mv cov_html/ public/
artifacts:
paths:
- public
expire_in: 2 days