Skip to content

Commit

Permalink
ci: add debug build and clang-format check (#2)
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo Benitez <benitezc.ricardo@gmail.com>
  • Loading branch information
ricardobtez authored Jan 8, 2024
1 parent 8f3d836 commit 221c313
Showing 1 changed file with 40 additions and 9 deletions.
49 changes: 40 additions & 9 deletions .github/workflows/cmake-conan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
pull_request:
branches: [ "main" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
Expand All @@ -19,15 +16,25 @@ jobs:

matrix:
os: [ubuntu-latest]
build_type: [Release]
build_type: [Release, Debug]
c_compiler: [gcc, clang]
include:
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
build_type: Release
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
build_type: Debug
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
build_type: Release
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
build_type: Debug

steps:
- uses: actions/checkout@v3
Expand All @@ -37,7 +44,7 @@ jobs:
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/cmake-build-release" >> "$GITHUB_OUTPUT"
echo "build-output-dir=${{ github.workspace }}/cmake-build-${{ matrix.build_type }}" >> "$GITHUB_OUTPUT"
- name: Get conan
uses: turtlebrowser/get-conan@main
Expand All @@ -50,17 +57,41 @@ jobs:
id: conan-install
shell: bash
run: |
conan install . --output-folder=${{ steps.strings.outputs.build-output-dir }} --build missing
conan install . --output-folder=${{ steps.strings.outputs.build-output-dir }} --build missing -s:h build_type=${{ matrix.build_type }} -s:b build_type=${{ matrix.build_type }}
- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }} -DCMAKE_TOOLCHAIN_FILE=${{ steps.strings.outputs.build-output-dir }}/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
cmake -B ${{ steps.strings.outputs.build-output-dir }} -DCMAKE_TOOLCHAIN_FILE=${{ steps.strings.outputs.build-output-dir }}/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
- name: Build
# Build your program with the given configuration
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{env.BUILD_TYPE}}
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: ctest -C ${{env.BUILD_TYPE}}
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure

clang-format-check:
name: clang-format check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: clang-format check 'src'
uses: jidicula/clang-format-action@v4.11.0
with:
clang-format-version: '15'
check-path: 'src'

- name: clang-format check 'include'
uses: jidicula/clang-format-action@v4.11.0
with:
clang-format-version: '15'
check-path: 'include'

- name: clang-format check 'test'
uses: jidicula/clang-format-action@v4.11.0
with:
clang-format-version: '15'
check-path: 'test'

0 comments on commit 221c313

Please # to comment.