Skip to content

Commit

Permalink
add more CI checks (#13)
Browse files Browse the repository at this point in the history
* adding doxygen and cppcheck and clang-tidy

* reorg docker naming

* try to throw error when cmake fails

* fix doxyfile.in to have dynamic include...and exclude tpls

* install updated doxygen manually
  • Loading branch information
rrsettgast authored Oct 23, 2023
1 parent d1ecab9 commit 8df83fd
Show file tree
Hide file tree
Showing 13 changed files with 173 additions and 58 deletions.
135 changes: 104 additions & 31 deletions .github/workflows/continuousIntegration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,42 @@ jobs:
# BUILD_AND_TEST_ARGS: --test-code-style
# run: ./scripts/ci_build_and_test.sh

# documentation:
# needs: [check_pull_request_is_not_a_draft]
# runs-on: ubuntu-22.04
# steps:
# - name: Checkout Repository
# uses: actions/checkout@v3
# with:
# submodules: true
# lfs: false
# - name: Check documentation
# env:
# DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc9
# CMAKE_BUILD_TYPE: Release
# BUILD_AND_TEST_ARGS: --test-documentation
# run: ./scripts/ci_build_and_test.sh
doxygen_check:
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true
lfs: false
- name: Check doxygen
env:
DOCKER_REPOSITORY: geosx/ubuntu:22.04
HOST_CONFIG: hostconfigs/environment.cmake
CMAKE_CXX_COMPILER: /usr/bin/clang++
CMAKE_C_COMPILER: /usr/bin/clang
CMAKE_BUILD_TYPE: Release
BUILD_AND_TEST_ARGS: --test-doxygen
run: ./scripts/ci_build_and_test.sh


code_checks:
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true
lfs: false
- name: code_checks
env:
DOCKER_REPOSITORY: geosx/ubuntu:22.04
HOST_CONFIG: hostconfigs/environment.cmake
CMAKE_CXX_COMPILER: /usr/bin/clang++
CMAKE_C_COMPILER: /usr/bin/clang
CMAKE_BUILD_TYPE: Release
BUILD_AND_TEST_ARGS: --code_checks
run: ./scripts/ci_build_and_test.sh

linux_builds:
name: ${{matrix.name}}
Expand All @@ -54,63 +74,94 @@ jobs:
matrix:
include:
- name: RHEL8.8-clang15-dbg (ubi8.8, clang-15.0.7, Debug)
DOCKER_REPOSITORY: geosx/ubi8:ubi8.8-854
DOCKER_REPOSITORY: geosx/ubi:8.8-854
OS: ubuntu-22.04
CMAKE_CXX_COMPILER: clang++
CMAKE_C_COMPILER: clang
CMAKE_BUILD_TYPE: Debug

- name: RHEL8.8-clang15-rel (ubi8.8, clang-15.0.7, Release)
DOCKER_REPOSITORY: geosx/ubi8:ubi8.8-854
DOCKER_REPOSITORY: geosx/ubi:8.8-854
OS: ubuntu-22.04
CMAKE_CXX_COMPILER: clang++
CMAKE_C_COMPILER: clang
CMAKE_BUILD_TYPE: Release
CLANGTIDY_EXECUTABLE: clang-tidy

- name: RHEL8.8-gcc12-dbg (ubi8.8, gcc 12.2.1, Debug)
DOCKER_REPOSITORY: geosx/ubi8:ubi8.8-854
DOCKER_REPOSITORY: geosx/ubi:8.8-854
OS: ubuntu-22.04
CMAKE_CXX_COMPILER: /opt/rh/gcc-toolset-12/root/bin/g++
CMAKE_C_COMPILER: /opt/rh/gcc-toolset-12/root/bin/gcc
CMAKE_BUILD_TYPE: Debug

- name: RHEL8.8-gcc12-rel (ubi8.8, gcc 12.2.1, Release)
DOCKER_REPOSITORY: geosx/ubi8:ubi8.8-854
DOCKER_REPOSITORY: geosx/ubi:8.8-854
OS: ubuntu-22.04
CMAKE_CXX_COMPILER: /opt/rh/gcc-toolset-12/root/bin/g++
CMAKE_C_COMPILER: /opt/rh/gcc-toolset-12/root/bin/gcc
CMAKE_BUILD_TYPE: Release

- name: ubuntu22-gcc11-cuda11-rel (ubi8.8, gcc 11.4.0, cuda-12.2.2, Release)
DOCKER_REPOSITORY: geosx/ubuntu22:ubuntu22.04-cuda11.8.0
- name: ubuntu22-gcc11-rel (ubi8.8, gcc 11.4.0, Release)
DOCKER_REPOSITORY: geosx/ubuntu:22.04
OS: ubuntu-22.04
CMAKE_CXX_COMPILER: /usr/bin/g++
CMAKE_C_COMPILER: /usr/bin/gcc
CMAKE_BUILD_TYPE: Release
BUILD_AND_TEST_ARGS: "--disable-unit-tests"

- name: ubuntu22-clang14-rel (ubi8.8, clang-14.0.0, Release)
DOCKER_REPOSITORY: geosx/ubuntu:22.04
OS: ubuntu-22.04
CMAKE_CXX_COMPILER: /usr/bin/clang++
CMAKE_C_COMPILER: /usr/bin/clang
CMAKE_BUILD_TYPE: Release
BUILD_AND_TEST_ARGS: "--disable-unit-tests"

- name: ubuntu22-clang14-dbg (ubi8.8, clang-14.0.0, Debug)
DOCKER_REPOSITORY: geosx/ubuntu:22.04
OS: ubuntu-22.04
CMAKE_CXX_COMPILER: /usr/bin/clang++
CMAKE_C_COMPILER: /usr/bin/clang
CMAKE_BUILD_TYPE: Debug
BUILD_AND_TEST_ARGS: "--disable-unit-tests"

- name: ubuntu22-gcc11-dbg (ubi8.8, gcc 11.4.0, Release)
DOCKER_REPOSITORY: geosx/ubuntu:22.04
OS: ubuntu-22.04
CMAKE_CXX_COMPILER: /usr/bin/g++
CMAKE_C_COMPILER: /usr/bin/gcc
CMAKE_BUILD_TYPE: Debug
BUILD_AND_TEST_ARGS: "--disable-unit-tests"

- name: ubuntu22-gcc11-cuda11-rel (ubi8.8, gcc 11.4.0, cuda-11.8.0, Release)
DOCKER_REPOSITORY: geosx/ubuntu:22.04-cuda11.8.0
OS: ubuntu-22.04
CMAKE_CXX_COMPILER: /usr/bin/g++
CMAKE_C_COMPILER: /usr/bin/gcc
CMAKE_BUILD_TYPE: Release
ENABLE_CUDA: ON
BUILD_AND_TEST_ARGS: "--disable-unit-tests"

- name: ubuntu22-gcc11-cuda11-dbg (ubi8.8, gcc 11.4.0, cuda-12.2.2, Debug)
DOCKER_REPOSITORY: geosx/ubuntu22:ubuntu22.04-cuda11.8.0
- name: ubuntu22-gcc11-cuda11-dbg (ubi8.8, gcc 11.4.0, cuda-11.8.0, Debug)
DOCKER_REPOSITORY: geosx/ubuntu:22.04-cuda11.8.0
OS: ubuntu-22.04
CMAKE_CXX_COMPILER: /usr/bin/g++
CMAKE_C_COMPILER: /usr/bin/gcc
CMAKE_BUILD_TYPE: Debug
ENABLE_CUDA: ON
BUILD_AND_TEST_ARGS: "--disable-unit-tests"

- name: ubuntu22-clang14-cuda11-rel (ubi8.8, clang-14.0.0, cuda-12.2.2, Release)
DOCKER_REPOSITORY: geosx/ubuntu22:ubuntu22.04-cuda11.8.0
- name: ubuntu22-clang14-cuda11-rel (ubi8.8, clang-14.0.0, cuda-11.8.0, Release)
DOCKER_REPOSITORY: geosx/ubuntu:22.04-cuda11.8.0
OS: ubuntu-22.04
CMAKE_CXX_COMPILER: /usr/bin/clang++
CMAKE_C_COMPILER: /usr/bin/clang
CMAKE_BUILD_TYPE: Release
ENABLE_CUDA: ON
BUILD_AND_TEST_ARGS: "--disable-unit-tests"

- name: ubuntu22-clang14-cuda11-dbg (ubi8.8, clang-14.0.0, cuda-12.2.2, Debug)
DOCKER_REPOSITORY: geosx/ubuntu22:ubuntu22.04-cuda11.8.0
- name: ubuntu22-clang14-cuda11-dbg (ubi8.8, clang-14.0.0, cuda-11.8.0, Debug)
DOCKER_REPOSITORY: geosx/ubuntu:22.04-cuda11.8.0
OS: ubuntu-22.04
CMAKE_CXX_COMPILER: /usr/bin/clang++
CMAKE_C_COMPILER: /usr/bin/clang
Expand All @@ -119,7 +170,7 @@ jobs:
BUILD_AND_TEST_ARGS: "--disable-unit-tests"

- name: RHEL8.8-clang15-cuda12-rel (ubi8.8, clang-15.0.7, cuda-12.2.2, Release)
DOCKER_REPOSITORY: geosx/ubi8:ubi8.8-cuda12.2.2
DOCKER_REPOSITORY: geosx/ubi:8.8-cuda12.2.2
OS: ubuntu-22.04
CMAKE_CXX_COMPILER: clang++
CMAKE_C_COMPILER: clang
Expand All @@ -128,7 +179,7 @@ jobs:
BUILD_AND_TEST_ARGS: "--disable-unit-tests"

- name: RHEL8.8-gcc12-cuda12-rel (ubi8.8, gcc 12.2.1, cuda-12.2.2, Release)
DOCKER_REPOSITORY: geosx/ubi8:ubi8.8-cuda12.2.2
DOCKER_REPOSITORY: geosx/ubi:8.8-cuda12.2.2
OS: ubuntu-22.04
CMAKE_CXX_COMPILER: /opt/rh/gcc-toolset-12/root/bin/g++
CMAKE_C_COMPILER: /opt/rh/gcc-toolset-12/root/bin/gcc
Expand All @@ -153,6 +204,28 @@ jobs:
CMAKE_C_COMPILER: ${{ matrix.CMAKE_C_COMPILER }}
CMAKE_BUILD_TYPE: ${{ matrix.CMAKE_BUILD_TYPE }}
ENABLE_CUDA: ${{ matrix.ENABLE_CUDA }}
BUILD_AND_TEST_ARGS: ${{ matrix.BUILD_AND_TEST_ARGS }}
BUILD_AND_TEST_ARGS: ${{ matrix.BUILD_AND_TEST_ARGS }} --build-exe
HOST_CONFIG: hostconfigs/environment.cmake
run: ./scripts/ci_build_and_test.sh

check_that_all_jobs_succeeded:
runs-on: ubuntu-22.04
needs:
- linux_builds
- doxygen_check
- code_checks
if: ${{ always() }}
env:
RETURN_VAL: |
${{
needs.linux_builds.result == 'success' &&
needs.doxygen_check.result == 'success' &&
needs.code_checks.result == 'success'
}}
steps:
- name: PR Success
if: ${{ contains(env.RETURN_VAL, 'true') }}
run: "true"
- name: PR Failure
if: ${{ contains(env.RETURN_VAL, 'false') }}
run: "false"
12 changes: 0 additions & 12 deletions cmake/CMakeBasics.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,4 @@ blt_append_custom_compiler_flag( FLAGS_VAR CMAKE_CXX_FLAGS_DEBUG
CLANG "-fstandalone-debug"
)

blt_append_custom_compiler_flag( FLAGS_VAR GEOSX_NINJA_FLAGS
DEFAULT " "
GNU "-fdiagnostics-color=always"
CLANG "-fcolor-diagnostics"
)


if( ${CMAKE_MAKE_PROGRAM} STREQUAL "ninja" OR ${CMAKE_MAKE_PROGRAM} MATCHES ".*/ninja$" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GEOSX_NINJA_FLAGS}")
endif()


set( CAMP_ENABLE_TESTS OFF CACHE BOOL "")
13 changes: 12 additions & 1 deletion cmake/Macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,19 @@ macro(shiva_add_code_checks)
SOURCES ${_sources}
UNCRUSTIFY_CFG_FILE ${PROJECT_SOURCE_DIR}/src/uncrustify.cfg
CPPCHECK_FLAGS ${CPPCHECK_FLAGS}
D
)

