-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
100 lines (88 loc) · 2.5 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
image: python:3.12
stages:
- build
- verify
- unit-test
- integration-test
- package
- release
- pages
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" # directory where python dependencies are stored
VENV_DIR: "$CI_PROJECT_DIR/venv" # directory where the virtual environment takes place
cache:
key: "$CI_COMMIT_REF_NAME" # environment variable which contains the name of the branch, the goal is to separate different branches results
paths:
- $PIP_CACHE_DIR # cache path for python package
- $VENV_DIR # cache path for virtual environment.
before_script:
- python -m venv $VENV_DIR # creates virtual environment
- source $VENV_DIR/bin/activate # activates virtual environmentt
- pip install --upgrade pip
- pip install --upgrade setuptools
compile:
stage: build
script:
- pip install -r requirements.txt --cache-dir $PIP_CACHE_DIR
- echo "Virtual environment and dependencies set up successfully."
allow_failure: false
prospector-analysis:
stage: verify
script:
# Run Prospector tool
- prospector
allow_failure: false
dependencies: []
bandit-analysis:
stage: verify
script:
# Run Bandit tool
- bandit -r ./application
- echo "Static analysis completed successfully."
allow_failure: false
dependencies: []
unit-test:
stage: unit-test
script:
- pytest tests/unit/
# Run unit tests in the 'tests/unit/' directory
allow_failure: false
artifacts:
paths:
- $CI_PROJECT_DIR/tests/unit/
dependencies: []
integration-test:
stage: integration-test
script:
- pytest tests/integration/
# Run integration tests in the 'tests/integration/' directory
allow_failure: false
artifacts:
paths:
- $CI_PROJECT_DIR/tests/integration/
dependencies: []
package:
stage: package
script:
- python setup.py sdist bdist_wheel
allow_failure: false
artifacts:
paths:
- dist/
release:
stage: release
script:
- twine upload -u __token__ -p $PYPI_TOKEN dist/*;
allow_failure: false
pages:
stage: pages
script:
- mkdocs build --clean # build the documentation, --clean ensure that previous build artifacts are removed before the new build
- mkdir .public # create the '.public' directory used to store doc build files
- cp -r public/* .public # copy the built documentation to the '.public' directory.
artifacts:
paths:
- public
- mkdocs.yml
only:
- main