Use test conversion script from source
[gromacs.git] / admin / gitlab-ci / lint.gitlab-ci.yml
blob2d56adecc30193baf4d5593c599f3edb1a7ed887
1 # Repository cleanliness. Source tidiness, linting, and policy compliance.
3 clang-tidy:configure-push:
4   extends:
5     - .gromacs:base:configure
6     - .use-clang:base
7     - .rules:basic-push
8   image: gromacs/cmake-3.15.7-llvm-9-openmpi:master
9   tags: []
10   variables:
11     COMPILER_MAJOR_VERSION: 9
12     BUILD_DIR: build-clang-tidy
13     CMAKE_EXTRA_OPTIONS: -DCLANG_TIDY=clang-tidy-$COMPILER_MAJOR_VERSION -DGMX_CLANG_TIDY=ON -DGMX_COMPILER_WARNINGS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
15 clang-tidy:configure-schedule:
16   extends:
17     - .gromacs:base:configure
18     - .use-clang:base
19     - .rules:nightly-not-for-release
20   image: gromacs/cmake-3.15.7-llvm-9-openmpi:master
21   tags: []
22   variables:
23     COMPILER_MAJOR_VERSION: 9
24     BUILD_DIR: build-clang-tidy
25     CMAKE_EXTRA_OPTIONS: -DCLANG_TIDY=clang-tidy-$COMPILER_MAJOR_VERSION -DGMX_CLANG_TIDY=ON -DGMX_COMPILER_WARNINGS=ON
27 clang-tidy:build:
28   extends:
29     - .gromacs:base:build
30     - .use-ccache
31     - .variables:default
32     - .rules:nightly-not-for-release
33   stage: source-check
34   image: gromacs/cmake-3.15.7-llvm-9-openmpi:master
35   needs:
36     - job: clang-tidy:configure-schedule
37   variables:
38     BUILD_DIR: build-clang-tidy
40 clang-tidy:test:
41   extends:
42     - .gromacs:base:build
43     - .variables:default
44     - .rules:basic-push
45   stage: source-check
46   image: gromacs/cmake-3.15.7-llvm-9-openmpi:master
47   tags: []
48   needs:
49     - job: clang-tidy:configure-push
50   variables:
51     COMPILER_MAJOR_VERSION: 9
52     BUILD_DIR: build-clang-tidy
53     EXTRA_INSTALLS: clang-tidy-$COMPILER_MAJOR_VERSION
54     KUBERNETES_CPU_LIMIT: 4
55     KUBERNETES_CPU_REQUEST: 2
56     KUBERNETES_MEMORY_LIMIT: 4Gi
57   script:
58     # TODO (issue #3272) `master` is not appropriate for use on release-xxxx branches, how should we handle that?
59     - REV=$(git fetch -q https://gitlab.com/gromacs/gromacs.git master && git show -s --pretty=format:"%h" `git merge-base FETCH_HEAD HEAD`)
60     - HEAD_REV=$(git show -s --pretty=format:"%h" HEAD)
61     - if [[ "$REV" == "$HEAD_REV" ]] ; then
62         REV="HEAD~1" ;
63       fi
64     - echo "Revision used for branch point is $REV"
65     - git show -s $REV
66     - RUN_CLANG_TIDY=run-clang-tidy-$COMPILER_MAJOR_VERSION bash admin/clang-tidy.sh check --parallel=$KUBERNETES_CPU_LIMIT --warnings=clang-tidy.log --rev=$REV -B=$BUILD_DIR
67     - grep -i "found code issues" clang-tidy.log | tee code-lint.txt || true
68     - if [ -s code-lint.txt ] ; then echo "clang-tidy.sh found issues"; exit 1; fi
69   artifacts:
70     when: on_failure
71     paths:
72       - clang-tidy.log
73       - code-lint.txt
75 clang-format:
76   extends:
77     - .variables:default
78     - .rules:basic-push
79   cache: {}
80   stage: pre-build
81   image: gromacs/ci-docs-llvm:master
82   tags: []
83   variables:
84     COMPILER_MAJOR_VERSION: 7
85     KUBERNETES_CPU_LIMIT: 1
86     KUBERNETES_CPU_REQUEST: 1
87     KUBERNETES_MEMORY_LIMIT: 2Gi
88     EXTRA_INSTALLS: clang-format-$COMPILER_MAJOR_VERSION
89   script:
90     # TODO (issue #3272) `master` is not appropriate for use on release-xxxx branches, how should we handle that?
91     - REV=$(git fetch -q https://gitlab.com/gromacs/gromacs.git master && git show -s --pretty=format:"%h" `git merge-base FETCH_HEAD HEAD`)
92     - HEAD_REV=$(git show -s --pretty=format:"%h" HEAD)
93     - if [[ "$REV" == "$HEAD_REV" ]] ; then
94         REV="HEAD~1" ;
95       fi
96     - echo "Revision used for branch point is $REV"
97     - git show -s $REV
98     - CLANG_FORMAT=clang-format-$COMPILER_MAJOR_VERSION admin/clang-format.sh check --rev=$REV --warnings=clang-format.log
99     - grep -i "needs formatting" clang-format.log | tee formatting.txt || true
100     - if [ -s formatting.txt ] ; then echo "clang-format.sh found issues"; exit 1; fi
101   artifacts:
102     when: on_failure
103     paths:
104       - clang-format.log
105       - formatting.txt
107 copyright-check:
108   extends:
109     - .variables:default
110     - .rules:basic-push
111   cache: {}
112   stage: pre-build
113   image: gromacs/ci-docs-llvm:master
114   tags: []
115   variables:
116     KUBERNETES_CPU_LIMIT: 1
117     KUBERNETES_CPU_REQUEST: 1
118     KUBERNETES_MEMORY_LIMIT: 2Gi
119   script:
120     # TODO (issue #3272) `master` is not appropriate for use on release-xxxx branches, how should we handle that?
121     - REV=$(git fetch -q https://gitlab.com/gromacs/gromacs.git master && git show -s --pretty=format:"%h" `git merge-base FETCH_HEAD HEAD`)
122     - HEAD_REV=$(git show -s --pretty=format:"%h" HEAD)
123     - if [[ "$REV" == "$HEAD_REV" ]] ; then
124         REV="HEAD~1" ;
125       fi
126     - echo "Revision used for branch point is $REV"
127     - git show -s $REV
128     - admin/copyright.sh check --rev=$REV --warnings=copyright.log
129     - grep -i "copyright year" copyright.log | tee years.log || true
130     - grep -i "copyright header" copyright.log | tee headers.log || true
131     - if [[ -s years.log || -s headers.log ]] ; then
132       echo "Copyright information needs updating" ;
133       exit 1 ;
134       fi
135   artifacts:
136     when: on_failure
137     paths:
138       - copyright.log
139       - years.log
140       - headers.log
142 check-source:
143   extends:
144     - .variables:default
145     - .docs:build
146     - .before_script:default
147     - .rules:basic-push
148   cache: {}
149   stage: source-check
150   tags: []
151   needs:
152     - job: docs:build
153       artifacts: true
154   variables:
155     KUBERNETES_CPU_LIMIT: 1
156     KUBERNETES_CPU_REQUEST: 1
157     KUBERNETES_MEMORY_LIMIT: 2Gi
158     BUILD_DIR: build-docs
159   script:
160     - cd $BUILD_DIR
161     - cmake --build . --target check-source
162     - awk '/warning.*include style.*order/,/You can use.*rst|^$/' docs/doxygen/check-source.log | tee doxygenError.txt || true
163     - awk '/Traceback/,/.*rror|^$/' docs/doxygen/doxygen*log docs/doxygen/check-source.log | tee -a doxygenError.txt || true
164     - awk '/warning:/,/in doxygen.*|^$/' docs/doxygen/doxygen*log | tee -a doxygenError.txt || true
165     - if [ -s doxygenError.txt ] ; then echo "Found errors while running doxygen"; exit 1; fi
166   artifacts:
167     name: docs-artifacts-$CI_COMMIT_REF_SLUG
168     when: always
169     expire_in: 1 week
170     paths:
171       - $BUILD_DIR/docs/doxygen/doxygen-xml.log
172       - $BUILD_DIR/docs/doxygen/check-source.log
174 linkchecker:
175   extends:
176     - .webpage:build
177     - .rules:nightly-not-for-release
178   stage: nightly-build
179   dependencies:
180     - webpage:build
181   variables:
182     KUBERNETES_CPU_LIMIT: 1
183     KUBERNETES_CPU_REQUEST: 1
184     KUBERNETES_MEMORY_LIMIT: 2Gi
185     BUILD_DIR: build-docs
186   script:
187     - cd $BUILD_DIR
188     - linkchecker docs/html/index.html -f $CI_PROJECT_DIR/docs/linkcheckerrc -Fxml --ignore-url html-full
189       --ignore-url html-user --ignore-url html-lib --ignore-url .tar.gz --ignore-url _sources
190       -o xml
191   artifacts:
192     reports:
193       junit: $BUILD_DIR/linkchecker-out.xml