-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
124 lines (113 loc) · 2.48 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
image: python:3.11
stages:
- test
- build
- docs
- deploy
- release
check:
stage: test
before_script:
- pip3 install 'black>=23,<24' 'pylint>=3' 'isort[colors]<6'
script:
- pip3 install --editable .
- black --check --diff --color .
- isort --check --diff --color .
- pylint src/finam
test:
stage: test
script:
- pip3 install --editable .[test]
- python -m pytest --cov finam --cov-report term-missing --cov-report html:cov --cov-report xml:cov.xml -v tests/
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: cov.xml
paths:
- cov
benchmark:
stage: test
script:
- pip3 install --editable .[test]
- python -m pytest -v benchmarks/ --benchmark-histogram bench/bench --benchmark-sort name
artifacts:
paths:
- bench
profile:
stage: test
before_script:
- apt-get update -y
- apt-get install -y graphviz
- pip3 install graphviz gprof2dot
script:
- pip3 install --editable .[test]
- ./benchmarks/run_profiling.sh
artifacts:
paths:
- prof
doctest:
stage: test
script:
- pip3 install --editable .[doc]
# doctest does not detect tests in code files during the first run.
# add a dummy build to generate .rst files before the actual tests
- sphinx-build -b dummy docs/source docs/build
- sphinx-build -b doctest docs/source docs/build
documentation:
stage: docs
variables:
GIT_STRATEGY: clone
GIT_DEPTH: 0 # to have all tags
script:
- pip3 install --editable .[doc]
- sphinx-build docs/source docs/build
- mv docs/build public/
artifacts:
paths:
- public
pages:
stage: deploy
script: "true"
artifacts:
paths:
- public
only:
- main
build:
stage: build
variables:
GIT_STRATEGY: clone
GIT_DEPTH: 0 # to have all tags
script:
- pip install build
- python -m build
artifacts:
paths:
- dist
pypi_test_release:
stage: release
dependencies:
- build
script:
- pip install twine
- python -m twine upload --verbose --skip-existing -r testpypi -u __token__ -p ${TEST_PYPI_TOKEN} dist/*
artifacts:
paths:
- dist
only:
- main
- tags
pypi_release:
stage: release
dependencies:
- build
script:
- pip install twine
- python -m twine upload --verbose -u __token__ -p ${PYPI_TOKEN} dist/*
artifacts:
paths:
- dist
only:
- tags