-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
82 lines (77 loc) · 2.02 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
stages:
- lint
- build
- test
- publish
pre-commit:
stage: lint
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
image: python:3.9
before_script:
- pip install poetry==1.8.3
- poetry install
script:
- poetry run pre-commit run -v --all-files
build docs:
stage: build
rules:
- if: $CI_COMMIT_TAG
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- "docs/**/*"
- "kaquel/**/*"
- "poetry.lock"
image: python:3.9
before_script:
- pip install poetry==1.8.1
- poetry install
script:
- poetry run sphinx-build -M html docs docs/_build
artifacts:
paths:
- docs/_build/html
run tests:
stage: test
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- "kaquel/**/*"
- "tests/**/*"
- "poetry.lock"
- if: $CI_COMMIT_BRANCH == "develop"
- if: $CI_COMMIT_TAG
image: python:3.9
before_script:
- pip install poetry==1.8.3
- poetry install
script:
- poetry run pytest -v --cov-report=xml:coverage.xml
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
publish docs:
stage: publish
rules:
- if: $CI_COMMIT_TAG
image: debian:bookworm-slim
before_script:
- apt-get update -y
- apt-get install -y rsync openssh-client
- eval $(ssh-agent -s)
- mkdir ~/.ssh && chmod 700 ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" >~/.ssh/config
- chmod 400 "$SSH_PRIVATE_KEY"
- ssh-add "$SSH_PRIVATE_KEY"
script:
- rsync -Prlt --delete docs/_build/html/ [email protected]:kaquel
dependencies:
- build docs
publish package:
stage: publish
rules:
- if: $CI_COMMIT_TAG
image: python:3.9
before_script:
- pip install poetry==1.8.3
- poetry install
script:
- poetry publish --build