Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
[MXNET-859] Add a clang-tidy stage to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
KellenSunderland committed Aug 25, 2018
1 parent ad34e05 commit 213625d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
10 changes: 10 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,16 @@ core_logic: {
}
}
},
'CPU: Clang Tidy': {
node(NODE_LINUX_CPU) {
ws('workspace/build-cpu-clang50') {
timeout(time: max_time, unit: 'MINUTES') {
utils.init_git()
utils.docker_run('ubuntu_cpu', 'build_ubuntu_cpu_clang_tidy', false)
}
}
}
},
'CPU: Clang 3.9 MKLDNN': {
node(NODE_LINUX_CPU) {
ws('workspace/build-cpu-mkldnn-clang39') {
Expand Down
7 changes: 6 additions & 1 deletion ci/docker/install/ubuntu_clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main" && \
apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main" && \
apt-get update && \
apt-get install -y clang-3.9 clang-6.0 && \
apt-get install -y clang-3.9 clang-6.0 clang-tidy-6.0 && \
clang-3.9 --version && \
clang-6.0 --version

# Use llvm's master version of run-clang-tidy.py. This version has mostly minor updates, but
# importantly will properly return a non-zero exit code when an error is reported in clang-tidy.
# Please remove the below if we install a clang version higher than 6.0.
wget https://raw.githubusercontent.com/llvm-mirror/clang-tools-extra/7654135f0cbd155c285fd2a37d87e27e4fff3071/clang-tidy/tool/run-clang-tidy.py -O /usr/lib/llvm-6.0/share/clang/run-clang-tidy.py
26 changes: 26 additions & 0 deletions ci/docker/runtime_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,32 @@ build_ubuntu_cpu_clang60() {
-j$(nproc)
}

build_ubuntu_cpu_clang_tidy() {
set -ex

export CXX=clang++-6.0
export CC=clang-6.0
export CLANG_TIDY=/usr/lib/llvm-6.0/share/clang/run-clang-tidy.py

pushd .
cd /work/build
cmake \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DUSE_CUDA=OFF \
-DUSE_MKL_IF_AVAILABLE=OFF \
-DUSE_OPENCV=ON \
-DCMAKE_BUILD_TYPE=Debug \
-G Ninja \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
/work/mxnet

ninja -v
cd /work/mxnet
$CLANG_TIDY -p /work/build -j $(nproc) -clang-tidy-binary clang-tidy-6.0 /work/mxnet/src
popd
}

build_ubuntu_cpu_clang39_mkldnn() {
set -ex

Expand Down

0 comments on commit 213625d

Please sign in to comment.