From 042c708526865c3a2b9af5cf06c6b7e68abf465b Mon Sep 17 00:00:00 2001 From: Stephen Nicholas Swatman Date: Fri, 15 Nov 2024 13:03:32 +0100 Subject: [PATCH] Add tests for downstream builds This commit adds a new CI job that tests whether covfie can be used as a dependency in a downstream project. --- .github/workflows/downstream.yml | 53 ++++++++++++++++++++++++++++++++ tests/downstream/CMakeLists.txt | 37 ++++++++++++++++++++++ tests/downstream/main.cpp | 16 ++++++++++ 3 files changed, 106 insertions(+) create mode 100644 .github/workflows/downstream.yml create mode 100644 tests/downstream/CMakeLists.txt create mode 100644 tests/downstream/main.cpp diff --git a/.github/workflows/downstream.yml b/.github/workflows/downstream.yml new file mode 100644 index 0000000..e54aa0a --- /dev/null +++ b/.github/workflows/downstream.yml @@ -0,0 +1,53 @@ +# This file is part of covfie, a part of the ACTS project +# +# Copyright (c) 2022 CERN +# +# This Source Code Form is subject to the terms of the Mozilla Public License, +# v. 2.0. If a copy of the MPL was not distributed with this file, You can +# obtain one at http://mozilla.org/MPL/2.0/. + +name: Downstream Build Tests + +on: [ push, pull_request ] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + linux-core: + name: "Linux" + + runs-on: "ubuntu-latest" + + container: ubuntu:24.04 + + steps: + - uses: actions/checkout@v3 + - name: Install dependencies + run: apt-get update && apt-get -y install + libboost-filesystem-dev + libboost-program-options-dev + libboost-log-dev + wget + cmake + g++ + - name: Configure covfie + run: cmake + -DCMAKE_BUILD_TYPE=${{ matrix.BUILD }} + -DCOVFIE_FAIL_ON_WARNINGS=TRUE + -DCMAKE_CXX_STANDARD=20 + -S $GITHUB_WORKSPACE + -B build_covfie + - name: Build covfie + run: cmake --build build_covfie -- -j $(nproc) + - name: Install covfie + run: cmake --install build_covfie --prefix "$GITHUB_WORKSPACE/.prefixes/covfie/" + - name: Configure downstream + run: cmake + -DCMAKE_CXX_STANDARD=20 + -DCMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/.prefixes/covfie/" + -S $GITHUB_WORKSPACE/tests/downstream + -B build_downstream + - name: Build downstream + run: VERBOSE=1 cmake --build build_downstream -- -j $(nproc) diff --git a/tests/downstream/CMakeLists.txt b/tests/downstream/CMakeLists.txt new file mode 100644 index 0000000..a80996c --- /dev/null +++ b/tests/downstream/CMakeLists.txt @@ -0,0 +1,37 @@ +# This file is part of covfie, a part of the ACTS project +# +# Copyright (c) 2022 CERN +# +# This Source Code Form is subject to the terms of the Mozilla Public License, +# v. 2.0. If a copy of the MPL was not distributed with this file, You can +# obtain one at http://mozilla.org/MPL/2.0/. + +cmake_minimum_required(VERSION 3.18) + +project("covfie_downstream" VERSION 0.0.0) + +find_package(covfie REQUIRED) + +add_executable(main main.cpp) + +target_link_libraries( + main + covfie::core + covfie::cpu +) + +if(TARGET core) + message(FATAL_ERROR "Target `core` should not exist.") +endif() + +if(TARGET cpu) + message(FATAL_ERROR "Target `cpu` should not exist.") +endif() + +if(TARGET benchmark_cpu) + message(FATAL_ERROR "Target `benchmark_cpu` should not exist.") +endif() + +if(TARGET test_core) + message(FATAL_ERROR "Target `test_core` should not exist.") +endif() diff --git a/tests/downstream/main.cpp b/tests/downstream/main.cpp new file mode 100644 index 0000000..ff5fc61 --- /dev/null +++ b/tests/downstream/main.cpp @@ -0,0 +1,16 @@ +/* + * This file is part of covfie, a part of the ACTS project + * + * Copyright (c) 2022 CERN + * + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include + +int main(int argc, char ** argv) +{ + return 0; +}