-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy path.gitlab-ci.yml
120 lines (106 loc) · 2.61 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# SPDX-FileCopyrightText: 2019–2025 Pynguin Contributors
#
# SPDX-License-Identifier: MIT
image: python:${PYTHON_VERSION}
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID # Execute jobs in merge request context
- if: $CI_COMMIT_BRANCH == 'main' # Execute jobs when a new commit is pushed to main branch
cache:
key: virtualenv
paths:
- .venv/
- .cache/pip
- .cache/pypoetry
stages:
- build
- lint
- test
- security
- deploy
before_script:
- python --version
- pip install poetry
- poetry config virtualenvs.in-project true
- poetry install
.unit-tests: &unit-tests
stage: test
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
script:
- poetry run pytest -q --cov=pynguin --cov=tests --cov-branch --cov-report html:cov_html --cov-report xml:coverage.xml --cov-report=term-missing --junitxml=report.xml tests/
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit:
report.xml
paths:
- cov_html
needs: ["pre-commit", "reuse"]
unit-tests:python-3.10:
<<: *unit-tests
variables:
PYTHON_VERSION: '3.10-bookworm'
.nightly-tests:
only:
- schedules
stage: test
before_script:
- python --version
- pip install poetry
- poetry config virtualenvs.in-project true
- poetry install
- poetry add --group dev pytest-random-order
script:
- for ((i=1; i<=10; i++)); do echo "test run ${i}\n"; poetry run pytest -q --cov=pynguin --cov=tests --cov-branch --random-order --random-order-bucket=global ; done
needs: ["unit-tests:python-3.10"]
nightly-tests:python-3.10:
extends: .nightly-tests
variables:
PYTHON_VERSION: '3.10-bookworm'
memory-profile:
only:
- schedules
stage: lint
image: python:3.10-bookworm
before_script:
- pip install poetry
- poetry config virtualenvs.in-project true
- poetry install
- poetry add --group dev memray pytest-memray
script:
- poetry run pytest --memray tests/
needs: ["pre-commit", "reuse"]
pre-commit:
stage: lint
image: python:3.10-bookworm
script:
- poetry run pre-commit run --all-files
needs: []
mypy:
stage: lint
image: python:3.10-bookworm
script:
- poetry run mypy
needs: ["pre-commit"]
sphinx:
stage: build
image: python:3.10-bookworm
script:
- poetry run sphinx-build docs docs/_build
artifacts:
expire_in: 1 week
paths:
- docs/_build
# check license declarations etc.
reuse:
stage: lint
image:
name: fsfe/reuse:latest
entrypoint: [""]
before_script:
- python --version
script:
- reuse lint
needs: []