-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
234 lines (210 loc) · 5.44 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
stages:
- lint
- test
- Test_Build
- Deploy
include:
- template: SAST.gitlab-ci.yml
- template: Dependency-Scanning.gitlab-ci.yml
- template: License-Scanning.gitlab-ci.yml
- template: Secret-Detection.gitlab-ci.yml
license_scanning:
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
when: always
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
.lint:
stage: lint
before_script:
- pip install -U pip
- pip install --cache-dir=~/.cache/pip/ -r requirements-dev.txt
script:
- make lint
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- ~/.cache/pip/
python-3.6-lint:
extends: ".lint"
image: python:3.6
python-3.7-lint:
extends: ".lint"
image: python:3.7
python-3.8-lint:
extends: ".lint"
image: python:3.8
python-3.9-lint:
extends: ".lint"
image: python:3.9
Coverage:
image: registry.gitlab.com/cyb3r-jak3/orca-test-image/orca-test-image:latest
allow_failure: true # Needed as the deepsource sometimes fails
stage: test
needs:
- python-3.6-lint
- python-3.7-lint
- python-3.8-lint
- python-3.9-lint
coverage: '/TOTAL\s*\d*\s*\d*\s*(\d*)%/'
artifacts:
paths:
- MetaStalk.log
- htmlcov/*
- metastalk_exports/*
before_script:
- curl https://deepsource.io/cli | sh
- curl --silent -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter; chmod +x ./cc-test-reporter; ./cc-test-reporter before-build
- pip install -U pip coverage --quiet
- apt-get update &&
apt-get upgrade -qq &&
apt-get install -qq make
script:
- pip install . --quiet
- make test
after_script:
- coverage report
- coverage html
- coverage xml
- bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Python -r coverage.xml
- ./cc-test-reporter after-build
- bash <(curl -s https://codecov.io/bash)
- ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml
orca_test:
stage: test
image: registry.gitlab.com/cyb3r-jak3/orca-test-image/orca-test-image:latest
needs:
- python-3.6-lint
- python-3.7-lint
- python-3.8-lint
- python-3.9-lint
artifacts:
paths:
- metastalk_exports/**
before_script:
- pip install . --quiet
script:
- metastalk ./ExamplePhotos --export pdf -t
- metastalk ./ExamplePhotos --export svg -t
- metastalk ./ExamplePhotos --export webp -t
- metastalk ./ExamplePhotos --export jpeg -t
- metastalk ./ExamplePhotos --export png -t
- metastalk ./ExamplePhotos --export html -t
- metastalk ./ExamplePhotos --export html_offline -t
.build:
stage: test
artifacts:
paths:
- dist/
- MetaStalk.egg-info/
before_script:
- pip install --cache-dir=~/.cache/pip/ -U setuptools wheel twine --quiet
script:
- make check-dist
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- ~/.cache/pip/
python-3.6-build:
needs:
- python-3.6-lint
extends: ".build"
image: python:3.6
python-3.7-build:
needs:
- python-3.7-lint
extends: ".build"
image: python:3.7
python-3.8-build:
needs:
- python-3.8-lint
extends: ".build"
image: python:3.8
python-3.9-build:
needs:
- python-3.9-lint
extends: ".build"
image: python:3.9
.test:
stage: Test_Build
before_script:
- pip install -U pip --quiet
script:
- pip install dist/*.whl
- pip show -f metastalk
- command -v metastalk
- metastalk ./ExamplePhotos/ -t -d
- metastalk ./ExamplePhotos/Panasonic_DMC-FZ30.jpg ./ExamplePhotos/DSCN0010.jpg -t -d
- pip uninstall metastalk -y; pip install .[image] --quiet
- pip uninstall metastalk -y; pip install .[all] --quiet
python-3.6-test:
needs:
- python-3.6-build
- Coverage
- orca_test
extends: ".test"
image: python:3.6
python-3.7-test:
needs:
- python-3.7-build
- Coverage
- orca_test
extends: ".test"
image: python:3.7
python-3.8-test:
needs:
- python-3.8-build
- Coverage
- orca_test
extends: ".test"
image: python:3.8
python-3.9-test:
needs:
- python-3.9-build
- Coverage
- orca_test
extends: ".test"
image: python:3.9
docker-bake:
stage: test
image: jdrouet/docker-with-buildx:stable
retry: 2
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
services:
- docker:dind
cache:
key: docker-bake
paths:
- ./.buildx-cache
before_script:
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes; docker buildx create --use
script:
- apk add --no-cache bash
- cat ./docker/run.sh | /bin/bash
Deploy_to_PyPi:
image: python:3.8
stage: Deploy
needs:
- python-3.6-build
- python-3.7-build
- python-3.8-build
- python-3.9-build
- python-3.6-test
- python-3.7-test
- python-3.8-test
- python-3.9-test
- Coverage
- orca_test
variables:
TWINE_USERNAME: $PYPI_USER
TWINE_PASSWORD: $PRODUCTION_PASSWORD
before_script:
- pip install -U pip setuptools twine --quiet
script:
- twine upload --verbose dist/*
- twine upload dist/* --repository-url https://push.fury.io/cyb3r-jak3 -u $GEM_TOKEN -p ""
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+.\d+.\d+/ && $CI_COMMIT_BRANCH == "master"'
when: always