-
Notifications
You must be signed in to change notification settings - Fork 8
/
.gitlab-ci.yml
158 lines (145 loc) · 5.22 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
stages:
- .pre
- static_analysis
- test
include:
- local: 'ci_tools/reusable_ci_jobs.yml'
cmake_tests:
extends: .cmake_tests
image: ghcr.io/gyselax/gyselalibxx_env
variables:
RELATIVE_RESTART_TOLERANCE: '0.0'
ABSOLUTE_RESTART_TOLERANCE: '0.0'
TOOLCHAIN: '${CI_PROJECT_DIR}/toolchains/docker.gyselalibxx_env/tests_toolchain.cmake'
cmake_tests_Release:
extends: .cmake_tests
image: ghcr.io/gyselax/gyselalibxx_env
variables:
RELATIVE_RESTART_TOLERANCE: '0.0'
ABSOLUTE_RESTART_TOLERANCE: '0.0'
TOOLCHAIN: '${CI_PROJECT_DIR}/toolchains/docker.gyselalibxx_env/tests_release_toolchain.cmake'
cmake_tests_Release_OMP:
extends: .cmake_tests
image: ghcr.io/gyselax/gyselalibxx_env
variables:
RELATIVE_RESTART_TOLERANCE: '1e-14'
ABSOLUTE_RESTART_TOLERANCE: '1e-14'
TOOLCHAIN: '${CI_PROJECT_DIR}/toolchains/docker.gyselalibxx_env/tests_release_omp_toolchain.cmake'
before_script: |
. ${CI_PROJECT_DIR}/toolchains/docker.gyselalibxx_env/tests_omp_environment.sh
cmake_tests_Release_GPU:
extends: .cmake_tests
tags:
- persee
variables:
RELATIVE_RESTART_TOLERANCE: '1e-14'
ABSOLUTE_RESTART_TOLERANCE: '1e-14'
TOOLCHAIN: '${CI_PROJECT_DIR}/toolchains/v100.persee/toolchain.cmake'
before_script: |
. ${CI_PROJECT_DIR}/toolchains/v100.persee/environment.sh
indentation:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
stage: static_analysis
needs: []
image: ghcr.io/gyselax/gyselalibxx_env
variables:
GIT_SUBMODULE_STRATEGY: recursive
script: |
./bin/indent -td
python_best_practices:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
stage: static_analysis
needs: []
image: ghcr.io/gyselax/gyselalibxx_env
variables:
GIT_SUBMODULE_STRATEGY: recursive
before_script:
export PYTHONPATH="./post-process/PythonScripts"
script: |
pylint $(find tests -iname *.py)
pylint $(find doc -iname *.py)
pylint $(find ci_tools -iname *.py)
# Find all files with no extension or a .py extension in post-process/PythonScripts/
POST_PROCESS_PYTHON_FILES=$(find post-process/PythonScripts/ -type f ! -name "*.*"; find post-process/PythonScripts -iname *.py)
# Get pylint errors without failing
pylint ${POST_PROCESS_PYTHON_FILES} > post_process_errors.txt || true
# Filter errors on changed files
git config --global --add safe.directory $(pwd)
git fetch origin main
for f in $(git diff origin/main --name-only); do grep $f post_process_errors.txt || true; done | tee filtered_errors.txt
# Raise an error if post-process in filtered errors
! grep "post-process" filtered_errors.txt >/dev/null
public_mirror:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
tags: [ outssh ]
needs: []
image: ghcr.io/gyselax/gyselalibxx_env
variables:
GIT_SUBMODULE_STRATEGY: recursive
script: ./bin/public_mirror
documentation:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
stage: static_analysis
needs: []
image: ghcr.io/gyselax/gyselalibxx_env
before_script: |
git config --global --add safe.directory $CI_PROJECT_DIR
git fetch origin ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME} --recurse-submodules=no
script: |
rm -rf build || true
# Make docs
cmake -DGYSELALIBXX_COMPILE_SOURCE=OFF -DGYSELALIBXX_BUILD_DOCUMENTATION=1 -B build-docs .
cmake --build build-docs
# Get files which have changed in this merge request
git diff origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}..HEAD --no-indent-heuristic --unified=0 --output=pull_diff.txt --no-color
# Filter documentation messages to only complain about modified files
python3 ci_tools/check_documentation.py pull_diff.txt build-docs/docs/doxygen.log
git diff origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}..HEAD --no-indent-heuristic --unified=0 --output=pull_new_files.txt --no-color --diff-filter=A
python3 ci_tools/check_readme_presence.py pull_new_files.txt
allow_failure: true
markdown_best_practices:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
stage: static_analysis
needs: []
image: ghcr.io/gyselax/gyselalibxx_env
variables:
GIT_SUBMODULE_STRATEGY: recursive
script: |
MARKDOWN_FILES=$(find . -name "*.md" -not -path "./vendor/*")
MARKDOWN_FILES="$MARKDOWN_FILES $(find ./vendor/sll/ -name '*.md')"
echo $MARKDOWN_FILES
set +e
python3 ci_tools/markdown_linter.py ${MARKDOWN_FILES}
allow_failure:
exit_codes: 2
cppcheck_static_analysis:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
stage: static_analysis
needs: [ setup_env_mr ]
image: ghcr.io/gyselax/gyselalibxx_env
variables:
GIT_SUBMODULE_STRATEGY: recursive
script: |
set +e
python3 ci_tools/gyselalib_static_analysis.py ${CHANGED_FILES}
allow_failure:
exit_codes: [1, 2] # Allow failure due to style or error but not fatal
cmake_static_analysis:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
stage: static_analysis
needs: [ setup_env_mr ]
image: ghcr.io/gyselax/gyselalibxx_env
variables:
GIT_SUBMODULE_STRATEGY: recursive
script: |
python3 ci_tools/cmake_checker.py