-
Notifications
You must be signed in to change notification settings - Fork 16
/
.gitlab-ci.yml
56 lines (46 loc) · 1.13 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
image: python:3.10.5
variables:
PIP_CACHE_DIR: "${CI_PROJECT_DIR}/.cache/pip"
stages:
- publish
- test
cache:
key: "${CI_COMMIT_REF_SLUG}"
paths:
- .cache/pip
- .venv
.with_twine:
before_script:
- python -m pip install --upgrade pip
- pip install setuptools wheel twine build pip-licenses
gather-licences:
extends: .with_twine
stage: publish
script:
- pip-licenses --from=mixed --order=license --with-system -f markdown --output-file LICENSES.md
artifacts:
when: always
paths:
- LICENSES.md
expire_in: 4 week
publish:
extends: .with_twine
stage: publish
rules:
- if: '$CI_COMMIT_TAG != null'
script:
- python -m build --sdist --wheel .
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/packages/pypi dist/*
check_formatting:
extends: .with_twine
stage: test
script:
- pip install .[dev]
- ruff check . --exclude docs/
unit_test:
extends: .with_twine
stage: test
script:
- pip install .[dev]
- pip install pytest
- pytest tests/