-
Notifications
You must be signed in to change notification settings - Fork 43
/
.gitlab-ci.yml
57 lines (50 loc) · 1.97 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
include:
- project: perun/common
file: /templates/.gitlab-ci-template.yml
variables:
# release from production branch instead of main
RELEASE_FROM_PRODUCTION: 1
python-files-check:
image: registry.gitlab.ics.muni.cz:443/perun/ci/pipeline-components/minideb:latest
stage: test
script:
# Find files with Python shebang
- >
python_shebang_files=$(find . -type f -not -path "./node_modules/*" -not -path "./vendor/*" -not -path "./venv/*" -exec awk '
/^#!.*python/{print FILENAME}
{nextfile}' {} +)
# Extract 'extend-include' files from pyproject.toml
- >
extend_include_files=$(grep -oP 'extend-include\s*=\s*\[\K[^]]+' pyproject.toml | tr -d '[:space:]')
- result=0
# Check if Python shebang files are in extend-include list
- >
for file in $python_shebang_files; do
if [[ ! $extend_include_files =~ "$file" ]]; then
echo "$file is NOT included in 'extend-include'"
result=1
fi
done
- >
exit $result
shellcheck:
stage: test
image: registry.gitlab.com/pipeline-components/shellcheck:latest
script:
# anything ending on .sh, should be shell script
- |
find . -name .git -type d -prune -o -type f -name \*.sh -print0 |
xargs -0 -P $(nproc) -r -n1 shellcheck -S error
# magic, any file with a valid shebang should be scanned aswell
- |
find . -name .git -type d -prune -o -type f -regex '.*/[^.]*$' -print0 |
xargs -0 -P $(nproc) -r -n1 sh -c 'FILE="$0"; if head -n1 "$FILE" |grep -q "^#\\! \?/.\+\(ba|d|k\)\?sh" ; then shellcheck -S error "$FILE" ; else /bin/true ; fi '
check_deprecated_modules:
when: manual
image: python:3.11-slim
script:
- python -m venv venv
- source venv/bin/activate
- pip install -r .gitlab/ci/requirements.txt
- python .gitlab/ci/check_deprecated_modules.py
allow_failure: true