[ci skip] Reorganize .gitlab-ci.yml
[alexxy/gromacs.git] / admin / gitlab-ci / lint.gitlab-ci.yml
1 # Repository cleanliness. Source tidiness, linting, and policy compliance.
2
3 build-clang-tidy:
4   extends:
5     - .build-clang
6     - .clang7-template
7   stage: source-check
8   needs:
9     - job: simple-build
10       artifacts: false
11     - job: configure-clang-tidy
12       artifacts: true
13   variables:
14     BUILD_DIR: build-clang-tidy
15     COMPILER_MAJOR_VERSION: 7
16     EXTRA_INSTALLS: clang-tidy-$COMPILER_MAJOR_VERSION
17   except:
18     variables:
19       - $GROMACS_RELEASE
20
21 run-clang-format:
22   extends:
23     - .binary-build-template
24     - .no-cache-template
25     - .variables-template
26     - .tags-template
27     - .clang-before-script-template
28     - .build-clang-template
29     - .clang7-template
30   stage: source-check
31   when: always
32   needs:
33     - job: simple-build
34       artifacts: false
35   variables:
36     KUBERNETES_CPU_LIMIT: 1
37     KUBERNETES_CPU_REQUEST: 1
38     KUBERNETES_MEMORY_LIMIT: 2Gi
39     COMPILER_MAJOR_VERSION: 7
40     EXTRA_INSTALLS: clang-format-$COMPILER_MAJOR_VERSION
41   except:
42     variables:
43       - $GROMACS_RELEASE
44   script:
45     - export CLANG_FORMAT=clang-format-$COMPILER_MAJOR_VERSION
46     - admin/clang-format.sh check --rev=HEAD^ --warnings=clang-format.log
47     - grep -iq "needs formatting" clang-format.log | tee formatting.txt || true
48     - if [ -s formatting.txt ] ; then echo "clang-format.sh found issues"; exit 1; fi
49   artifacts:
50     when: on_failure
51     paths:
52       - clang-format.log
53       - formatting.txt
54
55 run-copyright-check:
56   extends:
57     - .binary-build-template
58     - .no-cache-template
59     - .variables-template
60     - .tags-template
61     - .clang-before-script-template
62     - .build-clang-template
63     - .clang7-template
64   stage: source-check
65   when: always
66   needs:
67     - job: simple-build
68       artifacts: false
69   variables:
70     KUBERNETES_CPU_LIMIT: 1
71     KUBERNETES_CPU_REQUEST: 1
72     KUBERNETES_MEMORY_LIMIT: 2Gi
73   except:
74     variables:
75       - $GROMACS_RELEASE
76   script:
77     - admin/copyright.sh check --rev=HEAD^ --warnings=copyright.log
78     - grep -iq "copyright year" copyright.log | tee years.log || true
79     - grep -iq "copyright header" copyright.log | tee headers.log || true
80     - if [[ -s years.log || -s headers.log ]] ; then
81       echo "Copyright information needs updating" ;
82       exit 1 ;
83       fi
84   artifacts:
85     when: on_failure
86     paths:
87       - copyright.log
88       - years.log
89       - headers.log
90
91 run-check-source:
92   extends:
93     - .no-cache-template
94     - .variables-template
95     - .tags-template
96     - .build-docs-binary-template
97     - .documentation-before-script-template
98   stage: source-check
99   needs:
100     - job: simple-build
101       artifacts: false
102     - job: build-docs
103       artifacts: true
104   variables:
105     KUBERNETES_CPU_LIMIT: 1
106     KUBERNETES_CPU_REQUEST: 1
107     KUBERNETES_MEMORY_LIMIT: 2Gi
108     BUILD_DIR: build-docs
109     COMPILER_MAJOR_VERSION: 7
110   except:
111     variables:
112       - $GROMACS_RELEASE
113   script:
114     - cd $BUILD_DIR
115     - cmake --build . --target check-source
116     - grep -qi "error" docs/doxygen/doxygen*log docs/doxygen/check-source.log | tee doxygenError.txt || true
117     - grep -qi "warning" docs/doxygen/doxygen*log docs/doxygen/check-source.log | tee -a doxygenError.txt || true
118     - if [ -s doxygenError.txt ] ; then echo "Found errors while running doxygen"; exit 1; fi
119   artifacts:
120     name: docs-artifacts-$CI_COMMIT_REF_SLUG
121     when: always
122     expire_in: 1 week
123     paths:
124       - $BUILD_DIR/docs/doxygen/doxygen-xml.log
125       - $BUILD_DIR/docs/doxygen/check-source.log