Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI to latest clicdp nightlies and key4hep workflow, better Catch2 discovery #44

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 10 additions & 28 deletions .github/workflows/key4hep.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,18 @@
name: key4hep
name: keyh4ep
on: [push, pull_request]

jobs:
key4hep:
build-and-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
release: ["sw.hsf.org/key4hep",
"sw-nightlies.hsf.org/key4hep"]
build_type: ["release", "nightly"]
image: ["alma9", "ubuntu22", "centos7"]
fail-fast: false

steps:
- uses: actions/checkout@v3
- uses: cvmfs-contrib/github-action-cvmfs@v3
- uses: aidasoft/run-lcg-view@v4
- uses: actions/checkout@v4
- uses: key4hep/key4hep-actions/key4hep-build@main
with:
container: centos7
view-path: /cvmfs/${{ matrix.release }}
run: |
echo "::group::Run CMake"
mkdir build
cd build
cmake -GNinja \
-DCMAKE_CXX_FLAGS=" -fdiagnostics-color=always " \
-DINSTALL_DOC=ON \
-DUSE_EXTERNAL_CATCH2=ON \
..
echo "::endgroup::"
echo "::group::Build"
ninja -k0
echo "::endgroup::"
echo "::group::Test"
ctest --output-on-failure
echo "::endgroup::"
echo "::group::Install"
ninja install
build_type: ${{ matrix.build_type }}
image: ${{ matrix.image }}
10 changes: 5 additions & 5 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ jobs:
strategy:
fail-fast: false
matrix:
COMPILER: [gcc10, clang11]
LCG: [100]
COMPILER: [gcc11]
LCG: [104]

steps:
- uses: actions/checkout@v2
- uses: cvmfs-contrib/github-action-cvmfs@v3
- uses: actions/checkout@v4
- uses: cvmfs-contrib/github-action-cvmfs@v4
- uses: aidasoft/run-lcg-view@v4
with:
view-path: "/cvmfs/clicdp.cern.ch/iLCSoft/lcg/${{ matrix.LCG }}/nightly/x86_64-centos7-${{ matrix.COMPILER }}-opt"
setup-script: "init_ilcsoft.sh"
run: |
mkdir build
cd build
cmake -GNinja -C ${ILCSOFT}/ILCSoft.cmake -DCMAKE_CXX_FLAGS=" -fdiagnostics-color=always " -DINSTALL_DOC=ON -DUSE_EXTERNAL_CATCH2=OFF ..
cmake -GNinja -C ${ILCSOFT}/ILCSoft.cmake -DCMAKE_CXX_FLAGS=" -fdiagnostics-color=always " ..
ninja -k0
ctest --output-on-failure
ninja install
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ SET_SOURCE_FILES_PROPERTIES( "./source/src/ann/kd_pr_search.cpp" PROPERTIES COMP
#ADD_SHARED_LIBRARY( ${PROJECT_NAME}_ann ${ann_library_sources} )
#INSTALL_SHARED_LIBRARY( ${PROJECT_NAME}_ann DESTINATION lib )

option(USE_EXTERNAL_CATCH2 "Link against an external Catch2 v3 static library, otherwise build it locally" ON)
option(USE_EXTERNAL_CATCH2 "Link against an external Catch2 v3 static library, otherwise build it locally" AUTO)
set(USE_EXTERNAL_CATCH2 AUTO CACHE STRING "Link against an external Catch2 v3 static library, otherwise build it locally")
set_property(CACHE USE_EXTERNAL_CATCH2 PROPERTY STRINGS AUTO ON OFF)

IF( BUILD_TESTING )
ADD_SUBDIRECTORY(source/tests)
Expand Down
15 changes: 13 additions & 2 deletions source/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,20 @@ ENDMACRO()
ADD_MARLINUTIL_TEST( testmarlinutil )

#--- Unit test setup. Use existing Catch2 or fetch a suitable version and build it
if(USE_EXTERNAL_CATCH2)
FIND_PACKAGE(Catch2 3.0.0 REQUIRED)
if(CMAKE_CXX_STANDARD GREATER_EQUAL 20)
set(CATCH2_MIN_VERSION 3.4)
else()
set(CATCH2_MIN_VERSION 3.1)
endif()
if(USE_EXTERNAL_CATCH2)
if (USE_EXTERNAL_CATCH2 STREQUAL AUTO)
find_package(Catch2 ${CATCH2_MIN_VERSION})
else()
find_package(Catch2 ${CATCH2_MIN_VERSION} REQUIRED)
endif()
endif()

if(NOT Catch2_FOUND)
MESSAGE(STATUS "Fetching local copy of Catch2 library for unit-tests...")
# Build Catch2 with the default flags, to avoid generating warnings when we
# build it
Expand Down