if( CPPCHECK_FOUND )
add_test( NAME testCppCheck
COMMAND bash -c "make cppcheck_check 2> >(tee cppcheck.err) >/dev/null && exit $(cat cppcheck.err | wc -l)"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
endif()

if( CLANGTIDY_FOUND )
add_test( NAME testClangTidy
COMMAND bash -c "make clang_tidy_check 2> >(tee tidyCheck.err) >/dev/null && exit $(cat tidyCheck.err | wc -l)"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
endif()
endmacro(shiva_add_code_checks)
9 changes: 5 additions & 4 deletions docker/buildAndPush.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@



images="ubuntu22-cuda11:ubuntu22.04-cuda11.8.0"
# ubi8:ubi8.8-854 ubi8-cuda11:ubi8.8-cuda11.8.0 ubi8-cuda12:ubi8.8-cuda12.2.2
images="ubuntu:22.04 ubuntu-cuda11:22.04-cuda11.8.0 ubi:8.8-854 ubi-cuda11:8.8-cuda11.8.0 ubi-cuda12:8.8-cuda12.2.2"

for image in $images; do
imagePart=(${image//:/ })
Expand All @@ -15,10 +14,12 @@ for image in $images; do

repo=geosx/${dirRoot}:${tag}

echo
echo dir=${dir}
echo repo=${repo}
echo


docker build ${dir} -t ${repo}
docker push ${repo}
docker build ${dir} -t ${repo}
docker push ${repo}
done
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ RUN ln -fs /usr/share/zoneinfo/America/Los_Angeles /etc/localtime && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
curl \
python3 \
clang
clang \
cppcheck \
clang-tidy

ARG CMAKE_VERSION=3.23.5
RUN curl -fsSL -k https://cmake.org/files/v${CMAKE_VERSION%.[0-9]*}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz | tar --directory=/usr/local --strip-components=1 -xzf -
20 changes: 20 additions & 0 deletions docker/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ubuntu:22.04 AS ubuntu22

# install required packages
RUN ln -fs /usr/share/zoneinfo/America/Los_Angeles /etc/localtime && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
curl \
python3 \
make \
gcc \
g++ \
clang \
cppcheck \
clang-tidy

ARG CMAKE_VERSION=3.23.5
RUN curl -fsSL -k https://cmake.org/files/v${CMAKE_VERSION%.[0-9]*}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz | tar --directory=/usr/local --strip-components=1 -xzf -

ARG DOXYGEN_VERSION=1.9.8
RUN curl -fsSL -k https://www.doxygen.nl/files/doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz | tar --directory=/usr/local --strip-components=1 -xzf -
5 changes: 5 additions & 0 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
if(DOXYGEN_FOUND)
blt_add_doxygen_target( shiva_doxygen )

add_test( NAME testDoxygenCheck
COMMAND bash -c "${mkdir_cmd} ${DOXYGEN_EXECUTABLE} Doxyfile 2> >(tee doxygen.err) && exit $(cat doxygen.err | wc -l)"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
endif()
4 changes: 2 additions & 2 deletions docs/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = ../../src
INPUT = @PROJECT_SOURCE_DIR@/src

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down Expand Up @@ -1000,7 +1000,7 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.

EXCLUDE =
EXCLUDE = @PROJECT_SOURCE_DIR@/tpl/*

# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
Expand Down
22 changes: 16 additions & 6 deletions scripts/ci_build_and_test_in_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ free -m
function or_die () {
"$@"
local status=$?

echo status = $status
if [[ $status != 0 ]] ; then
echo ERROR $status command: $@
exit $status
Expand Down Expand Up @@ -49,16 +49,26 @@ if [[ "$*" == *--test-code-style* ]]; then
fi

# Documentation check
if [[ "$*" == *--test-documentation* ]]; then
if [[ "$*" == *--test-doxygen* ]]; then
or_die ctest --output-on-failure -R "testDoxygenCheck"
exit 0
fi

or_die make
# code checks
if [[ "$*" == *----code_checks* ]]; then
or_die ctest --output-on-failure -R "testCppCheck|testClangTidy"
exit 0
fi

if [[ "$*" == *--build-exe* ]]; then
or_die make -j $(nproc)

if [[ "$*" != *--disable-unit-tests* ]]; then
or_die ctest --output-on-failure -E "testUncrustifyCheck|testDoxygenCheck"
if [[ "$*" != *--disable-unit-tests* ]]; then
or_die ctest --output-on-failure -E "testUncrustifyCheck|testDoxygenCheck|testCppCheck|testClangTidy"
fi
fi


exit 0


exit 0
7 changes: 6 additions & 1 deletion scripts/config-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,10 @@ def extract_cmake_location(file_path):
print("Changing to build directory...")
os.chdir(buildpath)
print("Executing cmake line: '%s'\n" % cmakeline)
subprocess.call(cmakeline,shell=True)

try:
subprocess.call(cmakeline,shell=True)
except:
print("CMake failed. See above output for details.")
sys.exit(1)

0 comments on commit 8df83fd

Please sign in to comment.