Commit 9cfccf33 authored by David Frank's avatar David Frank Committed by Tobias Lasser
Browse files

move install tests into compile stage, optimize folers

parent 731ec21c
Pipeline #486352 passed with stages
in 34 minutes and 44 seconds
......@@ -5,6 +5,7 @@ cmake-build-release
build/
bin/
/compile_commands.json
_build/
# git
*.orig
......
......@@ -19,18 +19,14 @@ variables:
UBUNTU_IMAGE: "elsa/ubuntu:20.04"
GPU_ONLY_IMAGE: "elsa/cuda-clang:10.0"
COVERAGE_IMAGE: "elsa/coverage:10.2"
CPM_SOURCE_CACHE: "/tmp/.cache/CPM"
### Cache setup ###
# Caches should only be used for caching
# between pipelines not jobs, artifacts should be prefered for that
# We store the CPM cache, for a given branch.
# TODO dfrank: Is it possible to cache it project wide?
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- $CPM_SOURCE_CACHE
- build/_deps/*
### job templates ###
......@@ -61,26 +57,66 @@ cache:
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
paths:
- build/
# The actual build artifacts
- build/bin
- build/lib
- build/pyelsa/
- build/elsa/elsaConfig.cmake
- build/elsa/elsaConfigVersion.cmake
# If we ever generate headers, store them as well
- build/elsa/**/*.h
# CTest files
- build/**/CTestTestfile.cmake
- build/**/tests/test_*include-*.cmake
- build/**/tests/test_*tests-*.cmake
- build/Testing
# Add elsa install to artifact
- install-elsa/include/elsa/**/*.h
- install-elsa/include/elsa/**/*.hpp
- install-elsa/include/elsa/**/*.cuh
- install-elsa/lib/cmake/elsa/**/*.cmake
- install-elsa/lib/libelsa*.a
# Add quickvec install to artifact
- install-elsa/include/Quickvec/**/*.h
- install-elsa/include/Quickvec/**/*.hpp
- install-elsa/lib/cmake/Quickvec/*.cmake
- install-elsa/lib/libquickvec.a
# Add doctest install to artifact
- install-elsa/include/doctest/**/*.h
- install-elsa/lib/cmake/doctest/**/*.cmake
# Add spdlog install to artifact
- install-elsa/include/spdlog/**/*.h
- install-elsa/lib/cmake/spdlog/**/*.cmake
- install-elsa/lib/libspdlog.a
- install-elsa/lib/pkgconfig/spdlog.pc
exclude:
- build/_deps/*
expire_in: 60 mins
.buildjob_script_clang:
script: &buildjob_clang
- mkdir -p build
- cd build
- cmake .. -GNinja -DELSA_BENCHMARKS=ON -DELSA_CREATE_JUNIT_REPORTS=ON -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-lc++abi"
- cmake .. -GNinja -DELSA_BENCHMARKS=ON -DELSA_CREATE_JUNIT_REPORTS=ON -DCMAKE_INSTALL_PREFIX="../install-elsa" -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-lc++abi"
- ninja
- ninja build-tests
- ninja build-benchmarks
- ninja build-examples
- ninja install
.buildjob_script_normal:
script: &buildjob_normal
- mkdir -p build
- cd build
- cmake .. -GNinja -DELSA_BENCHMARKS=ON -DELSA_CREATE_JUNIT_REPORTS=ON
- cmake .. -GNinja -DELSA_BENCHMARKS=ON -DELSA_CREATE_JUNIT_REPORTS=ON -DCMAKE_INSTALL_PREFIX="../install-elsa"
- ninja
- ninja build-tests
- ninja build-benchmarks
- ninja build-examples
- ninja install
#### Test job templates ####
......@@ -88,7 +124,7 @@ cache:
<<: *run_always
script:
- cd build
- ninja tests
- ctest --output-on-failure --schedule-random
artifacts:
name: "$CI_COMMIT_REF_SLUG-$CI_JOB_NAME"
paths:
......@@ -104,7 +140,7 @@ cache:
- git clone https://gitlab.lrz.de/IP/elsa_testing.git /tmp/elsa_testing
- cd /tmp/elsa_testing
- mkdir -p build/ && cd build/
- cmake .. -GNinja -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-lc++abi"
- cmake .. -GNinja -DELSA_INSTALL_DIR="$CI_PROJECT_DIR/install-elsa" -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-lc++abi"
- ninja
.installjob_default_anchors:
......@@ -112,19 +148,20 @@ cache:
- git clone https://gitlab.lrz.de/IP/elsa_testing.git /tmp/elsa_testing
- cd /tmp/elsa_testing
- mkdir -p build/ && cd build/
- cmake .. -GNinja
- cmake .. -GNinja -DELSA_INSTALL_DIR="$CI_PROJECT_DIR/install-elsa"
- ninja
.installjob_anchors: &install_job
<<: *run_on_merge_requests
before_script: &installjob_before_script
- cd build
- ninja install
cache: &install_cache
key: "$CI_COMMIT_REF_SLUG-$CI_JOB_NAME"
key: "$CI_COMMIT_REF_SLUG"
paths:
- $CPM_SOURCE_CACHE
- /tmp/elsa_testing
- $CPM_SOURCE_CACHE/eigen3/*
- $CPM_SOURCE_CACHE/spdlog/*
- $CPM_SOURCE_CACHE/doctest/*
- $CPM_SOURCE_CACHE/pybind11/*
- $CPM_SOURCE_CACHE/quickvec/*
# - /tmp/elsa_testing/*
### static test ###
......@@ -215,10 +252,12 @@ build-gpu-only:
script:
- mkdir -p build
- cd build
- cmake .. -GNinja -DELSA_BENCHMARKS=ON -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-lc++abi" -DELSA_CUDA_VECTOR=ON
- cmake .. -GNinja -DELSA_BENCHMARKS=ON -DELSA_CUDA_VECTOR=ON -DELSA_CREATE_JUNIT_REPORTS=ON -DCMAKE_INSTALL_PREFIX="../install-elsa" -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-lc++abi"
- ninja
- ninja build-tests
- ninja build-benchmarks
- ninja build-examples
- ninja install
tags:
- linux
- elsa
......@@ -354,7 +393,7 @@ install-gpu-only:
- git clone https://gitlab.lrz.de/IP/elsa_testing.git /tmp/elsa_testing
- cd /tmp/elsa_testing
- mkdir -p build/ && cd build/
- cmake .. -GNinja -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-lc++abi" -DELSA_CUDA_VECTOR=ON
- cmake .. -GNinja -DELSA_INSTALL_DIR="$CI_PROJECT_DIR/install-elsa" -Dquickvec_DIR="$CI_PROJECT_DIR/install-elsa/lib/cmake/Quickvec" -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-lc++abi" -DELSA_CUDA_VECTOR=ON
- ninja
tags:
- linux
......
......@@ -59,6 +59,11 @@ include(CPM)
# export compile_commands.json for language servers such as ccls
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# By default set all output to lib or bin directories
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# ------------ dependencies ------------
# ------------
......@@ -196,8 +201,7 @@ if(ELSA_TESTING OR ELSA_BENCHMARKS)
APPEND_COVERAGE_COMPILER_FLAGS()
set(COVERAGE_LCOV_EXCLUDES
'${CPM_SOURCE_CACHE}/*'
'${PROJECT_BINARY_DIR}/_deps/'
'${PROJECT_SOURCE_DIR}/thirdparty/*'
'${PROJECT_BINARY_DIR}/_deps/*'
'/usr/*')
SETUP_TARGET_FOR_COVERAGE_LCOV(NAME test_coverage EXECUTABLE ctest)
......
# Create binaries for benchmarks in bin/benchmarks
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/benchmarks)
# add Catch2 only here to still use it in benchmarks
CPMAddPackage(
NAME Catch2
......
......@@ -24,6 +24,8 @@ macro(ELSA_DOCTEST NAME)
target_include_directories(test_${NAME} PRIVATE ${CMAKE_SOURCE_DIR}/elsa/test_routines/)
# Improve compile times for tests
target_compile_definitions(test_${NAME} PRIVATE DOCTEST_CONFIG_SUPER_FAST_ASSERTS)
# Set output directory to bin/tests/<module>
set_target_properties(test_${NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/tests/${ELSA_MODULE_TARGET_NAME}")
# Add test to global dependency
add_dependencies(tests test_${NAME})
......
# Create binaries for examples in bin/examples
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/examples)
# define a target for all examples
add_custom_target(build-examples)
......
#!/bin/bash
FILES="build/elsa/core/tests/test_ExpressionTemplates"
FILES="build/bin/tests/elsa_core/test_ExpressionTemplates"
if type cuda-memcheck &> /dev/null; then
echo "cuda-memcheck available in version:"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment