diff --git a/.gitlab-ci.common.yml b/.gitlab-ci.common.yml index c5cba5c675fd211bed8ede9f9b74e1d74994f7e2..b7cda7a049ea37ee090d461f6eb42f5c43c34b5d 100644 --- a/.gitlab-ci.common.yml +++ b/.gitlab-ci.common.yml @@ -31,6 +31,7 @@ versioning: - echo EVERYBEAM_IMAGE_2004=${CI_REGISTRY_IMAGE}/everybeam_2004:${CI_COMMIT_SHORT_SHA} >> versions.env - echo EVERYBEAM_IMAGE_2204=${CI_REGISTRY_IMAGE}/everybeam_2204:${CI_COMMIT_SHORT_SHA} >> versions.env - echo EVERYBEAM_IMAGE_GCC12=${CI_REGISTRY_IMAGE}/everybeam_gcc12:${CI_COMMIT_SHORT_SHA} >> versions.env + - echo EVERYBEAM_PACKAGE_IMAGE_2204=${CI_REGISTRY_IMAGE}/everybeam_package_2204:${CI_COMMIT_SHORT_SHA} >> versions.env - cat versions.env artifacts: reports: @@ -119,7 +120,7 @@ test-and-coverage-2204: - wget -q ftp://ftp.astron.nl/outgoing/Measures/WSRT_Measures.ztar && tar -xf WSRT_Measures.ztar -C /var/lib/casacore/data/ && rm -f WSRT_Measures.ztar # Build in Debug mode - mkdir build && cd build - - cmake -DCMAKE_INSTALL_PREFIX=.. -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -DBUILD_WITH_PYTHON=ON -DDOWNLOAD_LOBES=On -DCMAKE_CXX_FLAGS="-coverage" -DCMAKE_EXE_LINKER_FLAGS="-coverage" -G Ninja .. + - cmake -DCMAKE_INSTALL_PREFIX=.. -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -DBUILD_WITH_PYTHON=ON -DCMAKE_CXX_FLAGS="-coverage" -DCMAKE_EXE_LINKER_FLAGS="-coverage" -G Ninja .. - ninja install - ctest -j`nproc` --output-on-failure -T test # Capture coverage @@ -167,6 +168,16 @@ build-everybeam-2204: rules: # Override 'changes' rule from .prepare, since it also depends on the base docker file. - when: always +build-everybeam-package-2204: + extends: [.prepare,.needs-base-2204] + stage: build + variables: + DOCKER_IMAGE: $EVERYBEAM_PACKAGE_IMAGE_2204 + DOCKER_FILE: docker/everybeam-package + DOCKER_BUILD_ARG: --build-arg BASE_IMAGE=${BASE_IMAGE_2204} + rules: # Override 'changes' rule from .prepare, since it also depends on the base docker file. + - when: always + build-everybeam-gcc12: extends: [.prepare,.needs-base-gcc12] stage: build @@ -194,7 +205,7 @@ build-doc-2204: build-package-2204: stage: package needs: ["versioning","build-everybeam-2204"] - image: $EVERYBEAM_IMAGE_2204 + image: $EVERYBEAM_PACKAGE_IMAGE_2204 script: - mkdir everybeam_package - export SRC=$(pwd) diff --git a/cpp/lobes/CMakeLists.txt b/cpp/lobes/CMakeLists.txt index 76cf719d570cea4eb847bf30302435b01a3ea765..37426f8775eb25c8b851bf694feb2af1da49dd77 100644 --- a/cpp/lobes/CMakeLists.txt +++ b/cpp/lobes/CMakeLists.txt @@ -15,9 +15,10 @@ set_target_properties(lobes PROPERTIES LIBRARY_OUTPUT_NAME "${projectname}-lobes") #------------------------------------------------------------------------------ -if(DOWNLOAD_LOBES) +if(DOWNLOAD_LOBES OR BUILD_TESTING) # Download the LOBES coefficient files if DOWNLOAD_LOBES=On, leads to a relatively small amount of overhead - # in make command, even if the coefficient files have been dowloaded + # in make command, even if the coefficient files have been dowloaded. Because the unit tests require + # DOWNLOAD_LOBES, this is also enabled when BUILD_TESTING is on. file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/coeffs/lobes) add_custom_target( download_lobes_coefficients diff --git a/cpp/test/CMakeLists.txt b/cpp/test/CMakeLists.txt index 49b745197365f23bee51ede02ac52e3b9589a3fc..35ed1272dd213f142017f5054cace808c7d99be3 100644 --- a/cpp/test/CMakeLists.txt +++ b/cpp/test/CMakeLists.txt @@ -7,10 +7,6 @@ find_package( COMPONENTS unit_test_framework REQUIRED) -if(DOWNLOAD_LOBES) - add_definitions(-DDOWNLOAD_LOBES) -endif() - # Set cache values if not specified set(MOCK_MS LOFAR_HBA_MOCK diff --git a/cpp/test/tlofar_aartfaac.cc b/cpp/test/tlofar_aartfaac.cc index 62fe1d2b30cc3bce0b2609556f86e5b5105c7a40..8368a11a584d33b0a7f0f6fbfb4f034778ba5904 100644 --- a/cpp/test/tlofar_aartfaac.cc +++ b/cpp/test/tlofar_aartfaac.cc @@ -65,9 +65,7 @@ static std::unique_ptr<Telescope> LoadAartfaac6Telescope( BOOST_AUTO_TEST_CASE(load) { Options options; // TODO AST-807 harden this test - // - When DOWNLOAD_LOBES is undefined it throws. // - When an Aartfaac-12 MS is used it throws. - // - Builds where DOWNLOAD_LOBES is undefined aren't tested in CI. { options.element_response_model = ElementResponseModel::kLOBES; std::unique_ptr<Telescope> telescope = LoadAartfaac6Telescope(options); @@ -226,7 +224,6 @@ BOOST_AUTO_TEST_CASE(under_horizon_grid) { } } -#ifdef DOWNLOAD_LOBES static std::unique_ptr<everybeam::telescope::Telescope> GetTelescopeLofar() { Options options; options.element_response_model = ElementResponseModel::kLOBES; @@ -396,6 +393,4 @@ BOOST_AUTO_TEST_CASE(gridded_response_lobes, } } -#endif - BOOST_AUTO_TEST_SUITE_END() diff --git a/cpp/test/tlofar_lba.cc b/cpp/test/tlofar_lba.cc index 06963d44301cbce63bece26a21ea38e037f3b7d7..d0ca4afd97cabfb2766bd84e9c2fd66972dbbce0 100644 --- a/cpp/test/tlofar_lba.cc +++ b/cpp/test/tlofar_lba.cc @@ -126,9 +126,6 @@ BOOST_AUTO_TEST_CASE(test_hamaker) { } } -// DOWNLOAD_LOBES required since we need to make sure -// coefficient file for CS302LBA is present in build dir. -#ifdef DOWNLOAD_LOBES BOOST_AUTO_TEST_CASE(test_lobes) { Options options; // Effectively, all the computations will be done as if the Hamaker model was @@ -172,6 +169,5 @@ BOOST_AUTO_TEST_CASE(test_lobes) { everybeam_ref_p13[i], 2e-1); } } -#endif // DOWNLOAD_LOBES BOOST_AUTO_TEST_SUITE_END() diff --git a/docker/everybeam b/docker/everybeam index 07eb2604e8bd4999bc4c0a1a067074b1a5cf4648..b3c2d5f7036a6ee6009d894c6b0b7a3f793642de 100644 --- a/docker/everybeam +++ b/docker/everybeam @@ -9,5 +9,5 @@ ADD . ${EVERYBEAMDIR}/EveryBeam RUN cd ${EVERYBEAMDIR}/EveryBeam && git fetch --unshallow \ && mkdir -p ${EVERYBEAMDIR}/build && cd ${EVERYBEAMDIR}/build \ - && cmake -DBUILD_TESTING=ON -DBUILD_WITH_PYTHON=ON -DBUILD_APT_PACKAGES=ON -DCMAKE_INSTALL_PREFIX=.. ../EveryBeam \ + && cmake -DBUILD_TESTING=ON -DBUILD_WITH_PYTHON=ON -DCMAKE_INSTALL_PREFIX=.. ../EveryBeam \ && make -j8 && make install -j8 diff --git a/docker/everybeam-package b/docker/everybeam-package new file mode 100644 index 0000000000000000000000000000000000000000..2e91847cc3082274ff35ba71b67a750f7884b127 --- /dev/null +++ b/docker/everybeam-package @@ -0,0 +1,13 @@ +# Copyright (C) 2021 ASTRON (Netherlands Institute for Radio Astronomy) +# SPDX-License-Identifier: GPL-3.0-or-later + +ARG BASE_IMAGE +FROM $BASE_IMAGE + +ENV EVERYBEAMDIR /opt/everybeam +ADD . ${EVERYBEAMDIR}/EveryBeam + +RUN cd ${EVERYBEAMDIR}/EveryBeam && git fetch --unshallow \ + && mkdir -p ${EVERYBEAMDIR}/build && cd ${EVERYBEAMDIR}/build \ + && cmake -DBUILD_WITH_PYTHON=ON -DBUILD_APT_PACKAGES=ON -DCMAKE_INSTALL_PREFIX=.. ../EveryBeam \ + && make -j8 && make install -j8