From 51ea51a216a76452b02fc4d66307d73737ba4b39 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 6 Nov 2023 11:23:32 +0100 Subject: [PATCH 01/21] Add CMake Presets Signed-off-by: Cristian Le --- .clang-format | 4 + CMakePresets.json | 7 + cmake/CMakePresets-CI.json | 293 +++++++++++++++++++++++++++++++ cmake/CMakePresets-defaults.json | 50 ++++++ 4 files changed, 354 insertions(+) create mode 100644 .clang-format create mode 100644 CMakePresets.json create mode 100644 cmake/CMakePresets-CI.json create mode 100644 cmake/CMakePresets-defaults.json diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..d30969d --- /dev/null +++ b/.clang-format @@ -0,0 +1,4 @@ +BasedOnStyle: Google +IndentWidth: 4 +IncludeBlocks: Preserve +AllowShortFunctionsOnASingleLine: Empty diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..51696d4 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,7 @@ +{ + "version": 6, + "include": [ + "cmake/CMakePresets-defaults.json", + "cmake/CMakePresets-CI.json" + ] +} diff --git a/cmake/CMakePresets-CI.json b/cmake/CMakePresets-CI.json new file mode 100644 index 0000000..42fdfe4 --- /dev/null +++ b/cmake/CMakePresets-CI.json @@ -0,0 +1,293 @@ +{ + "version": 6, + "include": [ + "CMakePresets-defaults.json" + ], + "configurePresets": [ + { + "name": "ci-base", + "hidden": true, + "generator": "Ninja", + "inherits": [ + "default" + ], + "cacheVariables": { + "TEMPLATE_TESTS": { + "type": "BOOL", + "value": true + } + }, + "errors": { + "deprecated": true + } + }, + { + "name": "gcc-ci", + "displayName": "GCC toolchain", + "inherits": [ + "ci-base" + ], + "binaryDir": "cmake-build-ci-gcc", + "cacheVariables": { + "CMAKE_CXX_COMPILER": { + "type": "FILEPATH", + "value": "g++" + } + } + }, + { + "name": "intel-ci", + "displayName": "Intel toolchain", + "inherits": [ + "ci-base" + ], + "binaryDir": "cmake-build-ci-intel", + "cacheVariables": { + "CMAKE_CXX_COMPILER": { + "type": "FILEPATH", + "value": "icpx" + } + } + }, + { + "name": "llvm-ci", + "displayName": "LLVM (Clang) toolchain", + "inherits": [ + "ci-base" + ], + "binaryDir": "cmake-build-ci-llvm", + "cacheVariables": { + "CMAKE_CXX_COMPILER": { + "type": "FILEPATH", + "value": "clang++" + } + } + }, + { + "name": "windows-ci", + "displayName": "Windows native toolchain", + "inherits": [ + "ci-base" + ], + "binaryDir": "cmake-build-ci-windows", + "cacheVariables": { + "CMAKE_CXX_COMPILER": { + "type": "FILEPATH", + "value": "cl" + }, + "CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS": { + "type": "BOOL", + "value": true + } + } + }, + { + "name": "macos-ci", + "displayName": "MacOS native toolchain", + "inherits": [ + "ci-base" + ], + "binaryDir": "cmake-build-ci-macos", + "cacheVariables": { + "CMAKE_CXX_COMPILER": { + "type": "FILEPATH", + "value": "clang++" + } + } + } + ], + "buildPresets": [ + { + "name": "ci-base", + "hidden": true, + "inherits": [ + "default" + ], + "cleanFirst": true + }, + { + "name": "gcc-ci", + "displayName": "GCC toolchain", + "inherits": [ + "ci-base" + ], + "configurePreset": "gcc-ci" + }, + { + "name": "intel-ci", + "displayName": "Intel toolchain", + "inherits": [ + "ci-base" + ], + "configurePreset": "intel-ci" + }, + { + "name": "llvm-ci", + "displayName": "LLVM (Clang) toolchain", + "inherits": [ + "ci-base" + ], + "configurePreset": "llvm-ci" + }, + { + "name": "windows-ci", + "displayName": "Windows native toolchain", + "inherits": [ + "ci-base" + ], + "configurePreset": "windows-ci" + }, + { + "name": "macos-ci", + "displayName": "MacOS native toolchain", + "inherits": [ + "ci-base" + ], + "configurePreset": "macos-ci" + } + ], + "testPresets": [ + { + "name": "ci-base", + "hidden": true, + "inherits": [ + "default" + ], + "output": { + "outputOnFailure": true + } + }, + { + "name": "gcc-ci", + "displayName": "GCC toolchain", + "inherits": [ + "ci-base" + ], + "configurePreset": "gcc-ci" + }, + { + "name": "intel-ci", + "displayName": "Intel toolchain", + "inherits": [ + "ci-base" + ], + "configurePreset": "intel-ci" + }, + { + "name": "llvm-ci", + "displayName": "LLVM (Clang) toolchain", + "inherits": [ + "ci-base" + ], + "configurePreset": "llvm-ci" + }, + { + "name": "windows-ci", + "displayName": "Windows native toolchain", + "inherits": [ + "ci-base" + ], + "configurePreset": "windows-ci" + }, + { + "name": "macos-ci", + "displayName": "Test preset for MacOS native toolchain", + "inherits": [ + "ci-base" + ], + "configurePreset": "macos-ci" + } + ], + "workflowPresets": [ + { + "name": "gcc-ci", + "displayName": "GCC toolchain", + "steps": [ + { + "type": "configure", + "name": "gcc-ci" + }, + { + "type": "build", + "name": "gcc-ci" + }, + { + "type": "test", + "name": "gcc-ci" + } + ] + }, + { + "name": "intel-ci", + "displayName": "Intel toolchain", + "steps": [ + { + "type": "configure", + "name": "intel-ci" + }, + { + "type": "build", + "name": "intel-ci" + }, + { + "type": "test", + "name": "intel-ci" + } + ] + }, + { + "name": "llvm-ci", + "displayName": "LLVM (Clang) toolchain", + "steps": [ + { + "type": "configure", + "name": "llvm-ci" + }, + { + "type": "build", + "name": "llvm-ci" + }, + { + "type": "test", + "name": "llvm-ci" + } + ] + }, + { + "name": "windows-ci", + "displayName": "Windows native toolchain", + "steps": [ + { + "type": "configure", + "name": "windows-ci" + }, + { + "type": "build", + "name": "windows-ci" + }, + { + "type": "test", + "name": "windows-ci" + } + ] + }, + { + "name": "macos-ci", + "displayName": "MacOS native toolchain", + "steps": [ + { + "type": "configure", + "name": "macos-ci" + }, + { + "type": "build", + "name": "macos-ci" + }, + { + "type": "test", + "name": "macos-ci" + } + ] + } + ] +} diff --git a/cmake/CMakePresets-defaults.json b/cmake/CMakePresets-defaults.json new file mode 100644 index 0000000..0b46ba7 --- /dev/null +++ b/cmake/CMakePresets-defaults.json @@ -0,0 +1,50 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "default", + "displayName": "Default", + "binaryDir": "cmake-build-release", + "cacheVariables": { + "CMAKE_BUILD_TYPE": { + "type": "STRING", + "value": "Release" + } + } + } + ], + "buildPresets": [ + { + "name": "default", + "displayName": "Default", + "configurePreset": "default" + } + ], + "testPresets": [ + { + "name": "default", + "displayName": "Default", + "configurePreset": "default" + } + ], + "workflowPresets": [ + { + "name": "default", + "displayName": "Default", + "steps": [ + { + "type": "configure", + "name": "default" + }, + { + "type": "build", + "name": "default" + }, + { + "type": "test", + "name": "default" + } + ] + } + ] +} From 4134b6a55dcb2203769478243b30d3dce75ab36f Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 6 Nov 2023 11:25:26 +0100 Subject: [PATCH 02/21] Implement basic project structure Signed-off-by: Cristian Le --- .gitignore | 7 ++++ CMakeLists.txt | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ace1171 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +## CMake patterns +CMakeUserPresets.json + +## Other common pattern +build/ +# Jetbrains default +cmake-build-*/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..087feca --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,91 @@ +# Minimum version follows the current Ubuntu LTS and RHEL version +cmake_minimum_required(VERSION 3.20) +# CMake version compatibility. This allows to future-proof implementations and easily update +# when bumping cmake_minimum_required + +#[==============================================================================================[ +# Basic project definition # +]==============================================================================================] + +list(APPEND CMAKE_MESSAGE_CONTEXT Template) +project(Template + VERSION 0.1.0 + DESCRIPTION "CMake project template" + HOMEPAGE_URL https://github.com/LecrisUT/CMake-Template + LANGUAGES CXX +) + +# Back-porting to PROJECT_IS_TOP_LEVEL to older cmake +# TODO: Remove when requiring cmake >= 3.21 +if (NOT DEFINED Template_IS_TOP_LEVEL) + if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) + set(PROJECT_IS_TOP_LEVEL ON) + else () + set(PROJECT_IS_TOP_LEVEL OFF) + endif () + set(Template_IS_TOP_LEVEL ${PROJECT_IS_TOP_LEVEL}) +endif () + +# Specify C++ standard used in the project. +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS ON) + +#[==============================================================================================[ +# Options # +]==============================================================================================] + +include(CMakeDependentOption) +include(FeatureSummary) + +option(TEMPLATE_TESTS "Template: Build test-suite" ${PROJECT_IS_TOP_LEVEL}) +option(TEMPLATE_SHARED_LIBS "Template: Build as a shared library" ${PROJECT_IS_TOP_LEVEL}) +option(TEMPLATE_INSTALL "Template: Install project" ${PROJECT_IS_TOP_LEVEL}) + + +#[==============================================================================================[ +# Project configuration # +]==============================================================================================] + +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + +# Include basic tools +include(FetchContent) +if (TEMPLATE_INSTALL) + include(CMakePackageConfigHelpers) + if (UNIX) + include(GNUInstallDirs) + endif () +endif () + +# Define basic parameters +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif () +set(BUILD_SHARED_LIBS ${TEMPLATE_SHARED_LIBS}) + +#[==============================================================================================[ +# External packages # +]==============================================================================================] + +feature_summary( + FILENAME ${CMAKE_CURRENT_BINARY_DIR}/Template.info + VAR Template_Info + DESCRIPTION "Template features and external libraries" + FATAL_ON_MISSING_REQUIRED_PACKAGES + WHAT ALL +) + +# Report configuration +message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") +message(STATUS ${Template_Info}) + +#[==============================================================================================[ +# Main definition # +]==============================================================================================] + +# Main project + +#[==============================================================================================[ +# Install or Export # +]==============================================================================================] From 1b07644d0f1b3d2a1cc6a86c0f61ec02a0404a91 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 6 Nov 2023 13:13:13 +0100 Subject: [PATCH 03/21] Add basic pre-commit Signed-off-by: Cristian Le --- .gitignore | 1 + .pre-commit-config.yaml | 29 +++++++++++++++++++++++++++++ README.md | 20 +++++++++----------- 3 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.gitignore b/.gitignore index ace1171..ba0b708 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ ## CMake patterns CMakeUserPresets.json +compile_commands.json ## Other common pattern build/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..68776d5 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,29 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - repo: https://github.com/Takishima/cmake-pre-commit-hooks + rev: v1.5.3 + hooks: + - id: clang-format + args: + - '-Bcmake-build-pre-commit' + - '-i' + - id: clang-tidy + args: + - '-Bcmake-build-pre-commit' + - repo: https://github.com/executablebooks/mdformat + rev: 0.7.16 + hooks: + - id: mdformat + additional_dependencies: + - mdformat-gfm + - mdformat-tables + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.21.0 + hooks: + - id: check-github-workflows diff --git a/README.md b/README.md index 779b5ba..64d7e17 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,6 @@ This modern design ensures: - The CMake components can be documented using a [`sphinx`][sphinx] documentation engine. -[cmake-presets]: https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html -[sphinx]: https://docs.readthedocs.io/en/stable/intro/getting-started-with-sphinx.html - ### Modern CI tools The CI tools available are constantly evolving, but broadly they cover: @@ -53,8 +50,6 @@ The CI tools available are constantly evolving, but broadly they cover: - [`sphinx`][sphinx] documentation - Static code analysis -[pre-commit]: https://pre-commit.com/ - ### Packaging and downstream tools In this template we focus on packaging to Fedora due to their vast CI tools: @@ -64,14 +59,17 @@ In this template we focus on packaging to Fedora due to their vast CI tools: - [`tmt`][tmt] and [testing-farm]: Used to test your project as if it has been installed and run locally -[packit]: https://packit.dev -[copr]: https://copr.fedorainfracloud.org/ -[testing-farm]: https://docs.testing-farm.io/Testing%20Farm/0.1/index.html -[Fedora]: https://src.fedoraproject.org/ -[tmt]: https://tmt.readthedocs.io/en/stable/ - ## License This template project is licensed under MIT license. Please update the [`LICENSE`](LICENSE) file after using this template. You may re-license your project as you wish after using this template. + +[cmake-presets]: https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html +[copr]: https://copr.fedorainfracloud.org/ +[fedora]: https://src.fedoraproject.org/ +[packit]: https://packit.dev +[pre-commit]: https://pre-commit.com/ +[sphinx]: https://docs.readthedocs.io/en/stable/intro/getting-started-with-sphinx.html +[testing-farm]: https://docs.testing-farm.io/Testing%20Farm/0.1/index.html +[tmt]: https://tmt.readthedocs.io/en/stable/ From 118f2a016c0a83bbd46801ca99de118f6a1eae8b Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 6 Nov 2023 11:28:34 +0100 Subject: [PATCH 04/21] Implement basic project Signed-off-by: Cristian Le --- CMakeLists.txt | 31 +++++++++++++++++++++++++++++++ src/CMakeLists.txt | 14 ++++++++++++++ src/main.cpp | 6 ++++++ src/template.cpp | 7 +++++++ src/template.h | 9 +++++++++ 5 files changed, 67 insertions(+) create mode 100644 src/CMakeLists.txt create mode 100644 src/main.cpp create mode 100644 src/template.cpp create mode 100644 src/template.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 087feca..b0d9c52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.20) # CMake version compatibility. This allows to future-proof implementations and easily update # when bumping cmake_minimum_required +# Enable using return(PROPAGATE) +# TODO: Remove when cmake 3.25 is commonly distributed +if (POLICY CMP0140) + cmake_policy(SET CMP0140 NEW) +endif () #[==============================================================================================[ # Basic project definition # @@ -68,6 +73,14 @@ set(BUILD_SHARED_LIBS ${TEMPLATE_SHARED_LIBS}) # External packages # ]==============================================================================================] +FetchContent_Declare(fmt + GIT_REPOSITORY https://github.com/fmtlib/fmt + GIT_TAG master + FIND_PACKAGE_ARGS CONFIG +) + +FetchContent_MakeAvailable(fmt) + feature_summary( FILENAME ${CMAKE_CURRENT_BINARY_DIR}/Template.info VAR Template_Info @@ -85,6 +98,24 @@ message(STATUS ${Template_Info}) ]==============================================================================================] # Main project +add_executable(Template_Hello) +set_target_properties(Template_Hello PROPERTIES + EXPORT_NAME Hello + OUTPUT_NAME hello +) +add_executable(Template::Hello ALIAS Template_Hello) +add_library(Template_Template) +set_target_properties(Template_Template PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} + EXPORT_NAME Template + OUTPUT_NAME template +) +add_library(Template::Template ALIAS Template_Template) +# Main definitions inside src +add_subdirectory(src) + +# Testing #[==============================================================================================[ # Install or Export # diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..5f85a0a --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,14 @@ +target_sources(Template_Hello PRIVATE + main.cpp +) +target_sources(Template_Template PRIVATE + template.cpp +) + +target_link_libraries(Template_Hello PRIVATE Template_Template) +set_target_properties(Template_Template PROPERTIES + PUBLIC_HEADER template.h +) +target_include_directories(Template_Template PUBLIC + "$" +) diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..7b51f14 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,6 @@ +#include "template.h" + +int main() { + tmpl::hello(); + return 0; +} diff --git a/src/template.cpp b/src/template.cpp new file mode 100644 index 0000000..63c324e --- /dev/null +++ b/src/template.cpp @@ -0,0 +1,7 @@ +#include + +#include "template.h" + +void tmpl::hello() { + std::cout << "Hello, World!" << std::endl; +} diff --git a/src/template.h b/src/template.h new file mode 100644 index 0000000..959038b --- /dev/null +++ b/src/template.h @@ -0,0 +1,9 @@ + +#ifndef TEMPLATE_TEMPLATE_H +#define TEMPLATE_TEMPLATE_H + +namespace tmpl { +void hello(); +} + +#endif // TEMPLATE_TEMPLATE_H From 4b244ffd8b8f72f45e90a01a07e451ed3de0065c Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 6 Nov 2023 17:03:43 +0100 Subject: [PATCH 05/21] Link project to `fmt` Signed-off-by: Cristian Le --- src/CMakeLists.txt | 1 + src/template.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5f85a0a..77e0762 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,6 +5,7 @@ target_sources(Template_Template PRIVATE template.cpp ) +target_link_libraries(Template_Template PRIVATE fmt::fmt) target_link_libraries(Template_Hello PRIVATE Template_Template) set_target_properties(Template_Template PROPERTIES PUBLIC_HEADER template.h diff --git a/src/template.cpp b/src/template.cpp index 63c324e..44894b0 100644 --- a/src/template.cpp +++ b/src/template.cpp @@ -1,7 +1,9 @@ #include +#include + #include "template.h" void tmpl::hello() { - std::cout << "Hello, World!" << std::endl; + std::cout << fmt::format("Hello, {}!", "World") << std::endl; } From 209ce5f70f6aee690ac3062fc2e35472382364b9 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 6 Nov 2023 11:30:56 +0100 Subject: [PATCH 06/21] Add test-suite Signed-off-by: Cristian Le --- CMakeLists.txt | 4 +++ test/CMakeLists.txt | 59 +++++++++++++++++++++++++++++++++++++ test/package/CMakeLists.txt | 0 test/unit/CMakeLists.txt | 3 ++ test/unit/test_main.cpp | 34 +++++++++++++++++++++ 5 files changed, 100 insertions(+) create mode 100644 test/CMakeLists.txt create mode 100644 test/package/CMakeLists.txt create mode 100644 test/unit/CMakeLists.txt create mode 100644 test/unit/test_main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index b0d9c52..9a4aa0b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,6 +116,10 @@ add_library(Template::Template ALIAS Template_Template) add_subdirectory(src) # Testing +if (TEMPLATE_TESTS) + enable_testing() + add_subdirectory(test) +endif () #[==============================================================================================[ # Install or Export # diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..33b3a1d --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,59 @@ +cmake_minimum_required(VERSION 3.20) + +#[==============================================================================================[ +# Basic project definition # +]==============================================================================================] + +list(APPEND CMAKE_MESSAGE_CONTEXT Test) +project(Template_test) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS ON) + +#[==============================================================================================[ +# Options # +]==============================================================================================] + +#[==============================================================================================[ +# Project configuration # +]==============================================================================================] + +include(FetchContent) + +#[==============================================================================================[ +# External packages # +]==============================================================================================] + +set(external_libs) +if (NOT Template_IS_TOP_LEVEL) + FetchContent_Declare(Template + GIT_REPOSITORY https://github.com/LecrisUT/CMake-Template + GIT_TAG main + FIND_PACKAGE_ARGS CONFIG + ) + list(APPEND external_libs Template) +endif () +FetchContent_Declare(Catch2 + GIT_REPOSITORY https://github.com/catchorg/Catch2 + GIT_TAG v3.4.0 + FIND_PACKAGE_ARGS CONFIG +) +list(APPEND external_libs Catch2) + +FetchContent_MakeAvailable(${external_libs}) + +#[==============================================================================================[ +# Main definition # +]==============================================================================================] + +enable_testing() +include(Catch) + +add_executable(test-suite) +target_link_libraries(test-suite PRIVATE Catch2::Catch2WithMain Template::Template) + +add_subdirectory(unit) +add_subdirectory(package) + +catch_discover_tests(test-suite) diff --git a/test/package/CMakeLists.txt b/test/package/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt new file mode 100644 index 0000000..dfd715d --- /dev/null +++ b/test/unit/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(test-suite PRIVATE + test_main.cpp +) diff --git a/test/unit/test_main.cpp b/test/unit/test_main.cpp new file mode 100644 index 0000000..fb2e921 --- /dev/null +++ b/test/unit/test_main.cpp @@ -0,0 +1,34 @@ +#include +#include +#include + +#include +#include + +class AutoRestoreRdbuf { + std::ostream& out; + std::streambuf* old; + + public: + ~AutoRestoreRdbuf() { + out.rdbuf(old); + } + AutoRestoreRdbuf(const AutoRestoreRdbuf&) = delete; + AutoRestoreRdbuf(AutoRestoreRdbuf&&) = delete; + + AutoRestoreRdbuf(std::ostream& out) : out{out}, old{out.rdbuf()} {} +}; + +std::string stringWrittentToStream(std::function f, + std::ostream& out = std::cout) { + AutoRestoreRdbuf restore{std::cout}; + std::ostringstream oss; + std::cout.rdbuf(oss.rdbuf()); + f(); + return oss.str(); +} + +TEST_CASE("Test hello function", "[unit]") { + auto output = stringWrittentToStream(&tmpl::hello); + CHECK(output == "Hello, World!\n"); +} From 21f8b877dcf04056f546f634e0908244599323d2 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 6 Nov 2023 14:12:41 +0100 Subject: [PATCH 07/21] Add packaging tests Signed-off-by: Cristian Le --- test/package/FetchContent/CMakeLists.txt | 34 ++++++++++++++++++++++++ test/package/FetchContent/main.cpp | 1 + test/package/find_package/CMakeLists.txt | 15 +++++++++++ test/package/find_package/main.cpp | 1 + test/package/main.cpp | 6 +++++ test/package/pkg-config/CMakeLists.txt | 16 +++++++++++ test/package/pkg-config/main.cpp | 1 + 7 files changed, 74 insertions(+) create mode 100644 test/package/FetchContent/CMakeLists.txt create mode 120000 test/package/FetchContent/main.cpp create mode 100644 test/package/find_package/CMakeLists.txt create mode 120000 test/package/find_package/main.cpp create mode 100644 test/package/main.cpp create mode 100644 test/package/pkg-config/CMakeLists.txt create mode 120000 test/package/pkg-config/main.cpp diff --git a/test/package/FetchContent/CMakeLists.txt b/test/package/FetchContent/CMakeLists.txt new file mode 100644 index 0000000..8d78f01 --- /dev/null +++ b/test/package/FetchContent/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.20) +project(example_spglib LANGUAGES CXX) + +include(FetchContent) + +if (DEFINED ENV{PACKIT_SOURCE_URL}) + set(git_repo $ENV{PACKIT_SOURCE_URL}) +else () + set(git_repo https://github.com/LecrisUT/CMake-Template) +endif () +if (DEFINED ENV{PACKIT_SOURCE_SHA}) + set(git_tag $ENV{PACKIT_SOURCE_SHA}) +elseif (DEFINED ENV{PACKIT_COMMIT_SHA}) + set(git_tag $ENV{PACKIT_COMMIT_SHA}) +else () + set(git_tag main) +endif () + +FetchContent_Declare(Template + GIT_REPOSITORY ${git_repo} + GIT_TAG ${git_tag} +) +FetchContent_MakeAvailable(Template) + +add_executable(main main.cpp) +target_link_libraries(main PRIVATE Template::Template) + +enable_testing() +add_test(NAME smoke_test + COMMAND $ +) +set_tests_properties(smoke_test PROPERTIES + PASS_REGULAR_EXPRESSION "^Hello, World!" +) diff --git a/test/package/FetchContent/main.cpp b/test/package/FetchContent/main.cpp new file mode 120000 index 0000000..cb9fa3f --- /dev/null +++ b/test/package/FetchContent/main.cpp @@ -0,0 +1 @@ +../main.cpp \ No newline at end of file diff --git a/test/package/find_package/CMakeLists.txt b/test/package/find_package/CMakeLists.txt new file mode 100644 index 0000000..49192dd --- /dev/null +++ b/test/package/find_package/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.20) +project(example_spglib LANGUAGES CXX) + +find_package(Template REQUIRED CONFIG) + +add_executable(main main.cpp) +target_link_libraries(main PRIVATE Template::Template) + +enable_testing() +add_test(NAME smoke_test + COMMAND $ +) +set_tests_properties(smoke_test PROPERTIES + PASS_REGULAR_EXPRESSION "^Hello, World!" +) diff --git a/test/package/find_package/main.cpp b/test/package/find_package/main.cpp new file mode 120000 index 0000000..cb9fa3f --- /dev/null +++ b/test/package/find_package/main.cpp @@ -0,0 +1 @@ +../main.cpp \ No newline at end of file diff --git a/test/package/main.cpp b/test/package/main.cpp new file mode 100644 index 0000000..7b51f14 --- /dev/null +++ b/test/package/main.cpp @@ -0,0 +1,6 @@ +#include "template.h" + +int main() { + tmpl::hello(); + return 0; +} diff --git a/test/package/pkg-config/CMakeLists.txt b/test/package/pkg-config/CMakeLists.txt new file mode 100644 index 0000000..9449a1a --- /dev/null +++ b/test/package/pkg-config/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.20) +project(example_spglib LANGUAGES CXX) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(Template REQUIRED IMPORTED_TARGET template) + +add_executable(main main.cpp) +target_link_libraries(main PRIVATE PkgConfig::Template) + +enable_testing() +add_test(NAME smoke_test + COMMAND $ +) +set_tests_properties(smoke_test PROPERTIES + PASS_REGULAR_EXPRESSION "^Hello, World!" +) diff --git a/test/package/pkg-config/main.cpp b/test/package/pkg-config/main.cpp new file mode 120000 index 0000000..cb9fa3f --- /dev/null +++ b/test/package/pkg-config/main.cpp @@ -0,0 +1 @@ +../main.cpp \ No newline at end of file From e76609f6b492cd6213f824ebca65e29eaf263a01 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 6 Nov 2023 12:00:50 +0100 Subject: [PATCH 08/21] Add packaging Signed-off-by: Cristian Le --- CMakeLists.txt | 59 +++++++++++++++++++++++++++++++++++ cmake/TemplateConfig.cmake.in | 3 ++ cmake/template.pc.in | 6 ++++ src/CMakeLists.txt | 15 +++++++++ 4 files changed, 83 insertions(+) create mode 100644 cmake/TemplateConfig.cmake.in create mode 100644 cmake/template.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a4aa0b..7000cc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,3 +124,62 @@ endif () #[==============================================================================================[ # Install or Export # ]==============================================================================================] + +# Installation +if (TEMPLATE_INSTALL) + # pkg-config files + configure_file(cmake/template.pc.in template.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/template.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + COMPONENT Template_Development + ) + + # cmake export files + write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/TemplateConfigVersion.cmake + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion + ) + configure_package_config_file( + cmake/TemplateConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/TemplateConfig.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Template + ) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/TemplateConfigVersion.cmake + ${CMAKE_CURRENT_BINARY_DIR}/TemplateConfig.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Template + COMPONENT Template_Development + ) + + export(EXPORT TemplateTargets + FILE TemplateTargets.cmake + NAMESPACE Template:: + ) + install(EXPORT TemplateTargets + FILE TemplateTargets.cmake + NAMESPACE Template:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Template + COMPONENT Template_Development + ) +endif () + +# Make project available for FetchContent +if(NOT PROJECT_IS_TOP_LEVEL) + # Propagate variables + if (CMAKE_VERSION VERSION_LESS 3.25) + # TODO: Remove when cmake 3.25 is commonly distributed + set(Template_VERSION ${Template_VERSION} PARENT_SCOPE) + set(Template_VERSION_MAJOR ${Template_VERSION_MAJOR} PARENT_SCOPE) + set(Template_VERSION_MINOR ${Template_VERSION_MINOR} PARENT_SCOPE) + set(Template_VERSION_PATCH ${Template_VERSION_PATCH} PARENT_SCOPE) + set(Template_VERSION_TWEAK ${Template_VERSION_TWEAK} PARENT_SCOPE) + else () + return(PROPAGATE + Template_VERSION + Template_VERSION_MAJOR + Template_VERSION_MINOR + Template_VERSION_PATCH + Template_VERSION_TWEAK + ) + endif () +endif () diff --git a/cmake/TemplateConfig.cmake.in b/cmake/TemplateConfig.cmake.in new file mode 100644 index 0000000..b4bfadd --- /dev/null +++ b/cmake/TemplateConfig.cmake.in @@ -0,0 +1,3 @@ +@PACKAGE_INIT@ + +include(${CMAKE_CURRENT_LIST_DIR}/TemplateTargets.cmake) diff --git a/cmake/template.pc.in b/cmake/template.pc.in new file mode 100644 index 0000000..2407cb2 --- /dev/null +++ b/cmake/template.pc.in @@ -0,0 +1,6 @@ +Name: @PROJECT_NAME@ +Description: @PROJECT_DESCRIPTION@ +Version: @PROJECT_VERSION@ + +Libs: -L@CMAKE_INSTALL_FULL_LIBDIR@ -ltemplate +Cflags: -I@CMAKE_INSTALL_FULL_INCLUDEDIR@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 77e0762..fbafe73 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,4 +12,19 @@ set_target_properties(Template_Template PROPERTIES ) target_include_directories(Template_Template PUBLIC "$" + "$" ) + +if (TEMPLATE_INSTALL) + install(TARGETS Template_Hello + EXPORT TemplateTargets + RUNTIME DESTINATION ${CMAKE_INSTALL_RUNTIMEDIR} COMPONENT Template_Runtime + ) + install(TARGETS Template_Template + EXPORT TemplateTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Template_Runtime NAMELINK_COMPONENT Template_Development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Template_Development + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT Template_Development + RUNTIME DESTINATION ${CMAKE_INSTALL_RUNTIMEDIR} COMPONENT Template_Runtime + ) +endif () From d68c83b8e802ba2aa33771cd294f98f29e26e240 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 6 Nov 2023 13:11:10 +0100 Subject: [PATCH 09/21] Add basic GitHub CI Signed-off-by: Cristian Le --- .github/workflows/ci.yaml | 33 +++++++++++++++++ .github/workflows/release.yaml | 50 ++++++++++++++++++++++++++ .github/workflows/step_pre-commit.yaml | 19 ++++++++++ .github/workflows/step_test.yaml | 49 +++++++++++++++++++++++++ 4 files changed, 151 insertions(+) create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/release.yaml create mode 100644 .github/workflows/step_pre-commit.yaml create mode 100644 .github/workflows/step_test.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..3cf3677 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,33 @@ +name: CI + +on: + workflow_dispatch: + pull_request: + branches: [ main ] + push: + branches: [ main ] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + pre-commit: + uses: ./.github/workflows/step_pre-commit.yaml + + tests: + needs: [ pre-commit ] + uses: ./.github/workflows/step_test.yaml + + pass: + needs: [ pre-commit, tests ] + runs-on: ubuntu-latest + steps: + - name: Check all CI jobs + uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} + if: always() diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..f0cc2fe --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,50 @@ +name: release +run-name: Release + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" + +jobs: + tests: + uses: ./.github/workflows/step_test.yaml + pypi-wheel: + needs: [ tests ] + uses: ./.github/workflows/step_build-wheel.yaml + upload_pypi: + name: Upload to PyPI repository + needs: [ tests, pypi-wheel ] + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/project/spglib/ + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v3 + with: + name: artifact + path: dist + - name: Publish package to TestPyPI + if: ${{ contains(github.ref, 'rc') }} + # TODO: Maybe we can move this to main PyPI since it is marked rc + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository_url: https://test.pypi.org/legacy/ + - name: Publish package to PyPI + if: ${{ !contains(github.ref, 'rc') }} + uses: pypa/gh-action-pypi-publish@release/v1 + release: + needs: [ upload_pypi ] + name: Create release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: softprops/action-gh-release@v1 + with: + name: Spglib ${{ github.ref_name }} + draft: true + prerelease: ${{ contains(github.ref, 'rc') }} + generate_release_notes: true diff --git a/.github/workflows/step_pre-commit.yaml b/.github/workflows/step_pre-commit.yaml new file mode 100644 index 0000000..4f2f93a --- /dev/null +++ b/.github/workflows/step_pre-commit.yaml @@ -0,0 +1,19 @@ +name: pre-commit +run-name: Run pre-commits + +on: + workflow_call: + +permissions: + contents: read + +jobs: + pre-commit: + name: Check pre-commit + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + - uses: pre-commit/action@v3.0.0 diff --git a/.github/workflows/step_test.yaml b/.github/workflows/step_test.yaml new file mode 100644 index 0000000..6aa8743 --- /dev/null +++ b/.github/workflows/step_test.yaml @@ -0,0 +1,49 @@ +name: test +run-name: Run tests + +on: + workflow_call: + +permissions: + contents: read + +jobs: + tests: + name: Check ${{ matrix.toolchain }} toolchain + runs-on: ${{ matrix.os || 'ubuntu-latest' }} + container: ${{ !matrix.os && 'ghcr.io/lecrisut/dev-env:main' || '' }} + continue-on-error: ${{ matrix.experimental || false }} + strategy: + fail-fast: false + matrix: + toolchain: [ gcc, llvm, intel, windows, macos ] + include: + - os: windows-latest + toolchain: windows + - os: macos-latest + toolchain: macos + steps: + - name: Enable msvc toolchain on windows + uses: ilammy/msvc-dev-cmd@v1 + if: contains(matrix.os, 'windows') + - name: Activate Intel compilers + run: | + source /opt/intel/oneapi/setvars.sh + printenv >> $GITHUB_ENV + echo $PATH >> $GITHUB_PATH + if: matrix.toolchain == 'intel' + - uses: actions/checkout@v4 + - uses: lukka/get-cmake@latest + - name: Run CMake configuration for ${{ matrix.toolchain }} toolchain + uses: lukka/run-cmake@v10.3 + with: + workflowPreset: "${{ matrix.toolchain }}-ci" + pass: + needs: [ tests ] + runs-on: ubuntu-latest + steps: + - name: Check test jobs + uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} + if: always() From 400ee7597f3cbb1382ee6c802fc2b36f3ae6caae Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 6 Nov 2023 20:17:46 +0100 Subject: [PATCH 10/21] Add packit packaging Signed-off-by: Cristian Le --- .distro/.fmf/version | 1 + .distro/cmake-template.rpmlintrc | 0 .distro/cmake-template.spec | 62 +++++++++++++++++++++++++ .distro/plans/main.fmf.dist-git | 4 ++ .packit.yaml | 79 ++++++++++++++++++++++++++++++++ 5 files changed, 146 insertions(+) create mode 100644 .distro/.fmf/version create mode 100644 .distro/cmake-template.rpmlintrc create mode 100644 .distro/cmake-template.spec create mode 100644 .distro/plans/main.fmf.dist-git create mode 100644 .packit.yaml diff --git a/.distro/.fmf/version b/.distro/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.distro/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.distro/cmake-template.rpmlintrc b/.distro/cmake-template.rpmlintrc new file mode 100644 index 0000000..e69de29 diff --git a/.distro/cmake-template.spec b/.distro/cmake-template.spec new file mode 100644 index 0000000..9d01498 --- /dev/null +++ b/.distro/cmake-template.spec @@ -0,0 +1,62 @@ +Name: cmake-template +Summary: CMake project template +Version: 0.0.0 +Release: %autorelease +License: MIT +URL: https://github.com/LecrisUT/CMake-Template + +Source: https://github.com/LecrisUT/CMake-Template/archive/refs/tags/v%{version}.tar.gz + +BuildRequires: ninja-build +BuildRequires: cmake +BuildRequires: gcc-c++ +BuildRequires: fmt-devel +BuildRequires: catch-devel +Requires: fmt + +%description +CMake project template + +%package devel +Summary: Development files for cmake-template +Requires: cmake-template%{?_isa} = %{version}-%{release} + +%description devel +This package contains libraries and header files for developing +applications that use cmake-template. + + +%prep +%autosetup -n cmake-template-%{version} + + +%build +%cmake \ + -DTEMPLATE_SHARED_LIBS=ON \ + -DTEMPLATE_TESTS=ON +%cmake_build + + +%install +%cmake_install + + +%check +%ctest + + +%files +%doc README.md +%license LICENSE +%{_libdir}/libtemplate.so.* +%{_bindir}/hello + +%files devel +%{_libdir}/libtemplate.so +%{_includedir}/template.h +%{_libdir}/cmake/Template +%{_libdir}/pkgconfig/template.pc + + +%changelog +%autochangelog diff --git a/.distro/plans/main.fmf.dist-git b/.distro/plans/main.fmf.dist-git new file mode 100644 index 0000000..795b207 --- /dev/null +++ b/.distro/plans/main.fmf.dist-git @@ -0,0 +1,4 @@ +discover: + how: fmf + dist-git-source: true + dist-git-extract: cmake-template-*/ diff --git a/.packit.yaml b/.packit.yaml new file mode 100644 index 0000000..d312acb --- /dev/null +++ b/.packit.yaml @@ -0,0 +1,79 @@ +specfile_path: .distro/cmake-template.spec + +# add or remove files that should be synced +files_to_sync: + - src: .distro/cmake-template.spec + dest: cmake-template.spec + - .packit.yaml + - src: .distro/cmake-template.rpmlintrc + dest: cmake-template.rpmlintrc + # tmt setup + - src: .distro/.fmf/ + dest: .fmf/ + - src: .distro/plans/ + dest: plans/ + filters: + - "- main.fmf.dist-git" + - src: .distro/plans/main.fmf.dist-git + dest: plans/main.fmf + - .packit.yaml + +upstream_package_name: CMake-Template +downstream_package_name: cmake-template + +update_release: false +upstream_tag_template: v{version} + +jobs: + - job: copr_build + trigger: pull_request + owner: lecris + project: cmake-template + targets: + - fedora-all-x86_64 + - fedora-all-aarch64 + - epel-9-x86_64 + - epel-9-aarch64 + - job: tests + trigger: pull_request + targets: + - fedora-all-x86_64 + - fedora-all-aarch64 + - epel-9-x86_64 + - epel-9-aarch64 + fmf_path: .distro + - job: copr_build + trigger: commit + branch: main + owner: lecris + project: nightly + targets: + - fedora-all-x86_64 + - fedora-all-aarch64 + - epel-9-x86_64 + - epel-9-aarch64 + - job: tests + trigger: commit + branch: main + targets: + - fedora-all-x86_64 + - fedora-all-aarch64 + - epel-9-x86_64 + - epel-9-aarch64 + fmf_path: .distro + ## Uncomment when released downstream +# - job: propose_downstream +# trigger: release +# dist_git_branches: +# - fedora-rawhide +# - epel-9 +# - job: koji_build +# trigger: commit +# dist_git_branches: +# - fedora-all +# - epel-9 +# - job: bodhi_update +# trigger: commit +# dist_git_branches: +# - fedora-branched +# - epel-9 From 27da8c912bc5284572725dddc21b5afd5ad3bedf Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 6 Nov 2023 20:19:44 +0100 Subject: [PATCH 11/21] Add basic tmt plans Signed-off-by: Cristian Le --- .distro/plans/rpminspect.fmf | 7 +++++++ .distro/plans/rpmlint.fmf | 5 +++++ .distro/plans/smoke.fmf | 7 +++++++ .distro/tests/smoke.fmf | 9 +++++++++ .packit.yaml | 2 ++ 5 files changed, 30 insertions(+) create mode 100644 .distro/plans/rpminspect.fmf create mode 100644 .distro/plans/rpmlint.fmf create mode 100644 .distro/plans/smoke.fmf create mode 100644 .distro/tests/smoke.fmf diff --git a/.distro/plans/rpminspect.fmf b/.distro/plans/rpminspect.fmf new file mode 100644 index 0000000..878c94e --- /dev/null +++ b/.distro/plans/rpminspect.fmf @@ -0,0 +1,7 @@ +plan: + import: + url: https://github.com/packit/tmt-plans + ref: main + name: /plans/rpminspect +environment: + RPMINSPECT_EXCLUDE: disttag diff --git a/.distro/plans/rpmlint.fmf b/.distro/plans/rpmlint.fmf new file mode 100644 index 0000000..aac0154 --- /dev/null +++ b/.distro/plans/rpmlint.fmf @@ -0,0 +1,5 @@ +plan: + import: + url: https://github.com/packit/tmt-plans + ref: main + name: /plans/rpmlint diff --git a/.distro/plans/smoke.fmf b/.distro/plans/smoke.fmf new file mode 100644 index 0000000..57874e5 --- /dev/null +++ b/.distro/plans/smoke.fmf @@ -0,0 +1,7 @@ +summary: + Basic smoke tests +discover: + how: fmf + filter: "tag: smoke" +execute: + how: tmt diff --git a/.distro/tests/smoke.fmf b/.distro/tests/smoke.fmf new file mode 100644 index 0000000..3f9038e --- /dev/null +++ b/.distro/tests/smoke.fmf @@ -0,0 +1,9 @@ +# Common test variables +tag: + - smoke +tier: 0 +path: / + +# Define tests +/version: + test: hello diff --git a/.packit.yaml b/.packit.yaml index d312acb..a59e852 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -14,6 +14,8 @@ files_to_sync: dest: plans/ filters: - "- main.fmf.dist-git" + - "- rpminspect.fmf" + - "- rpmlint.fmf" - src: .distro/plans/main.fmf.dist-git dest: plans/main.fmf - .packit.yaml From 6499953693a17b8e87836af8e40fc5f6dce76c5b Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 6 Nov 2023 20:19:54 +0100 Subject: [PATCH 12/21] Add bundled ctest tmt plan Signed-off-by: Cristian Le --- .distro/plans/ctest.fmf | 7 +++++++ test/.fmf/version | 1 + test/ctest.fmf | 11 +++++++++++ test/test.sh | 25 +++++++++++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 .distro/plans/ctest.fmf create mode 100644 test/.fmf/version create mode 100644 test/ctest.fmf create mode 100755 test/test.sh diff --git a/.distro/plans/ctest.fmf b/.distro/plans/ctest.fmf new file mode 100644 index 0000000..2ea3895 --- /dev/null +++ b/.distro/plans/ctest.fmf @@ -0,0 +1,7 @@ +summary: + Test the bundled ctests +discover+: + how: fmf + path: test +execute: + how: tmt diff --git a/test/.fmf/version b/test/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/test/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/test/ctest.fmf b/test/ctest.fmf new file mode 100644 index 0000000..e17c0a8 --- /dev/null +++ b/test/ctest.fmf @@ -0,0 +1,11 @@ +tag: [ cmake ] +require: + - cmake + - rsync + - tree + - gcc-c++ + - pkgconf + - git +framework: beakerlib +path: / +test: ./test.sh diff --git a/test/test.sh b/test/test.sh new file mode 100755 index 0000000..244948f --- /dev/null +++ b/test/test.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# shellcheck disable=all +source /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup + rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory" + rlRun "rsync -rL ./ $tmp" 0 "Copy example project" + rlRun "pushd $tmp" + rlRun "tree" 0 "Show directory tree" + rlRun "set -o pipefail" + rlPhaseEnd + + rlPhaseStartTest + rlRun "cmake -B ./build" + rlRun "cmake --build ./build" + rlRun "ctest --test-dir ./build --output-on-failure" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $tmp" 0 "Remove tmp directory" + rlPhaseEnd +rlJournalEnd From a78254b8631570c8a2083d5b5f316296e8907bde Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 6 Nov 2023 16:56:24 +0100 Subject: [PATCH 13/21] Add Find helpers Signed-off-by: Cristian Le --- cmake/Template_Helpers.cmake | 155 +++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 cmake/Template_Helpers.cmake diff --git a/cmake/Template_Helpers.cmake b/cmake/Template_Helpers.cmake new file mode 100644 index 0000000..e0c0737 --- /dev/null +++ b/cmake/Template_Helpers.cmake @@ -0,0 +1,155 @@ +include_guard(GLOBAL) + +include(FindPackageHandleStandardArgs) +find_package(PkgConfig REQUIRED) + +macro(Template_FindPackage name) + #[===[.md + # Template_FindPackage + + A compatibility macro that links `find_package(CONFIG)` packages with `pkg-config`. This should only + be called within the `Find.cmake` file. + + Note: Version range syntax is not supported for pkg-config searching. Only the lower bound will be respected. + + ]===] + + list(APPEND CMAKE_MESSAGE_CONTEXT "Template_FindPackage") + set(ARGS_Options "HAVE_FALLBACK") + set(ARGS_OneValue "") + set(ARGS_MultiValue "NAMES;PKG_MODULE_NAMES;PKG_MODULE_SPECS") + cmake_parse_arguments(ARGS "${ARGS_Options}" "${ARGS_OneValue}" "${ARGS_MultiValue}" ${ARGN}) + + # First try to find native Config.cmake + # Build the arguments + # COMPONENTS + set(_comp_args) + set(_opt_comp_args) + if (DEFINED ${name}_FIND_COMPONENTS) + list(APPEND _comp_args COMPONENTS) + foreach (_comp IN LISTS ${name}_FIND_COMPONENTS) + if (${name}_FIND_REQUIRED_${_comp}) + list(APPEND _comp_args ${_comp}) + else () + if (NOT DEFINED _opt_comp_args) + list(APPEND _opt_comp_args OPTIONAL_COMPONENTS) + endif () + list(APPEND _opt_comp_args ${_comp}) + endif () + endforeach () + endif () + + # Version + # Try range format first, otherwise use the default + set(_version_args ${${name}_FIND_VERSION_RANGE}) + if (NOT DEFINED _version_args) + set(_version_args ${${name}_FIND_VERSION}) + endif () + if (${name}_FIND_VERSION_EXACT) + list(APPEND _version_args EXACT) + endif () + + # QUIET + set(_quiet_arg) + if (${name}_FIND_QUIETLY) + list(APPEND _quiet_arg QUIET) + endif () + + # REQUIRED + set(_required_arg) + if (NOT ARGS_HAVE_FALLBACK AND ${name}_FIND_REQUIRED) + list(APPEND _required_arg REQUIRED) + endif () + + # REGISTRY_VIEW + set(_registry_view_arg) + if (${name}_FIND_REGISTRY_VIEW) + list(APPEND _registry_view REGISTRY_VIEW ${${name}_FIND_REGISTRY_VIEW}) + endif () + + # NAMES + set(_names_args) + if (DEFINED ARGS_NAMES) + list(APPEND _names_args NAMES ${ARGS_NAMES}) + endif () + + # Disable CMAKE_REQUIRE_FIND_PACKAGE_ because there is a fallthrough to pkg-config + set(CMAKE_REQUIRE_FIND_PACKAGE_${name} FALSE) + + # Try Config.cmake + find_package(${name} ${_version_args} ${_quiet_arg} CONFIG + ${_comp_args} + ${_opt_comp_args} + ${_registry_view_arg} + ${_names_args} + ) + if (${name}_FOUND) + find_package_handle_standard_args(${name} + CONFIG_MODE HANDLE_COMPONENTS + ) + else () + # Try pkg-config next + # Construct the moduleSpec to search for + if (NOT DEFINED ARGS_PKG_MODULE_SPECS) + if (NOT DEFINED ARGS_PKG_MODULE_NAMES) + set(ARGS_PKG_MODULE_NAMES ${name}) + endif () + if (DEFINED ${name}_FIND_VERSION_RANGE) + # Can only parse the minimum requirement + foreach (_pkg_name IN LISTS ARGS_PKG_MODULE_NAMES) + list(APPEND ARGS_PKG_MODULE_SPECS "${_pkg_name}>=${${name}_FIND_VERSION_MIN}") + endforeach () + elseif ({${name}_FIND_VERSION_EXACT) + # Requesting exact version + foreach (_pkg_name IN LISTS ARGS_PKG_MODULE_NAMES) + list(APPEND ARGS_PKG_MODULE_SPECS "${_pkg_name}=${${name}_FIND_VERSION}") + endforeach () + elseif (DEFINED ${name}_FIND_VERSION) + # Otherwise treat the request as minimum requirement + foreach (_pkg_name IN LISTS ARGS_PKG_MODULE_NAMES) + list(APPEND ARGS_PKG_MODULE_SPECS "${_pkg_name}>=${${name}_FIND_VERSION}") + endforeach () + else () + # Fallthrough if no version is required + foreach (_pkg_name IN LISTS ARGS_PKG_MODULE_NAMES) + list(APPEND ARGS_PKG_MODULE_SPECS "${_pkg_name}") + endforeach () + endif () + endif () + # Call pkg-config + if (CMAKE_VERSION VERSION_LESS 3.28) + # https://gitlab.kitware.com/cmake/cmake/-/issues/25228 + set(ENV{PKG_CONFIG_ALLOW_SYSTEM_CFLAGS} 1) + endif () + if (CMAKE_VERSION VERSION_LESS 3.22) + # Back-porting + # https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6345 + set(ENV{PKG_CONFIG_ALLOW_SYSTEM_LIBS} 1) + endif () + pkg_search_module(${name} + ${_required_arg} ${_quiet_arg} + IMPORTED_TARGET + ${ARGS_PKG_MODULE_SPECS}) + # Mark the package as found by pkg-config + if (${name}_FOUND) + set(${name}_PKGCONFIG True) + endif () + endif () + + # Sanitize local variables in order to not contaminate future calls + set(ARGS_Options) + set(ARGS_OneValue) + set(ARGS_MultiValue) + set(ARGS_UNPARSED_ARGUMENTS) + set(ARGS_NAMES) + set(ARGS_PKG_MODULE_NAMES) + set(ARGS_PKG_MODULE_SPECS) + set(_version_args) + set(_quiet_arg) + set(_comp_args) + set(_opt_comp_args) + set(_registry_view_arg) + set(_names_args) + set(_pkg_name) + list(POP_BACK CMAKE_MESSAGE_CONTEXT) +endmacro() From 9a0a3b2bcae9205899748f93c0b97fe3a89948c1 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 6 Nov 2023 16:57:15 +0100 Subject: [PATCH 14/21] Implement Findfmt Signed-off-by: Cristian Le --- CMakeLists.txt | 2 +- cmake/Findfmt.cmake | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 cmake/Findfmt.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 7000cc4..387e9c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,7 +76,7 @@ set(BUILD_SHARED_LIBS ${TEMPLATE_SHARED_LIBS}) FetchContent_Declare(fmt GIT_REPOSITORY https://github.com/fmtlib/fmt GIT_TAG master - FIND_PACKAGE_ARGS CONFIG + FIND_PACKAGE_ARGS MODULE ) FetchContent_MakeAvailable(fmt) diff --git a/cmake/Findfmt.cmake b/cmake/Findfmt.cmake new file mode 100644 index 0000000..b3e1811 --- /dev/null +++ b/cmake/Findfmt.cmake @@ -0,0 +1,25 @@ +#[===[.md +# Findfmt + +fmt compatibility module for Octopus + +This file is specifically tuned for Template usage to unify the api with upstream package. + +]===] + +list(APPEND CMAKE_MESSAGE_CONTEXT Findfmt) +include(Template_Helpers) +Template_FindPackage(${CMAKE_FIND_PACKAGE_NAME} + NAMES fmt + PKG_MODULE_NAMES fmt +) + +# Create appropriate aliases +if (${CMAKE_FIND_PACKAGE_NAME}_PKGCONFIG) + add_library(fmt::fmt ALIAS PkgConfig::${CMAKE_FIND_PACKAGE_NAME}) +endif () +set_package_properties(${CMAKE_FIND_PACKAGE_NAME} PROPERTIES + URL https://github.com/fmtlib/fmt + DESCRIPTION "A modern formatting library " +) +list(POP_BACK CMAKE_MESSAGE_CONTEXT) From af7766d9def1003a1f704c2abd7bc304dcdd2e8e Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 6 Nov 2023 17:13:27 +0100 Subject: [PATCH 15/21] Add test-suite helpers Signed-off-by: Cristian Le --- test/CMakeLists.txt | 68 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 33b3a1d..4029ab1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -53,6 +53,74 @@ include(Catch) add_executable(test-suite) target_link_libraries(test-suite PRIVATE Catch2::Catch2WithMain Template::Template) +function(Template_add_test test) + #[===[.md + # Template_add_test + + Internal helper for adding functional tests specific for the current template project + + ## Synopsis + ```cmake + Template_add_test( + [TEST_NAME ] + [TARGET ] + [LABELS ]) + ``` + + ## Options + + `` + Path to the CMake project to be executed relative to `${CMAKE_CURRENT_SOURCE_DIR}` + + `TEST_NAME` [Default: ``] + Name for the test to be used as the ctest name + + `LABELS` + Additional labels to be added + + ]===] + + list(APPEND CMAKE_MESSAGE_CONTEXT "Template_add_test") + + set(ARGS_Options) + set(ARGS_OneValue + TEST_NAME + ) + set(ARGS_MultiValue + LABELS + ) + cmake_parse_arguments(PARSE_ARGV 1 ARGS "${ARGS_Options}" "${ARGS_OneValue}" "${ARGS_MultiValue}") + # Check required/optional arguments + if (ARGC LESS 1) + message(FATAL_ERROR "Missing test name") + endif () + if (NOT DEFINED ARGS_TEST_NAME) + set(ARGS_TEST_NAME ${test}) + endif () + set(extra_args) + if (Template_IS_TOP_LEVEL) + list(APPEND extra_args + -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS + # Generated Config file point to binary targets until it is installed + -DTemplate_ROOT=${Template_BINARY_DIR} + -DFETCHCONTENT_SOURCE_DIR_TEMPLATE=${Template_SOURCE_DIR} + ) + endif () + + add_test(NAME ${ARGS_TEST_NAME} + COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test ${CMAKE_CURRENT_SOURCE_DIR}/${test} + ${CMAKE_CURRENT_BINARY_DIR}/${test} + # Use the same build environment as the current runner + --build-generator "${CMAKE_GENERATOR}" + --build-options -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + ${extra_args} + --test-command ${CMAKE_CTEST_COMMAND} --test-dir ${CMAKE_CURRENT_BINARY_DIR}/${test} --output-on-failure + ) + set_tests_properties(${ARGS_TEST_NAME} PROPERTIES + LABELS "${ARGS_LABELS}" + ) +endfunction() + add_subdirectory(unit) add_subdirectory(package) From 52f648bc5cbc95987642f60e348f430dd9ba0180 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Mon, 6 Nov 2023 17:15:57 +0100 Subject: [PATCH 16/21] Enable packaging tests Signed-off-by: Cristian Le --- test/package/CMakeLists.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/package/CMakeLists.txt b/test/package/CMakeLists.txt index e69de29..12dd044 100644 --- a/test/package/CMakeLists.txt +++ b/test/package/CMakeLists.txt @@ -0,0 +1,15 @@ +set_property(DIRECTORY APPEND + PROPERTY LABELS package +) + +set(test_list + FetchContent + find_package +) +if (NOT Template_IS_TOP_LEVEL) + list(APPEND test_list pkg-config) +endif () + +foreach (test IN LISTS test_list) + Template_add_test(${test} TEST_NAME test-${test}) +endforeach () From 75564914542a590a7f16739020b367e587208b63 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Tue, 7 Nov 2023 18:14:33 +0100 Subject: [PATCH 17/21] Add functional test Signed-off-by: Cristian Le --- test/CMakeLists.txt | 9 +++++++-- test/functional/CMakeLists.txt | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 test/functional/CMakeLists.txt diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4029ab1..43cf9b1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -121,7 +121,12 @@ function(Template_add_test test) ) endfunction() -add_subdirectory(unit) -add_subdirectory(package) +foreach (test_type IN ITEMS + unit + functional + package +) + add_subdirectory(${test_type}) +endforeach () catch_discover_tests(test-suite) diff --git a/test/functional/CMakeLists.txt b/test/functional/CMakeLists.txt new file mode 100644 index 0000000..424afdc --- /dev/null +++ b/test/functional/CMakeLists.txt @@ -0,0 +1,9 @@ +set_property(DIRECTORY APPEND + PROPERTY LABELS functional +) +add_test(NAME test-functional + COMMAND $ +) +set_tests_properties(test-functional PROPERTIES + PASS_REGULAR_EXPRESSION "^Hello, World!" +) From 76a3925d9be0d005515571b5fb1a23270c5ee766 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Tue, 7 Nov 2023 09:14:20 +0100 Subject: [PATCH 18/21] Add coverage option and codecov CI Signed-off-by: Cristian Le --- .github/workflows/step_test.yaml | 10 ++++++++++ cmake/CMakePresets-CI.json | 4 ++++ test/CMakeLists.txt | 13 +++++++++++++ 3 files changed, 27 insertions(+) diff --git a/.github/workflows/step_test.yaml b/.github/workflows/step_test.yaml index 6aa8743..8c7361b 100644 --- a/.github/workflows/step_test.yaml +++ b/.github/workflows/step_test.yaml @@ -38,6 +38,16 @@ jobs: uses: lukka/run-cmake@v10.3 with: workflowPreset: "${{ matrix.toolchain }}-ci" + - name: Get lcov data + run: | + lcov -c -d cmake-build-*/ -o coverage.info --include "$(pwd)/src/*" + # TODO: Disabled coverage on non-gcc toolchains. Not sure why it is broken + if: matrix.toolchain == 'gcc' + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + files: coverage.info + if: matrix.toolchain == 'gcc' pass: needs: [ tests ] runs-on: ubuntu-latest diff --git a/cmake/CMakePresets-CI.json b/cmake/CMakePresets-CI.json index 42fdfe4..7893c89 100644 --- a/cmake/CMakePresets-CI.json +++ b/cmake/CMakePresets-CI.json @@ -15,6 +15,10 @@ "TEMPLATE_TESTS": { "type": "BOOL", "value": true + }, + "TEMPLATE_TEST_COVERAGE": { + "type": "BOOL", + "value": true } }, "errors": { diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 43cf9b1..bfa7f6e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -15,12 +15,25 @@ set(CMAKE_CXX_EXTENSIONS ON) # Options # ]==============================================================================================] +include(CMakeDependentOption) +include(FeatureSummary) + +cmake_dependent_option(TEMPLATE_TEST_COVERAGE "Template: Test with coverage" OFF "TEMPLATE_TESTS;Template_IS_TOP_LEVEL" OFF) +add_feature_info(Coverage TEMPLATE_TEST_COVERAGE "Compile with test coverage") +mark_as_advanced(TEMPLATE_TEST_COVERAGE) + #[==============================================================================================[ # Project configuration # ]==============================================================================================] include(FetchContent) +if (TEMPLATE_TEST_COVERAGE) + target_compile_options(Template_Template PRIVATE --coverage) + target_compile_options(Template_Hello PRIVATE --coverage) + target_link_options(Template_Template PUBLIC --coverage) +endif () + #[==============================================================================================[ # External packages # ]==============================================================================================] From 61536a37283a3a8e152dd0e04c40246b7e8b9200 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Tue, 7 Nov 2023 00:16:43 +0100 Subject: [PATCH 19/21] Add static-analysis Signed-off-by: Cristian Le --- .github/workflows/ci.yaml | 8 ++++- .github/workflows/step_static-analysis.yaml | 37 +++++++++++++++++++++ sonar-project.properties | 5 +++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/step_static-analysis.yaml create mode 100644 sonar-project.properties diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3cf3677..7cdc63e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,8 +22,14 @@ jobs: needs: [ pre-commit ] uses: ./.github/workflows/step_test.yaml + static-analysis: + needs: [ pre-commit ] + uses: ./.github/workflows/step_static-analysis.yaml + secrets: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + pass: - needs: [ pre-commit, tests ] + needs: [ pre-commit, tests, static-analysis ] runs-on: ubuntu-latest steps: - name: Check all CI jobs diff --git a/.github/workflows/step_static-analysis.yaml b/.github/workflows/step_static-analysis.yaml new file mode 100644 index 0000000..1e138ab --- /dev/null +++ b/.github/workflows/step_static-analysis.yaml @@ -0,0 +1,37 @@ +name: static-analysis +on: + workflow_call: + secrets: + SONAR_TOKEN: + required: true +jobs: + sonar-cloud: + name: Analyze with SonarCloud + runs-on: ubuntu-latest + env: + BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed + steps: + - uses: actions/checkout@v4 + - name: Set up Python for gcovr + uses: actions/setup-python@v4 + with: + python-version: 3.x + - name: install gcovr + run: | + pip install gcovr + - name: Install sonar-scanner and build-wrapper + uses: SonarSource/sonarcloud-github-c-cpp@v2 + - name: Run cmake/ctest with sonar build-wrapper + run: | + cmake --preset gcc-ci --fresh -G "Unix Makefiles" + build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build --preset gcc-ci + ctest --preset gcc-ci + gcovr --sonarqube > coverage.xml + - name: Run sonar-scanner + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + sonar-scanner \ + --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \ + --define sonar.coverageReportPaths=coverage.xml diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..e169f34 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,5 @@ +sonar.projectKey=LecrisUT_CMake-Template +sonar.organization=lecris + +sonar.projectName="CMake Template" +sonar.coverage.exclusions=test/** From dd1d383e960fe67f89ceb6c8cd6c773e5606fde3 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Tue, 7 Nov 2023 18:17:51 +0100 Subject: [PATCH 20/21] Mark windows toolchain as experimental Signed-off-by: Cristian Le --- .github/workflows/step_test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/step_test.yaml b/.github/workflows/step_test.yaml index 8c7361b..d20a9ae 100644 --- a/.github/workflows/step_test.yaml +++ b/.github/workflows/step_test.yaml @@ -20,6 +20,7 @@ jobs: include: - os: windows-latest toolchain: windows + experimental: true - os: macos-latest toolchain: macos steps: From cee25b2ea6541d3aa57da916b05273f5079bc30e Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Tue, 7 Nov 2023 20:10:47 +0100 Subject: [PATCH 21/21] Drop Fedora-37 and EPEL9 Catch2 version is not compatible and backporting FetchContent(FIND_PACKAGE_ARGS) from CMake 3.24 is a hustle with nested projects Signed-off-by: Cristian Le --- .packit.yaml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.packit.yaml b/.packit.yaml index a59e852..6da6a79 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -32,17 +32,17 @@ jobs: owner: lecris project: cmake-template targets: - - fedora-all-x86_64 - - fedora-all-aarch64 - - epel-9-x86_64 - - epel-9-aarch64 + - fedora-38-x86_64 + - fedora-38-aarch64 + - fedora-development-x86_64 + - fedora-development-aarch64 - job: tests trigger: pull_request targets: - - fedora-all-x86_64 - - fedora-all-aarch64 - - epel-9-x86_64 - - epel-9-aarch64 + - fedora-38-x86_64 + - fedora-38-aarch64 + - fedora-development-x86_64 + - fedora-development-aarch64 fmf_path: .distro - job: copr_build trigger: commit @@ -50,18 +50,18 @@ jobs: owner: lecris project: nightly targets: - - fedora-all-x86_64 - - fedora-all-aarch64 - - epel-9-x86_64 - - epel-9-aarch64 + - fedora-38-x86_64 + - fedora-38-aarch64 + - fedora-development-x86_64 + - fedora-development-aarch64 - job: tests trigger: commit branch: main targets: - - fedora-all-x86_64 - - fedora-all-aarch64 - - epel-9-x86_64 - - epel-9-aarch64 + - fedora-38-x86_64 + - fedora-38-aarch64 + - fedora-development-x86_64 + - fedora-development-aarch64 fmf_path: .distro ## Uncomment when released downstream # - job: propose_downstream