-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
65 lines (58 loc) · 1.54 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
stages:
- check
- test
- build
variables:
GIT_SUBMODULE_STRATEGY: recursive
default:
image: python:3.9
before_script:
- pip install poetry==1.4.0
- poetry config --local cache-dir $PWD/.poetry/cache
- poetry config --local virtualenvs.in-project true
cache:
key: "${CI_JOB_NAME}"
paths:
- .poetry
- .venv
check-linters:
stage: check
rules:
- if: $CI_COMMIT_BRANCH == 'master'
- if: $CI_COMMIT_BRANCH =~ /ci$/
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'master'
script:
- poetry install
- echo "Checking with Flake8"
- poetry run flake8 yastyleguide
- echo "Checking with MyPy"
- poetry run mypy yastyleguide
tests:
stage: test
rules:
- if: $CI_COMMIT_BRANCH == 'master'
- if: $CI_COMMIT_BRANCH =~ /ci$/
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'master'
script:
- poetry install
- echo "Run tests"
- poetry run pytest .
build-release:
stage: build
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH =~ /ci$/
script:
- echo "Building to python package."
- poetry build
- echo "Publish package to public pypi."
- poetry config pypi-token.pypi $PYPI_TOKEN_PYPI
- poetry publish
- echo "Publish package to gitlab pypi."
- poetry config repositories.gitlab "https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/packages/pypi"
- poetry config http-basic.gitlab gitlab-ci-token "$CI_JOB_TOKEN"
- poetry publish --repository gitlab
artifacts:
expire_in: never
paths:
- $CI_PROJECT_DIR/dist