forked from startupmillio/alchql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
77 lines (60 loc) · 1.36 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
stages:
- test
- build
- deploy
test:
image: python:3.9
stage: test
services:
- postgres
except:
variables:
- $CI_COMMIT_MESSAGE =~ /hotfix/
variables:
PIP_CACHE_DIR: $CI_PROJECT_DIR/.cache/pip
PIP_DOWNLOAD_CACHE: $CI_PROJECT_DIR/.cache/pip_download_cache
cache:
key: ${CI_JOB_NAME}
paths:
- .cache
coverage: '/TOTAL.*\s+(\d+%)$/'
artifacts:
reports:
cobertura: coverage.xml
before_script:
- pip install .[test]
script:
- coverage run -m pytest
- coverage report -m --skip-covered
- coverage xml
black:
image: python:3.9
stage: test
allow_failure: true
except:
variables:
- $CI_COMMIT_MESSAGE =~ /hotfix/
variables:
PIP_CACHE_DIR: $CI_PROJECT_DIR/.cache/pip
PIP_DOWNLOAD_CACHE: $CI_PROJECT_DIR/.cache/pip_download_cache
cache:
key: ${CI_JOB_NAME}
paths:
- .cache
script:
- pip install black==22.3
- black --version
- black --check --diff ./
build package:
image: python:3.9
stage: build
only:
- main
before_script:
- pip install twine setuptools wheel
variables:
TWINE_USERNAME: gitlab-ci-token
TWINE_PASSWORD: $CI_JOB_TOKEN
script:
- python setup.py sdist bdist_wheel
- python -m twine upload --verbose --repository-url https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/packages/pypi dist/*