Skip to content

CMake and CTest on ubuntu-latest #1

CMake and CTest on ubuntu-latest

CMake and CTest on ubuntu-latest #1

# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
name: CMake and CTest on ubuntu-latest
on:
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
workflow_dispatch:
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
strategy:
matrix:
os:
- ubuntu-latest
#- macos-latest
#- windows-latest
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: cache dependencies
uses: actions/cache@v4
id: cache
with:
path: |
~/.conan2/
~/.cache/pip/wheels/
key: ${{ runner.os }}-dependencies
- name: install conan
run: |
pip install conan
conan profile detect --force
- name: install conan packages
# if: ${{ steps.cache.output.cache-hit != 'true' }}
run: conan install conanfile.txt --build=missing
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
sudo apt install build-essential
pwd
cmake --version
cmake --preset conan-release
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build/${{env.BUILD_TYPE}}/ --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build/${{env.BUILD_TYPE}}/
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}} --output-junit test_results.xml
- name: Test Summary
uses: test-summary/[email protected]
with:
paths: "build/${{env.BUILD_TYPE}}/test_results.xml"
if: always()