-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
97 lines (88 loc) · 1.94 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
image: python:3.8.10
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
stages:
- pre
- build
- test
- review
- deploy
cache:
paths:
- .cache/pip
- venv/
build-job:
stage: build
script:
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip3 install -r requirements.txt
- pip3 install -e .
- echo "Build success"
check-job:
stage: test
artifacts:
untracked: true
script:
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip3 install -r requirements.txt
- pip3 install -e .
- pip3 install pytest
- pip3 install coverage
- coverage run --source ./monee -m pytest
- coverage xml
- coverage report
pylint-job:
stage: review
script:
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip3 install -r requirements.txt
- pip3 install -e .
- pip3 install pylint
- pylint monee
allow_failure:
exit_codes:
- 1
sonarcloud-check:
stage: review
image:
name: noenv/sonar-scanner:latest
entrypoint: [""]
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
dependencies:
- check-job
script:
- sonar-scanner
only:
- merge_requests
- main
- development
upload-job:
stage: deploy
variables:
TWINE_USERNAME: $TWINE_USERNAME
TWINE_PASSWORD: $TWINE_PASSWORD
only:
- tags
except:
- branches
script:
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip3 install -r requirements.txt
- pip3 install -e .
- pip3 install twine
- python setup.py sdist bdist_wheel
- twine check dist/*
- twine upload dist/* -u $TWINE_USERNAME -p $TWINE_PASSWORD