Skip to content

Commit

Permalink
CI: test code formation
Browse files Browse the repository at this point in the history
Test code formation with clang-format-11.
  • Loading branch information
psychocoderHPC committed Sep 1, 2021
1 parent d3a9ba7 commit 3ac491d
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,32 @@
include:
- local: '/script/compiler_base.yml'

stages:
- validate
- compile-and-run

################################################################################
# Check code formation with clang-format
# pull request validation:
# - check C++ code style
pull-request-validation:
stage: validate
image: ubuntu:focal
script:
- apt update
# install clang-format-11
- apt install -y -q gnupg2 wget
- wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
- echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main" | tee -a /etc/apt/sources.list
- apt update
- DEBIAN_FRONTEND=noninteractive apt install -y clang-format-11
# Check C++ code style
- source $CI_PROJECT_DIR/script/check_cpp_code_style.sh
tags:
- x86_64

cuda92:
stage: compile-and-run
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-cuda92-gcc:1.4
variables:
CUPLA_CXX: "g++-6"
Expand All @@ -21,69 +46,80 @@ cuda92:
extends: .base_cuda

cuda100:
stage: compile-and-run
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-cuda100-gcc:1.4
variables:
CUPLA_BOOST_VERSIONS: "1.65.1 1.66.0 1.67.0 1.68.0 1.69.0 1.70.0 1.71.0 1.72.0 1.73.0"
extends: .base_cuda

cuda101:
stage: compile-and-run
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-cuda101-gcc:1.4
variables:
CUPLA_BOOST_VERSIONS: "1.65.1 1.66.0 1.67.0 1.68.0 1.69.0 1.70.0 1.71.0 1.72.0 1.73.0"
extends: .base_cuda

cuda102:
stage: compile-and-run
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-cuda102-gcc:1.4
variables:
CUPLA_BOOST_VERSIONS: "1.65.1 1.66.0 1.67.0 1.68.0 1.69.0 1.70.0 1.71.0 1.72.0 1.73.0"
extends: .base_cuda

gcc1:
stage: compile-and-run
variables:
CUPLA_CXX: "g++-5 g++-6 g++-7 g++-8 g++-9"
CUPLA_BOOST_VERSIONS: "1.65.1 1.66.0 1.67.0"
extends: .base_gcc

gcc2:
stage: compile-and-run
variables:
CUPLA_CXX: "g++-5 g++-6 g++-7 g++-8 g++-9"
CUPLA_BOOST_VERSIONS: "1.68.0 1.69.0 1.70.0"
extends: .base_gcc

gcc3:
stage: compile-and-run
variables:
CUPLA_CXX: "g++-5 g++-6 g++-7 g++-8 g++-9"
CUPLA_BOOST_VERSIONS: "1.71.0 1.72.0 1.73.0"
extends: .base_gcc

clang:
stage: compile-and-run
variables:
CUPLA_CXX: "clang++-5.0 clang++-6.0 clang++-7 clang++-8 clang++-9 clang++-10 clang++-11"
CUPLA_BOOST_VERSIONS: "1.65.1 1.66.0 1.67.0 1.68.0 1.69.0 1.70.0 1.71.0 1.72.0 1.73.0"
extends: .base_clang

cudaClang92:
stage: compile-and-run
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-cuda92-clang:1.4
variables:
CUPLA_CXX: "clang++-8 clang++-10 clang++-11"
CUPLA_BOOST_VERSIONS: "1.65.1 1.66.0 1.67.0 1.68.0 1.69.0 1.70.0 1.71.0 1.72.0 1.73.0"
extends: .base_cuda_clang

cudaClang100:
stage: compile-and-run
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-cuda100-clang:1.4
variables:
CUPLA_CXX: "clang++-8 clang++-9 clang++-10 clang++-11"
CUPLA_BOOST_VERSIONS: "1.65.1 1.66.0 1.67.0 1.68.0 1.69.0 1.70.0 1.71.0 1.72.0 1.73.0"
extends: .base_cuda_clang

cudaClang101:
stage: compile-and-run
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-cuda101-clang:1.4
variables:
CUPLA_CXX: "clang++-9 clang++-10 clang++-11"
CUPLA_BOOST_VERSIONS: "1.65.1 1.66.0 1.67.0 1.68.0 1.69.0 1.70.0 1.71.0 1.72.0 1.73.0"
extends: .base_cuda_clang

hip42:
stage: compile-and-run
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-rocm4.2:1.4
variables:
CMAKE_MODULE_PATH: "/opt/rocm-4.2.0/hip/cmake"
Expand All @@ -97,6 +133,7 @@ hip42:
# build external project and use cupla via cmake add_subdirectory()
# use internal alpaka
addSubdirectoryInternal:
stage: compile-and-run
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-gcc:1.4
variables:
GIT_SUBMODULE_STRATEGY: normal
Expand All @@ -110,6 +147,7 @@ addSubdirectoryInternal:
# build external project and use cupla via cmake add_subdirectory()
# use installed alpaka
addSubdirectoryExternal:
stage: compile-and-run
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-gcc:1.4
variables:
GIT_SUBMODULE_STRATEGY: normal
Expand All @@ -124,6 +162,7 @@ addSubdirectoryExternal:
# build external project and use cupla via cmake find_package()
# cupla was installed with disabled examples
findPackageWithoutExample:
stage: compile-and-run
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-gcc:1.4
variables:
GIT_SUBMODULE_STRATEGY: normal
Expand All @@ -139,6 +178,7 @@ findPackageWithoutExample:
# build external project and use cupla via cmake find_package()
# cupla was installed with enabled examples
findPackageWithExample:
stage: compile-and-run
image: registry.gitlab.com/hzdr/crp/alpaka-group-container/alpaka-ci-gcc:1.4
variables:
GIT_SUBMODULE_STRATEGY: normal
Expand Down
11 changes: 11 additions & 0 deletions script/check_cpp_code_style.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -e
set -o pipefail

cd $CI_PROJECT_DIR

# check code style with clang format
find src example include test -iname "*.def" \
-o -iname "*.h" -o -iname "*.cpp" -o -iname "*.hpp" \
| xargs clang-format-11 --dry-run --Werror

0 comments on commit 3ac491d

Please sign in to comment.