Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile and run the engine tests on the CI #899

Merged
merged 3 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/build-engine-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
ccache-

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_CORE_SAMPLES=ON -DBUILD_CORE_TESTS=ON -DBUILD_ENGINE_SAMPLES=ON -DUSE_CLANG_TIDY=OFF
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_CORE_SAMPLES=ON -DBUILD_CORE_TESTS=ON -DBUILD_ENGINE_TESTS=ON -DBUILD_ENGINE_SAMPLES=ON -DUSE_CLANG_TIDY=OFF
shell: bash
env:
CC: gcc-11
Expand All @@ -62,7 +62,10 @@ jobs:
run: |
ccache -s # Print current cache stats

- name: Test
- name: Test Core
working-directory: ${{github.workspace}}/build/core/tests
run: ./cubos-core-tests

- name: Test Engine
working-directory: ${{github.workspace}}/build/engine/tests
run: ./cubos-engine-tests
9 changes: 6 additions & 3 deletions .github/workflows/build-engine-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
ccache-

- name: Configure CMake
run: CC=$(brew --prefix llvm@14)/bin/clang CXX=$(brew --prefix llvm@14)/bin/clang++ cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DGLFW_USE_SUBMODULE=OFF -DBUILD_CORE_SAMPLES=ON -DBUILD_CORE_TESTS=ON -DBUILD_ENGINE_SAMPLES=ON -DUSE_CLANG_TIDY=OFF
run: CC=$(brew --prefix llvm@14)/bin/clang CXX=$(brew --prefix llvm@14)/bin/clang++ cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DGLFW_USE_SUBMODULE=OFF -DBUILD_CORE_SAMPLES=ON -DBUILD_CORE_TESTS=ON -DBUILD_ENGINE_TESTS=ON -DBUILD_ENGINE_SAMPLES=ON -DUSE_CLANG_TIDY=OFF
shell: bash

- name: CCache Prolog
Expand All @@ -59,7 +59,10 @@ jobs:
run: |
ccache -s # Print current cache stats

- name: Test
- name: Test Core
working-directory: ${{github.workspace}}/build/core/tests
run: ./cubos-core-tests


- name: Test Engine
working-directory: ${{github.workspace}}/build/engine/tests
run: ./cubos-engine-tests
6 changes: 4 additions & 2 deletions .github/workflows/build-engine-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
run: cmake -E make_directory ${{github.workspace}}\build

- name: Configure CMake
run: cmake -B ${{github.workspace}}\build -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_CORE_SAMPLES=ON -DBUILD_CORE_TESTS=ON -DBUILD_ENGINE_SAMPLES=ON -DUSE_CLANG_TIDY=OFF -DCCACHE_VERSION="${{env.CCACHE_VERSION}}"
run: cmake -B ${{github.workspace}}\build -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_CORE_SAMPLES=ON -DBUILD_CORE_TESTS=ON -DBUILD_ENGINE_TESTS=ON -DBUILD_ENGINE_SAMPLES=ON -DUSE_CLANG_TIDY=OFF -DCCACHE_VERSION="${{env.CCACHE_VERSION}}"

- name: CCache Prolog
run: |-
Expand All @@ -62,6 +62,8 @@ jobs:
run: |
ccache -s # Print current cache stats

- name: Test
- name: Test Core
run: ${{github.workspace}}\build\core\tests\Release\cubos-core-tests.exe

- name: Test Engine
run: ${{github.workspace}}\build\engine\tests\Release\cubos-engine-tests.exe
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
path = core/lib/stduuid
url = https://github.com/mariusbancila/stduuid.git
[submodule "core/lib/doctest"]
path = core/lib/doctest
path = lib/doctest
url = https://github.com/doctest/doctest
[submodule "docs/css/m.css"]
path = docs/css
Expand Down
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")

set(CMAKE_CXX_STANDARD 20)

# Should clang-tidy errors be automatically fixed?
option(FIX_CLANG_TIDY_ERRORS "Automatically fix clang-tidy errors" OFF)
option(DOCTEST_USE_SUBMODULE "Compile doctest from source?" ON)

# Enable coverage reports
option(ENABLE_COVERAGE "Generate coverage report" OFF)
Expand Down Expand Up @@ -99,6 +99,14 @@ function(cubos_common_target_options target)
endif()
endfunction()

# Add doctest as a submodule if it is not installed

if (DOCTEST_USE_SUBMODULE)
add_subdirectory(lib/doctest)
else ()
find_package(doctest REQUIRED)
endif ()

add_subdirectory(core)
add_subdirectory(tools)
add_subdirectory(engine)
Expand Down
7 changes: 0 additions & 7 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ if (WITH_GLFW)
endif ()
option(WITH_OPENAL "With OpenAL?" ON)
option(GLM_USE_SUBMODULE "Compile GLM from source?" ON)
option(DOCTEST_USE_SUBMODULE "Compile doctest from source?" ON)

set(CUBOS_CORE_ECS_MAX_COMPONENTS "63" CACHE STRING "The maximum number of components registered in an ECS world.")
set(CUBOS_CORE_DISPATCHER_MAX_CONDITIONS "64" CACHE STRING "The maximum number of conditions available for the dispatcher.")
Expand Down Expand Up @@ -169,12 +168,6 @@ else ()
find_package(glm REQUIRED)
endif ()

if (DOCTEST_USE_SUBMODULE)
add_subdirectory(lib/doctest)
else ()
find_package(doctest REQUIRED)
endif ()

set(JSON_BuildTests OFF CACHE INTERNAL "")
add_subdirectory(lib/json)

Expand Down
4 changes: 1 addition & 3 deletions engine/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
add_executable(
cubos-engine-tests
main.cpp

collisions/aabb.cpp
)

target_link_libraries(cubos-engine-tests cubos-engine doctest::doctest)
cubos_common_target_options(cubos-engine-tests)

add_test(NAME cubos-engine-tests COMMAND cubos-engine-tests)
add_test(NAME cubos-engine-tests COMMAND cubos-engine-tests)
47 changes: 0 additions & 47 deletions engine/tests/collisions/aabb.cpp

This file was deleted.

Loading