-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
106 lines (93 loc) · 2.24 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
---
image: "python:3.7"
variables:
SAST_EXCLUDED_ANALYZERS: "eslint"
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
PIP_INDEX_URL: "https://artefakt.dev.sbb.berlin/repository/pypi-central/simple"
cache:
- key:
files:
- requirements.txt
- requirements-dev.txt
paths:
- .cache/pip/
- .venv/
- key: "${CI_PIPELINE_ID}"
paths:
- test-reports/
.prepare_sast:
before_script:
- export HTTP_PROXY=http://proxy.sbb.spk-berlin.de:3128
- export HTTPS_PROXY=http://proxy.sbb.spk-berlin.de:3128
- apk --update add build-base
.prepare_tests:
before_script:
- export HTTP_PROXY=http://proxy.sbb.spk-berlin.de:3128
- export HTTPS_PROXY=http://proxy.sbb.spk-berlin.de:3128
- python --version
- pip install --upgrade pip
- pip install -e .[dev]
- mkdir -p /data/log
include:
- template: Security/SAST.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml
stages:
- analysis
- test
- sonarqube
linting:
stage: analysis
extends:
- .prepare_tests
script:
- flake8 --exit-zero --statistics --doctests ocrd_butler/ tests/
tests:
stage: test
extends:
- .prepare_tests
script:
- export PROFILE=test
- pytest tests --doctest-modules ocrd_butler
- coverage xml
coverage: '/^TOTAL\s+\d+\s+\d+\s+\d+\s+\d+\s+(\d+\%)/'
artifacts:
when: always
paths:
- test-reports/coverage.xml
- test-reports/test-report.xml
reports:
junit: test-reports/test-report.xml
cobertura: test-reports/coverage.xml
expire_in: 80 weeks
bandit-sast:
extends:
- .prepare_sast
- .sast-analyzer
artifacts:
when: always
reports:
sast: gl-sast-report.json
paths:
- gl-sast-report.json
expire_in: 80 weeks
semgrep-sast:
extends:
- .prepare_sast
- .sast-analyzer
artifacts:
when: always
reports:
sast: gl-sast-report.json
paths:
- gl-sast-report.json
expire_in: 80 weeks
sonarqube-check:
stage: sonarqube
variables:
SONAR_TOKEN: $SONAR_TOKEN
SONAR_HOST_URL: "http://code-quality.dev.sbb.berlin:9000"
GIT_DEPTH: 0
image:
name: "sonarsource/sonar-scanner-cli:latest"
script:
- sonar-scanner
...