Skip to content

Commit

Permalink
Enable integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jfalcou authored Aug 15, 2023
1 parent fa96d7e commit ee3afe5
Show file tree
Hide file tree
Showing 11 changed files with 1,257 additions and 10 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
##======================================================================================================================
## RABERU - Fancy Parameters Library
## Copyright : RABERU Contributors & Maintainers
## SPDX-License-Identifier: BSL-1.0
##======================================================================================================================
name: RABERU Integration Tests
on:
pull_request:
branches:
- main

concurrency:
group: raberu-integration-${{ github.ref }}
cancel-in-progress: true

jobs:

install:
runs-on: [ubuntu-latest]
container:
image: ghcr.io/jfalcou/compilers:v6
strategy:
fail-fast: false

steps:
- name: Fetch current branch
uses: actions/checkout@v3
- name: Install RABERU from checkout
run: |
mkdir build && cd build
cmake -G Ninja .. -DRABERU_BUILD_TEST=OFF -DCMAKE_CXX_COMPILER=clang++
ninja install
- name: Run Sample CMake
run: |
mkdir install && cd install
cmake ../test/integration/install-test -G Ninja
ninja && ctest --verbose
fetch-content:
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
runs-on: [ubuntu-latest]
container:
image: ghcr.io/jfalcou/compilers:v6
strategy:
fail-fast: false

steps:
- name: Fetch current branch
uses: actions/checkout@v3
- name: Compile using FetchContent
run: |
git config --global --add safe.directory /__w/raberu/raberu
mkdir install && cd install
cmake ../test/integration/fetch-test -G Ninja -DGIT_BRANCH=${BRANCH_NAME} -DRABERU_BUILD_TEST=OFF -DCMAKE_CXX_COMPILER=clang++
ninja && ctest --verbose
cpm:
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
runs-on: [ubuntu-latest]
container:
image: ghcr.io/jfalcou/compilers:v6
strategy:
fail-fast: false

steps:
- name: Fetch current branch
uses: actions/checkout@v3
- name: Compile using CPM
run: |
git config --global --add safe.directory /__w/raberu/raberu
mkdir install && cd install
cmake ../test/integration/cpm-test -G Ninja -DGIT_BRANCH=${BRANCH_NAME} -DCMAKE_CXX_COMPILER=clang++ -DRABERU_BUILD_TEST=OFF
ninja && ctest --verbose
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
##======================================================================================================================
cmake_minimum_required(VERSION 3.22)
project(raberu LANGUAGES CXX)
include(${PROJECT_SOURCE_DIR}/cmake/dependencies.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/compiler.cmake)

##======================================================================================================================
option( RABERU_BUILD_TEST "Build tests for Raberu" ON )
option( RABERU_BUILD_DOCUMENTATION "Build Doxygen for Raberu" OFF )

##======================================================================================================================
include(${PROJECT_SOURCE_DIR}/cmake/dependencies.cmake)

if(RABERU_BUILD_TEST)
include(${PROJECT_SOURCE_DIR}/cmake/compiler.cmake)
endif()

##======================================================================================================================
## Project setup via copacabana
##======================================================================================================================
Expand Down Expand Up @@ -39,7 +44,7 @@ endif()
copa_setup_install( LIBRARY raberu
FEATURES cxx_std_20
DOC ${PROJECT_SOURCE_DIR}/LICENSE.md
INCLUDE ${PROJECT_SOURCE_DIR}/include/tts
INCLUDE ${PROJECT_SOURCE_DIR}/include/raberu
)

##======================================================================================================================
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ auto replicate( P0 p0, P1 p1 )

int main()
{
using namespace rbr::literals;

std::cout << replicate("replication"_kw = 9, "letter"_kw = 'z' ) << "\n";
std::cout << replicate("letter"_kw = '!' , "replication"_kw = 3) << "\n";
}
Expand Down
14 changes: 8 additions & 6 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ include(${CPM_DOWNLOAD_LOCATION})
##======================================================================================================================
CPMAddPackage(NAME COPACABANA GITHUB_REPOSITORY jfalcou/copacabana GIT_TAG main)

CPMAddPackage ( NAME TTS GITHUB_REPOSITORY jfalcou/tts
GIT_TAG main
OPTIONS "TTS_BUILD_TEST OFF"
"TTS_BUILD_DOCUMENTATION OFF"
"TTS_QUIET ON"
)
if(RABERU_BUILD_TEST)
CPMAddPackage ( NAME TTS GITHUB_REPOSITORY jfalcou/tts
GIT_TAG main
OPTIONS "TTS_BUILD_TEST OFF"
"TTS_BUILD_DOCUMENTATION OFF"
"TTS_QUIET ON"
)
endif()
2 changes: 1 addition & 1 deletion doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ EXPAND_ONLY_PREDEF = YES
SEARCH_INCLUDES = YES
INCLUDE_PATH = ../include
INCLUDE_FILE_PATTERNS =
PREDEFINED = TTS_DOXYGEN_INVOKED
PREDEFINED = RABERU_DOXYGEN_INVOKED
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
DIA_PATH =
Expand Down
25 changes: 25 additions & 0 deletions test/integration/cpm-test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
##======================================================================================================================
## RABERU - Fancy Named Parameter Library
## Copyright : RABERU Project Contributors
## SPDX-License-Identifier: BSL-1.0
##======================================================================================================================
cmake_minimum_required(VERSION 3.18)
project(raberu-cpm-test LANGUAGES CXX)
enable_testing()

message(STATUS "Testing CPM for branch ${GIT_BRANCH}")

# Setup CPM
include(cpm.cmake)

# Add dependencies
CPMAddPackage ( NAME raberu
GIT_REPOSITORY "https://github.com/jfalcou/raberu.git"
GIT_TAG "${GIT_BRANCH}"
OPTIONS "RABERU_BUILD_TEST OFF"
)

# Use RABERU
add_executable(test_raberu ../main.cpp)
target_link_libraries(test_raberu PUBLIC raberu::raberu)
add_test(NAME test_raberu COMMAND test_raberu)
Loading

0 comments on commit ee3afe5

Please sign in to comment.