Removed IMPORTED_LOCATION_NOCONFIG /libcnr_yaml #52
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'PLAIN CMake CI' | |
on: | |
push: | |
branches: [ master, back_compatibility ] | |
paths-ignore: | |
- 'docs/**' | |
- 'README.md' | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Ubuntu Debug", artifact: "Linux.tar.xz", | |
os: ubuntu-22.04, | |
build_type: "Debug", cc: "gcc", cxx: "g++", cmake_version_used: "3.16.2" | |
} | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install dependencies | |
if: ${{ runner.os == 'Linux' }} | |
run: sudo apt-get update && | |
sudo apt-get install -y --fix-missing libeigen3-dev libyaml-cpp-dev | |
libboost-iostreams-dev libboost-date-time-dev libboost-filesystem-dev libboost-program-options-dev | |
libgtest-dev cmake tree lcov gcovr python3-lxml | |
- name: Download Ninja and CMake | |
id: cmake_and_ninja | |
shell: cmake -P {0} | |
run: | | |
set(ninja_version "1.9.0") | |
set(cmake_version "${{ matrix.config.cmake_version_used }}") | |
message(STATUS "Using host CMake version: ${CMAKE_VERSION}") | |
if ("${{ runner.os }}" STREQUAL "Windows") | |
set(ninja_suffix "win.zip") | |
set(cmake_suffix "win64-x64.zip") | |
set(cmake_dir "cmake-${cmake_version}-win64-x64/bin") | |
elseif ("${{ runner.os }}" STREQUAL "Linux") | |
set(ninja_suffix "linux.zip") | |
message(STATUS "cmake_version: ${cmake_version}") | |
if("${cmake_version}" VERSION_GREATER "3.0.0") | |
message(STATUS "cmake_version: ${cmake_version}") | |
set(cmake_suffix "Linux-x86_64.tar.gz") | |
set(cmake_dir "cmake-${cmake_version}-Linux-x86_64/bin") | |
else() | |
message(STATUS "cmake_version: ${cmake_version}") | |
set(cmake_suffix "Linux-i386.tar.gz") | |
set(cmake_dir "cmake-${cmake_version}-Linux-i386/bin") | |
endif() | |
elseif ("${{ runner.os }}" STREQUAL "macOS") | |
set(ninja_suffix "mac.zip") | |
set(cmake_suffix "Darwin-x86_64.tar.gz") | |
set(cmake_dir "cmake-${cmake_version}-Darwin-x86_64/CMake.app/Contents/bin") | |
endif() | |
set(ninja_url "https://github.com/ninja-build/ninja/releases/download/v${ninja_version}/ninja-${ninja_suffix}") | |
file(DOWNLOAD "${ninja_url}" ./ninja.zip SHOW_PROGRESS) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ninja.zip) | |
set(cmake_url "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/cmake-${cmake_version}-${cmake_suffix}") | |
file(DOWNLOAD "${cmake_url}" ./cmake.zip SHOW_PROGRESS) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./cmake.zip) | |
# Save the path for other steps | |
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/${cmake_dir}" cmake_dir) | |
message("::set-output name=cmake_dir::${cmake_dir}") | |
if (NOT "${{ runner.os }}" STREQUAL "Windows") | |
execute_process( | |
COMMAND chmod +x ninja | |
COMMAND chmod +x ${cmake_dir}/cmake | |
) | |
endif() | |
- name: Configure | |
shell: cmake -P {0} | |
run: | | |
set(ENV{CC} ${{ matrix.config.cc }}) | |
set(ENV{CXX} ${{ matrix.config.cxx }}) | |
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") | |
execute_process( | |
COMMAND "${{ matrix.config.environment_script }}" && set | |
OUTPUT_FILE environment_script_output.txt | |
) | |
file(STRINGS environment_script_output.txt output_lines) | |
foreach(line IN LISTS output_lines) | |
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$") | |
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}") | |
endif() | |
endforeach() | |
endif() | |
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/ninja" ninja_program) | |
execute_process( | |
COMMAND ${{ steps.cmake_and_ninja.outputs.cmake_dir }}/cmake | |
-S . | |
-B build | |
-D CMAKE_BUILD_TYPE=${{ matrix.config.build_type }} | |
-D ENABLE_COVERAGE=ON | |
-D ENABLE_TESTING=ON | |
-D COMPILE_EXAMPLE=OFF | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status (error code : ${result})") | |
endif() | |
- name: Build | |
shell: cmake -P {0} | |
run: | | |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") | |
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") | |
file(STRINGS environment_script_output.txt output_lines) | |
foreach(line IN LISTS output_lines) | |
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$") | |
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}") | |
endif() | |
endforeach() | |
endif() | |
execute_process( | |
COMMAND ${{ steps.cmake_and_ninja.outputs.cmake_dir }}/cmake --build build | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status") | |
endif() | |
- name: Check Path | |
run: pwd && ls | |
- name: Run tests | |
shell: cmake -P {0} | |
run: | | |
include(ProcessorCount) | |
ProcessorCount(N) | |
execute_process( | |
COMMAND ctest | |
WORKING_DIRECTORY build | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Running tests failed!") | |
endif() | |
- name: generate coverage | |
working-directory: ./build | |
run: | | |
make cov | |
- name: Generate JSON coverage report | |
working-directory: ./build | |
run: | | |
gcovr -r .. . --branches --xml > coverage.xml | |
- name: Upload test results | |
uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: test_results_xml | |
path: ${{runner.workspace}}/build/test-results/**/*.xml | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4.0.1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: unittests # optional | |
files: ${{runner.workspace}}/build/test-results/**/*.xml | |
name: codecov-umbrella # optional | |
fail_ci_if_error: false # optional (default = false) | |
verbose: false # optional (default = false) |