-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
121 lines (111 loc) · 3.1 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
121
image: python:3.8-buster
stages:
- test
- package
- upload
- release
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic"
all_tests:
stage: test
before_script:
- apt-get update && apt-get install -y build-essential libldap2-dev libsasl2-dev
- pip3 install virtualenv
- virtualenv -q .venv
- source .venv/bin/activate
- pip install -U -r requirements.txt
- pip install -U -r requirements_dev.txt
script:
- make test
bandit:
stage: test
before_script:
- pip3 install virtualenv
- virtualenv -q .venv
- source .venv/bin/activate
- pip install bandit~=1.6.2
script:
- make bandit
mypy:
stage: test
before_script:
- apt-get update && apt-get install -y build-essential libldap2-dev libsasl2-dev
- pip3 install virtualenv
- virtualenv -q .venv
- source .venv/bin/activate
- pip install -U -r requirements.txt
- pip install -U -r requirements_dev.txt
script:
- make mypy
allow_failure: true
pylint:
stage: test
before_script:
- apt-get update && apt-get install -y build-essential libldap2-dev libsasl2-dev
- pip3 install virtualenv
- virtualenv -q .venv
- source .venv/bin/activate
- pip install -U -r requirements.txt
- pip install -U -r requirements_dev.txt
script:
- make pylint
package:
stage: package
before_script:
- pip3 install virtualenv
- virtualenv -q .venv
- source .venv/bin/activate
- pip install -U build
script:
- make package
artifacts:
paths:
- dist/
expire_in: 2 months
upload_job:
stage: upload
image: curlimages/curl:latest
needs:
- job: package
artifacts: true
rules:
- if: $CI_COMMIT_TAG # only run when we publish a new tag
script:
- 'ls dist'
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file dist/*.whl "${PACKAGE_REGISTRY_URL}/${CI_COMMIT_TAG}/wahlfang.whl"'
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file dist/*.tar.gz "${PACKAGE_REGISTRY_URL}/${CI_COMMIT_TAG}/wahlfang.tar.gz"'
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- job: upload_job
rules:
- if: $CI_COMMIT_TAG # only run when we publish a new tag
script:
- echo 'running release_job'
release:
name: 'Release $CI_COMMIT_TAG'
description: 'Created using the release-cli'
tag_name: '$CI_COMMIT_TAG'
ref: '$CI_COMMIT_TAG'
assets:
links:
- name: "wahlfang-${CI_COMMIT_TAG}.whl"
url: "${PACKAGE_REGISTRY_URL}/${CI_COMMIT_TAG}/wahlfang.whl"
- name: "wahlfang-${CI_COMMIT_TAG}.tar.gz"
url: "${PACKAGE_REGISTRY_URL}/${CI_COMMIT_TAG}/wahlfang.tar.gz"
publish_job:
stage: release
needs:
- job: package
artifacts: true
rules:
- if: $CI_COMMIT_TAG # only run when we publish a new tag
before_script:
- pip3 install virtualenv
- virtualenv -q .venv
- source .venv/bin/activate
- pip install -U twine
script:
- python -m twine upload dist/* -u $TWINE_USERNAME -p $TWINE_PASSWORD --non-interactive