diff --git a/lint/.clang-tidy b/.clang-tidy similarity index 100% rename from lint/.clang-tidy rename to .clang-tidy diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c176716..2571f0e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,8 +11,7 @@ jobs: - uses: actions/checkout@v4 - name: Lint - run: | - clang-tidy-15 lint/lint.cpp --export-fixes=clang-fixes.yaml --header-filter=io1/* -- -Iinclude -std=c++20 + run: clang-tidy-15 include/io1/money.hpp --export-fixes=clang-fixes.yaml -- -std=c++20 - name: Process clang-tidy warnings uses: asarium/clang-tidy-action@v1 diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 0f8e9c9..c299a74 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -62,4 +62,31 @@ jobs: - name: Publish test report uses: mikepenz/action-junit-report@v3 with: - report_paths: 'build/junit_*.xml' \ No newline at end of file + report_paths: 'build/test/junit_*.xml' + + - name: Install + run: cmake --install build --prefix install --config ${{ matrix.config }} + + - name: Configure with install + shell: cmake -P {0} + run: | + if ("${{ matrix.compiler }}" STREQUAL "gcc") + set(ENV{CC} "gcc-13") + set(ENV{CXX} "g++-13") + else() + set(ENV{CC} "clang-15") + set(ENV{CXX} "clang++-15") + endif() + execute_process( + COMMAND cmake + -S test + -B install_build + -D CMAKE_BUILD_TYPE=${{ matrix.config }} + -D "io1-money_DIR=../install/share/io1-money/cmake" + RESULT_VARIABLE result + ) + if (NOT result EQUAL 0) + message(FATAL_ERROR "Bad exit status") + endif() + - name: Build with install + run: cmake --build install_build --config ${{ matrix.config }} --parallel diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a89360..21a7b43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,16 +39,16 @@ write_basic_package_version_file( configure_package_config_file( "${PROJECT_SOURCE_DIR}/cmake/config.cmake.in" "${PROJECT_NAME}Config.cmake" - INSTALL_DESTINATION ${CMAKE_INSTALL_DATADIR}/io1/cmake) + INSTALL_DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake) install( EXPORT ${PROJECT_NAME} NAMESPACE io1:: - DESTINATION ${CMAKE_INSTALL_DATADIR}/io1/cmake) + DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake) install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" - DESTINATION ${CMAKE_INSTALL_DATADIR}/io1/cmake) + DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake) if(IO1_WITH_TESTS) include(CTest) diff --git a/lint/lint.cpp b/lint/lint.cpp deleted file mode 100644 index fb9f0ab..0000000 --- a/lint/lint.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "io1/money.hpp" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..bdbe76a --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.25) + +project(test_io1-money_install LANGUAGES CXX) + +find_package(io1-money REQUIRED) + +add_library(${PROJECT_NAME} test_install.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE io1::money) diff --git a/test/test_install.cpp b/test/test_install.cpp new file mode 100644 index 0000000..92492eb --- /dev/null +++ b/test/test_install.cpp @@ -0,0 +1,6 @@ +#include "io1/money.hpp" + +io1::money add_twice(io1::money const & lhs, io1::money const & rhs) noexcept +{ + return lhs + 2 * rhs; +}