[enter image description here][1]I am doing a project at uni and the professor is asking us to integrate github actions to automatically run the tests on our c++ tests we wrote (I did it on catch2). I have setup the github actions but when i do a push the actions does not read the .in files. T
name: CMake on a single platform
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
BUILD_TYPE: Release
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y build-essential cmake
- name: Configure CMake
run: |
cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-DMatrix_INCLUDE_DIR=${{ github.workspace }}/src
cmake --build build --config ${{env.BUILD_TYPE}}
- name: Prepare test files
run: |
mkdir -p build/Test/catch_test_1_1
cp -r Test/tests/catch_test_1_1/* build/Test/catch_test_1_1/
ls -l build/Test/catch_test_1_1 # Optional: check copied files
- name: Run tests
run: build/Test/CS2013_PROYECTO_RED_NEURONAL_TEST
This is a screenshot of my working directory:
and the cmakelist for the Test directory is this:
cmake_minimum_required(VERSION 3.10.2)
project(CS2013_PROYECTO_RED_NEURONAL_TEST)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_DEBUG})
if(UNIX AND NOT APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
endif()
if(MINGW OR CYGWIN)
add_definitions(-O3)
endif()
# Work Folders
include_directories(.)
include_directories(tests)
include_directories(../tools/catch)
# Project files
file(GLOB project_files
tests/catch_test_*/*.cpp
tests/*.h
tests/*.cpp
../src/*.h
)
add_executable(${PROJECT_NAME}
${project_files}
)
if(UNIX AND NOT APPLE)
find_package(TBB QUIET)
if(TBB_FOUND)
target_link_libraries(${PROJECT_NAME} TBB::tbb)
endif()
endif()
# Test files
file(GLOB test_files
tests/catch_test_*/*.in
tests/catch_test_*/*.txt
)
foreach(full_test_file_name ${test_files})
configure_file(${full_test_file_name} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COPYONLY)
endforeach(full_test_file_name)```
[1]: https://i.sstatic.net/2QtqmdM6.png
New contributor
m41k12 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.