Skip to content

Commit

Permalink
execute unit tests through conan
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Basler committed Jun 2, 2024
1 parent 01ee12a commit c85eaf7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
14 changes: 3 additions & 11 deletions .github/workflows/windows_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,9 @@ jobs:

- run: conan profile detect

- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores

- run: conan install . --options enable_tests=True --build=missing
- run: cmake --list-presets
- run: cmake --preset conan-default
- run: cmake --build --list-presets
- run: cmake --build --preset conan-default -j${{ steps.cpu-cores.outputs.count }}
- run: ctest --list-presets
- run: ctest --preset conan-default --output-on-failure

- run: conan create . --options enable_tests=True --build=missing




Expand Down
9 changes: 9 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout
from conan.tools.files import load
from conan.tools.env import Environment

from conan.tools.scm import Git

Expand Down Expand Up @@ -95,6 +96,14 @@ def build(self):
cmake.configure()
cmake.build()

environment = Environment()
environment.define("CTEST_OUTPUT_ON_FAILURE","1")
envvars = environment.vars(self)

if self.options.enable_tests:
with envvars.apply():
cmake.test()

def package(self):
cmake = CMake(self)
cmake.install()
Expand Down

0 comments on commit c85eaf7

Please sign in to comment.