-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
76 lines (70 loc) · 1.7 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
variables:
PYTHON_ORB_VERSION: "2.0.3"
NODE_ORB_VERSION: "5.0.1"
CACHE_VERSION: "v4"
GLOBAL_DOCKER_IMAGE: "cimg/python:3.10-node"
VERSION_TAG_REGEX: "/^v\\d+\\.\\d+\\.\\d+$/" # version regex vx.x.x (i.e. v1.2.3)
stages:
- test
- deploy
.default:
image: $GLOBAL_DOCKER_IMAGE
before_script:
- rm -rf $HOME/.poetry/bin/poetry
- curl -sSL https://install.python-poetry.org | python3 -
- poetry --version
- poetry install
- echo "tag- ${CI_COMMIT_TAG}"
run-unit-tests:
stage: test
image: cimg/python:3.10-node
script:
- poetry install
- poetry run pytest -p no:warnings -v --cov=parse_emails --cov-report=html
artifacts:
paths:
- integration-test-results
- coverage_html_report
after_script:
- if [ -n "$COVERALLS_REPO_TOKEN" ]; then
pip install coveralls;
coveralls;
else
echo "Skipping coveralls";
fi
parallel:
matrix:
- PYTHON_VERSION: ["3.8", "3.9", "3.10"]
precommit-checks:
stage: test
extends: .default
script:
- cp .pre-commit-config.yaml pre-commit-cache-key.txt
- poetry run python --version --version >> pre-commit-cache-key.txt
- poetry run pre-commit --version
- poetry run pre-commit run -a
- poetry run pytest --collect-only .
cache:
key: v1-pc-cache-${CI_COMMIT_SHA}
paths:
- ~/.cache/pre-commit
build:
stage: test
extends: .default
script:
- poetry build
artifacts:
paths:
- dist
deploy:
stage: deploy
extends: .default
script:
- poetry publish -u __token__ -p ${PYPI_TOKEN}
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/'
when: manual
dependencies:
- run-unit-tests
- precommit-checks
- build