ci: add debug build and clang-format check #3
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: Build with conan | ||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
env: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ubuntu-latest] | ||
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 | ||
- name: Set reusable strings | ||
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. | ||
id: strings | ||
shell: bash | ||
run: | | ||
echo "build-output-dir=${{ github.workspace }}/cmake-build-${{ matrix.build_type }}" >> "$GITHUB_OUTPUT" | ||
- name: Get conan | ||
uses: turtlebrowser/get-conan@main | ||
- name: Configure default conan profile | ||
shell: bash | ||
run: conan profile detect | ||
- name: Get conan dependencies | ||
id: conan-install | ||
shell: bash | ||
run: | | ||
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=${{ matrix.build_type }} | ||
- name: Build | ||
# Build your program with the given configuration | ||
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}} --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' |