-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
57 lines (51 loc) · 1.63 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
image: "python:3.7-slim-stretch"
before_script:
- python --version
- if [ "$CI_COMMIT_TAG" == "" ]; then export PYPI_VERSION="${CI_COMMIT_BEFORE_SHA}";
else export PYPI_VERSION="${CI_COMMIT_TAG}"; fi
stages:
- build_stage
- test_stage
- deploy_stage
build:
stage: build_stage
script:
- python3 -m pip install --upgrade pip setuptools wheel
- python3 setup.py sdist bdist_wheel
artifacts:
paths:
- dist/
pylint:
stage: test_stage
script:
- apt-get update && apt-get -y install gcc
- python3 -m pip install pylint pylint-exit anybadge
- mkdir pylint
- FILES=$(find . -name "*.py" | grep -v "ci-scripts/")
- pylint --output-format=text ${FILES} | tee ./pylint/pylint.log || pylint-exit $?
- PYLINT_SCORE=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' ./pylint/pylint.log)
- anybadge --label=Pylint --file=pylint/pylint.svg --value=$PYLINT_SCORE 2=red 4=orange 8=yellow 10=green
- echo "Pylint score is $PYLINT_SCORE"
artifacts:
paths:
- pylint/
test_install:
stage: test_stage
script:
- pip install dist/*.whl
artifacts:
paths:
- dist/
release_deploy:
stage: deploy_stage
only:
- tags
script:
- python3 -m pip install --upgrade twine
- twine check dist/*
- echo quit | openssl s_client -showcerts -servername cencoreg.cencosud.corp -connect cencoreg.cencosud.corp:5000 > cacert.pem
- export PIP_CERT=`pwd`/cacert.pem
- python3 -m twine upload --repository-url https://cencoreg.cencosud.corp/repository/pyprod/ dist/* --cert $PIP_CERT --username $NEXUS_USER --password $NEXUS_PWD
artifacts:
paths:
- dist/