Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Feature/presets enchancements #19

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions .github/actions/setup_cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@
name: 'setup_cache'
description: 'sets up the shared cache'
inputs:
compiler:
configure_preset:
required: true
type: string
build_type:
required: true
type: string
generator:
required: true
type: string
developer_mode:
build_preset:
required: true
type: string

Expand All @@ -32,7 +26,7 @@ runs:
${{ env.XDG_CACHE_HOME }}/vcpkg/archives
${{ env.LOCALAPPDATA }}\vcpkg\archives
${{ env.APPDATA }}\vcpkg\archives
key: ${{ runner.os }}-${{ inputs.compiler }}-${{ inputs.build_type }}-${{ hashFiles('./conanfile.txt')}}-${{ inputs.generator }}-${{ inputs.developer_mode }}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('./vcpkg.json')}}
key: ${{ runner.os }}-${{ inputs.configure_preset }}-${{ inputs.build_preset }}-${{ hashFiles('./conanfile.txt')}}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('./vcpkg.json')}}
restore-keys: |
${{ runner.os }}-${{ inputs.compiler }}-${{ inputs.build_type }}-${{ hashFiles('./conanfile.txt') }}
${{ runner.os }}-${{ inputs.configure_preset }}-${{ inputs.build_preset }}-${{ hashFiles('./conanfile.txt') }}

2 changes: 1 addition & 1 deletion .github/template/template_name
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cmake_conan_boilerplate_template
cpp_boilerplate_project
2 changes: 1 addition & 1 deletion .github/template/template_repository
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cpp-best-practices/cmake_conan_boilerplate_template
Jason5480/cpp_boilerplate_project
43 changes: 33 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
env:
# Conan cache environment variables
CONAN_SYSREQUIRES_MODE: enabled
CONAN_REVISIONS_ENABLED: 1
CONAN_USER_HOME: "${{ github.workspace }}/conan-cache"
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short"
CLANG_TIDY_VERSION: "13.0.0"
Expand Down Expand Up @@ -46,6 +47,32 @@ jobs:
developer_mode:
- ON
- OFF
configure_preset:
- windows-msvc-dev
- windows-clang-dev
- unixlike-gcc-dev
- unixlike-clang-dev
- windows-msvc-usr
- windows-clang-usr
- unixlike-gcc-usr
- unixlike-clang-usr
build_test_preset:
- windows-msvc-dev-debug
- windows-msvc-dev-release
- windows-clang-dev-debug
- windows-clang-dev-release
- unixlike-gcc-dev-debug
- unixlike-gcc-dev-release
- unixlike-clang-dev-debug
- unixlike-clang-dev-release
- windows-msvc-usr-debug
- windows-msvc-usr-release
- windows-clang-usr-debug
- windows-clang-usr-release
- unixlike-gcc-usr-debug
- unixlike-gcc-usr-release
- unixlike-clang-usr-debug
- unixlike-clang-usr-release

exclude:
# mingw is determined by this author to be too buggy to support
Expand Down Expand Up @@ -113,10 +140,8 @@ jobs:
- name: Setup Cache
uses: ./.github/actions/setup_cache
with:
compiler: ${{ matrix.compiler }}
build_type: ${{ matrix.build_type }}
developer_mode: ${{ matrix.developer_mode }}
generator: ${{ matrix.generator }}
configure_preset: ${{ matrix.configure_preset }}
build_preset: ${{ matrix.build_test_preset }}

- name: Setup Cpp
uses: aminya/setup-cpp@v1
Expand All @@ -131,7 +156,6 @@ jobs:
ccache: true
clangtidy: ${{ env.CLANG_TIDY_VERSION }}


cppcheck: true

gcovr: true
Expand All @@ -145,27 +169,27 @@ jobs:
# has meaningful results
- name: Configure CMake
run: |
cmake -S . -B ./build -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DENABLE_DEVELOPER_MODE:BOOL=${{matrix.developer_mode}} -DOPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} -DGIT_SHA:STRING=${{ github.sha }}
cmake -S . --preset="${{matrix.configure_preset}}" -DOPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} -DGIT_SHA:STRING=${{ github.sha }}

- name: Build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: |
cmake --build ./build --config ${{matrix.build_type}}
cmake --build ./build --preset=${{matrix.build_test_preset}}

- name: Unix - Test and coverage
if: runner.os != 'Windows'
working-directory: ./build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
ctest -C ${{matrix.build_type}}
ctest -C --preset=${{matrix.build_test_preset}}
gcovr -j ${{env.nproc}} --delete --root ../ --print-summary --xml-pretty --xml coverage.xml . --gcov-executable '${{ matrix.gcov_executable }}'

- name: Windows - Test and coverage
if: runner.os == 'Windows'
working-directory: ./build
run: |
OpenCppCoverage.exe --export_type cobertura:coverage.xml --cover_children -- ctest -C ${{matrix.build_type}}
OpenCppCoverage.exe --export_type cobertura:coverage.xml --cover_children -- ctest -C --preset=${{matrix.build_test_preset}}

- name: CPack
if: matrix.package_generator != ''
Expand All @@ -180,7 +204,6 @@ jobs:
files: |
build/*-*${{ matrix.build_type }}*-*.*


- name: Publish to codecov
uses: codecov/codecov-action@v2
with:
Expand Down
Loading