diff --git a/.github/workflows/windows_unit_tests.yml b/.github/workflows/windows_unit_tests.yml index 9097c426..0685fb97 100644 --- a/.github/workflows/windows_unit_tests.yml +++ b/.github/workflows/windows_unit_tests.yml @@ -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 + diff --git a/conanfile.py b/conanfile.py index e8a61751..5d3c8e19 100644 --- a/conanfile.py +++ b/conanfile.py @@ -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 @@ -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()