-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
78 lines (69 loc) · 1.83 KB
/
.gitlab-ci.yml
File metadata and controls
78 lines (69 loc) · 1.83 KB
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
default:
image: "registry.gitlab.isc.org/isc-projects/forge:latest"
tags:
- linux
- aws
- runner-manager
- amd64
.rules: &rules
rules:
# Do not run on MR creation.
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: never
# Run on any other event, including push to MR branch and push to master.
- when: always
.get_modified_python_scripts: &get_modified_python_scripts
- |
MODIFIED_PYTHON_SCRIPTS=
for i in $(git diff --name-only $(git merge-base origin/master HEAD)); do
if echo ${i} | grep -E '.py$' > /dev/null 2>&1; then
if ! echo ${PYTHON_EXCLUDE} | grep -F "${i}" > /dev/null 2>&1; then
if test -f "${i}"; then
MODIFIED_PYTHON_SCRIPTS+=" ${i}"
fi
fi
fi
done
if test -z "${MODIFIED_PYTHON_SCRIPTS}"; then
echo "No python scripts to check. Exiting early."
exit 0
else
echo "Checking python scripts: ${MODIFIED_PYTHON_SCRIPTS}"
fi
bandit:
<<: *rules
script:
- *get_modified_python_scripts
- ./lint.sh --bandit ${MODIFIED_PYTHON_SCRIPTS}
pages:
rules:
# Deploy docs only on merge to master.
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: on_success
script:
# Add __init__.py files.
- ./lint.sh --add-init.py
# Generate docs.
- pydoctor --docformat restructuredtext --html-output public .
artifacts:
paths:
- public
pycodestyle:
<<: *rules
script:
- *get_modified_python_scripts
- ./lint.sh --pycodestyle ${MODIFIED_PYTHON_SCRIPTS}
pydocstyle:
<<: *rules
script:
- *get_modified_python_scripts
- ./lint.sh --pydocstyle ${MODIFIED_PYTHON_SCRIPTS}
pydoctor:
<<: *rules
script:
- ./lint.sh --pydoctor
pylint:
<<: *rules
script:
- *get_modified_python_scripts
- ./lint.sh --pylint ${MODIFIED_PYTHON_SCRIPTS}