From c3e4b6c7287ff8ca0db4b6e61e88001f62595792 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Tue, 14 Jan 2020 11:37:18 +0100 Subject: CMake Build: Enable tests on GitHub actions builds They take 1 to 2 minutes of execution. The success rate is from 97 to 99%, so I haven't made the tests step blocking. Change-Id: I39925cf6703904e15ba1c0c313aaf1daca382424 Reviewed-by: Alessandro Portale --- .github/workflows/build_cmake.yml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index ed1f5c73ff..1f2f3c7966 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -9,6 +9,7 @@ env: NINJA_VERSION: 1.9.0 BUILD_TYPE: Release CCACHE_VERSION: 3.7.7 + GOOGLETEST_VERSION: 1.10.0 jobs: build: @@ -217,6 +218,16 @@ jobs: ) endif() + - name: Download Googletest + id: googletest + shell: cmake -P {0} + run: | + # Googletest should be a submodule + file(DOWNLOAD "https://github.com/google/googletest/archive/release-$ENV{GOOGLETEST_VERSION}.tar.gz" ./googletest.tar.gz SHOW_PROGRESS) + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf googletest.tar.gz) + file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/googletest-release-$ENV{GOOGLETEST_VERSION}" googletest_dir) + message("::set-output name=googletest_dir::${googletest_dir}") + - name: Configure shell: cmake -P {0} run: | @@ -242,6 +253,8 @@ jobs: endif() set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}") + set(ENV{GOOGLETEST_DIR} "${{ steps.googletest.outputs.googletest_dir }}") + # Workaround for https://gitlab.kitware.com/cmake/cmake/issues/20119 foreach(step 1 2) execute_process( @@ -256,6 +269,7 @@ jobs: -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache -D BUILD_WITH_PCH=OFF + -D WITH_TESTS=ON RESULT_VARIABLE result ) if (NOT result EQUAL 0) @@ -314,14 +328,18 @@ jobs: include(ProcessorCount) ProcessorCount(N) + set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON") + execute_process( COMMAND ${{ steps.cmake_and_ninja.outputs.cmake_dir }}/ctest -j ${N} WORKING_DIRECTORY build RESULT_VARIABLE result ) - if (NOT result EQUAL 0) - message(FATAL_ERROR "Running tests failed!") - endif() + + # Do not fail on ctest failure + #if (NOT result EQUAL 0) + # message(FATAL_ERROR "Running tests failed!") + #endif() - name: Install Strip -- cgit v1.2.3