-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inspired from @justend29 work on EVE
- Loading branch information
Showing
14 changed files
with
1,422 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Container image that runs your code | ||
FROM jfalcou/compilers:v6 | ||
|
||
# Copies your code file from your action repository to the filesystem path `/` of the container | ||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
# Code file to execute when the docker container starts up (`entrypoint.sh`) | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# action.yml | ||
name: "Checks installation process" | ||
description: "Checks installation process" | ||
inputs: | ||
branch: # Current branch | ||
description: "Current branch" | ||
required: false | ||
default: "main" | ||
mode: # Mode | ||
description: "Current test" | ||
required: false | ||
default: 0 | ||
runs: | ||
using: "docker" | ||
image: "Dockerfile" | ||
args: | ||
- ${{ inputs.branch }} | ||
- ${{ inputs.mode }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/sh -l | ||
set -e | ||
|
||
# Setup github/worspace as safe | ||
git config --global --add safe.directory /github/workspace | ||
|
||
# ID for various tests | ||
INSTALL_TEST=0 | ||
FETCH_TEST=1 | ||
CPM_TEST=2 | ||
|
||
configure_and_ctest() { | ||
test_regex=$1 | ||
|
||
cmake -B build -S . -G Ninja \ | ||
-DKUMI_BUILD_INTEGRATION=ON \ | ||
-DKUMI_BUILD_TEST=OFF \ | ||
-DKUMI_BUILD_DOCUMENTATION=OFF | ||
|
||
# kumi build not required: cmake --build build | ||
ctest --test-dir build --output-on-failure -R $test_regex | ||
} | ||
|
||
if [ $2 -eq $INSTALL_TEST ]; then | ||
echo "::group::Prepare KUMI repository for branch " $1 | ||
configure_and_ctest integration.install-kumi.exe | ||
echo "::endgroup::" | ||
|
||
echo "::group::Test KUMI via the install target" | ||
ctest --test-dir build --output-on-failure -R integration.install.exe | ||
echo "::endgroup::" | ||
fi | ||
|
||
if [ $2 -eq $FETCH_TEST ]; then | ||
echo "::group::Test KUMI via FetchContent" | ||
configure_and_ctest integration.fetch.exe | ||
echo "::endgroup::" | ||
fi | ||
|
||
if [ $2 -eq $CPM_TEST ]; then | ||
echo "::group::Test KUMI via CPM" | ||
configure_and_ctest integration.cpm.exe | ||
echo "::endgroup::" | ||
fi | ||
|
||
return 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
##================================================================================================== | ||
## KUMI - Compact C++20 Tuple Toolbox | ||
## Copyright : KUMI Project Contributors | ||
## SPDX-License-Identifier: BSL-1.0 | ||
##================================================================================================== | ||
|
||
##================================================================================================== | ||
## Reuse install.cmake to preapre package properly | ||
##================================================================================================== | ||
include("${CMAKE_CURRENT_LIST_DIR}/kumi-targets.cmake") | ||
set(KUMI_LIBRARIES kumi::kumi) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
##================================================================================================== | ||
## KUMI - Compact C++20 Tuple Toolbox | ||
## Copyright : KUMI Project Contributors | ||
## SPDX-License-Identifier: BSL-1.0 | ||
##================================================================================================== | ||
include(GNUInstallDirs) | ||
set(MAIN_DEST "${CMAKE_INSTALL_LIBDIR}/kumi-${PROJECT_VERSION}") | ||
set(INSTALL_DEST "${CMAKE_INSTALL_INCLUDEDIR}/kumi-${PROJECT_VERSION}") | ||
set(DOC_DEST "${CMAKE_INSTALL_DOCDIR}-${PROJECT_VERSION}") | ||
|
||
## ================================================================================================= | ||
## Exporting target for external use | ||
## ================================================================================================= | ||
add_library(kumi_lib INTERFACE) | ||
target_include_directories( kumi_lib INTERFACE | ||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:${INSTALL_DEST}> | ||
) | ||
target_compile_features(kumi_lib INTERFACE cxx_std_20) | ||
set_target_properties(kumi_lib PROPERTIES EXPORT_NAME kumi) | ||
add_library(kumi::kumi ALIAS kumi_lib) | ||
|
||
## ================================================================================================= | ||
## Install target with versioned folder | ||
## ================================================================================================= | ||
install(TARGETS kumi_lib EXPORT kumi-targets DESTINATION "${MAIN_DEST}") | ||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/kumi DESTINATION "${INSTALL_DEST}" ) | ||
install(FILES ${PROJECT_SOURCE_DIR}/cmake/kumi-config.cmake DESTINATION "${MAIN_DEST}" ) | ||
install(FILES ${PROJECT_SOURCE_DIR}/LICENSE.md DESTINATION "${DOC_DEST}" ) | ||
install(EXPORT kumi-targets NAMESPACE "kumi::" DESTINATION "${MAIN_DEST}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
##================================================================================================== | ||
## KUMI - Compact C++20 Tuple Toolbox | ||
## Copyright : KUMI Project Contributors | ||
## SPDX-License-Identifier: BSL-1.0 | ||
##================================================================================================== | ||
|
||
# Extract HEAD from git | ||
find_package(Git REQUIRED) | ||
execute_process( | ||
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD | ||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" | ||
OUTPUT_VARIABLE kumi_git_head | ||
RESULT_VARIABLE _git_error | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
|
||
if(NOT _git_error STREQUAL "0") | ||
message(SEND_ERROR | ||
"Failed to extract KUMI's current git commit for integration tests: ${_git_error}") | ||
return() | ||
endif() | ||
|
||
|
||
# Builds and tests a separate project as an KUMI test | ||
function(kumi_build_and_ctest project_name) | ||
string(REPLACE "-test" "" test_name "integration.${project_name}.exe") | ||
|
||
add_test( | ||
NAME ${test_name} | ||
COMMAND | ||
"${CMAKE_CTEST_COMMAND}" | ||
--verbose | ||
--output-on-failure | ||
--build-generator "${CMAKE_GENERATOR}" | ||
--build-and-test | ||
"${CMAKE_CURRENT_SOURCE_DIR}/${project_name}" | ||
"${CMAKE_CURRENT_BINARY_DIR}/${project_name}" | ||
--build-options ${ARGN} | ||
--test-command "${CMAKE_CTEST_COMMAND}") | ||
endfunction() | ||
|
||
|
||
##================================================================================================== | ||
## Create Integration Tests | ||
##================================================================================================== | ||
|
||
## ===== CPM ===== | ||
kumi_build_and_ctest(cpm-test | ||
"-Dkumi_git_head=${kumi_git_head}" | ||
"-Dkumi_SOURCE_DIR=${kumi_SOURCE_DIR}" | ||
# cpm-test internally sets KUMI_* configure options | ||
) | ||
|
||
## ===== Fetch ===== | ||
kumi_build_and_ctest(fetch-test | ||
"-Dkumi_git_head=${kumi_git_head}" | ||
"-Dkumi_SOURCE_DIR=${kumi_SOURCE_DIR}" | ||
"-DKUMI_BUILD_TEST=OFF" | ||
"-DKUMI_BUILD_DOCUMENTATION=OFF" | ||
) | ||
|
||
## ===== Install ===== | ||
# install kumi as its own test and for 'install-test' to find | ||
set(kumi_ROOT "${PROJECT_BINARY_DIR}/test/integration/install") | ||
add_test( | ||
NAME integration.install-kumi.exe | ||
COMMAND | ||
"${CMAKE_COMMAND}" | ||
--install "${PROJECT_BINARY_DIR}" | ||
--verbose | ||
--prefix "${kumi_ROOT}") | ||
|
||
kumi_build_and_ctest(install-test "-Dkumi_ROOT=${kumi_ROOT}") | ||
set_tests_properties(integration.install.exe PROPERTIES DEPENDS integration.install-kumi.exe) | ||
|
||
## ==== Aggregated ==== | ||
add_custom_target(integration | ||
COMMAND | ||
"${CMAKE_CTEST_COMMAND}" | ||
--test-dir "${PROJECT_BINARY_DIR}" | ||
--output-on-failure | ||
-R integration\.[a-z-]+\.exe) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
##================================================================================================== | ||
## KUMI - Compact C++20 Tuple Toolbox | ||
## Copyright : KUMI Project Contributors | ||
## SPDX-License-Identifier: BSL-1.0 | ||
##================================================================================================== | ||
cmake_minimum_required(VERSION 3.18) | ||
project(kumi-cpm-test LANGUAGES CXX) | ||
enable_testing() | ||
|
||
message(STATUS "Testing CPM for commit ${kumi_git_head}") | ||
|
||
# Setup CPM | ||
include(cpm.cmake) | ||
|
||
# Add dependencies | ||
CPMAddPackage ( NAME kumi | ||
GIT_REPOSITORY "${kumi_SOURCE_DIR}" | ||
GIT_TAG "${kumi_git_head}" | ||
OPTIONS "KUMI_BUILD_INTEGRATION=OFF" | ||
"KUMI_BUILD_TEST=OFF" | ||
"KUMI_BUILD_DOCUMENTATION=OFF" | ||
) | ||
|
||
# Use KUMI | ||
add_executable(test_kumi ../main.cpp) | ||
target_link_libraries(test_kumi PUBLIC kumi::kumi) | ||
add_test(NAME test_kumi COMMAND test_kumi) |
Oops, something went wrong.