diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 718d1dd7a1..1ad6b6f1f5 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -24,14 +24,14 @@ jobs: name: "Ubuntu Latest GCC", artifact: "Linux.tar.gz", os: ubuntu-latest, cc: "gcc", cxx: "g++", - cmake_flags: "-G Ninja", + cmake_flags: "-G Ninja -DENABLE_TESTING=ON ", cpack: "", } - { name: "macOS Latest Clang", artifact: "macOS.dmg", os: macos-latest, cc: "clang", cxx: "clang++", - cmake_flags: "-G Ninja", + cmake_flags: "-G Ninja -DENABLE_TESTING=ON ", cpack_flags: "-G DragNDrop", } - { @@ -73,7 +73,6 @@ jobs: with: path: avogadrolibs - # this never seems to hit.. - name: Cache Qt id: cache-qt uses: actions/cache@v1 @@ -87,29 +86,6 @@ jobs: cached: ${{ steps.cache-qt.outputs.cache-hit }} version: ${{ env.QT_VERSION }} - - name: Download ccache - id: ccache - shell: cmake -P {0} - run: | - set(ccache_url "https://github.com/cristianadam/ccache/releases/download/v$ENV{CCACHE_VERSION}/${{ runner.os }}.tar.xz") - file(DOWNLOAD "${ccache_url}" ./ccache.tar.xz SHOW_PROGRESS) - execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ccache.tar.xz) - - - name: Prepare ccache timestamp - id: ccache_cache_timestamp - shell: cmake -P {0} - run: | - string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) - message("::set-output name=timestamp::${current_date}") - - - name: Restore cache files - uses: actions/cache@v1 - with: - path: .ccache - key: ${{ matrix.config.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} - restore-keys: | - ${{ matrix.config.name }}-ccache- - - name: Configure MSVC Command Prompt if: runner.os == 'Windows' uses: ilammy/msvc-dev-cmd@v1 @@ -120,14 +96,31 @@ jobs: run: | mkdir "${{ runner.workspace }}/build" cd "${{ runner.workspace }}/build" - CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{matrix.config.cmake_flags}} + CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ${{matrix.config.cmake_flags}} shell: bash - name: Build - run: CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake --build . --config ${{env.BUILD_TYPE}} + run: | + CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake --build . --config ${{env.BUILD_TYPE}} shell: bash working-directory: ${{ runner.workspace }}/build + - name: Run tests + if: runner.os != 'Windows' + shell: cmake -P {0} + run: | + include(ProcessorCount) + ProcessorCount(N) + set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON") + execute_process( + COMMAND ctest -j ${N} + WORKING_DIRECTORY ${{ runner.workspace }}/build + RESULT_VARIABLE result + ) + if (NOT result EQUAL 0) + message(FATAL_ERROR "Running tests failed!") + endif() + - name: Pack if: matrix.config.artifact != 0 run: cpack ${{ matrix.config.cpack_flags }}