Build update #243
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: ci | |
on: | |
pull_request: | |
release: | |
types: [published] | |
push: | |
tags: | |
branches: | |
- main | |
- develop | |
env: | |
# Conan cache environment variables | |
CONAN_SYSREQUIRES_MODE: enabled | |
CONAN_USER_HOME: "${{ github.workspace }}/conan-cache" | |
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short" | |
CLANG_TIDY_VERSION: "13.0.0" | |
jobs: | |
Test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
# Recommendations: | |
# * support at least 2 operating systems | |
# * support at least 2 compilers | |
# * make sure all supported configurations for your project are built | |
# | |
# Disable/enable builds in this list to meet the above recommendations | |
# and your own projects needs | |
matrix: | |
os: | |
- ubuntu-20.04 | |
- macos-11 | |
compiler: | |
- llvm-13.0.0 | |
- gcc-9 | |
generator: | |
- "Ninja Multi-Config" | |
build_type: | |
- Release | |
- Debug | |
developer_mode: | |
- OFF | |
- ON | |
exclude: | |
# mingw is determined by this author to be too buggy to support | |
- os: macos-11 | |
compiler: gcc-9 | |
- os: ubuntu-20.04 | |
compiler: llvm-13.0.0 | |
include: | |
# Add appropriate variables for gcov version required. This will intentionally break | |
# if you try to use a compiler that does not have gcov set | |
- compiler: gcc-9 | |
gcov_executable: gcov | |
- compiler: llvm-13.0.0 | |
gcov_executable: "llvm-cov gcov" | |
# Set up preferred package generators, for given build configurations | |
- build_type: Release | |
developer_mode: OFF | |
package_generator: TBZ2 | |
- os: windows-2022 | |
compiler: msvc | |
generator: "Visual Studio 17 2022" | |
build_type: Debug | |
developer_mode: OFF | |
- os: windows-2022 | |
compiler: msvc | |
generator: "Visual Studio 17 2022" | |
build_type: Release | |
developer_mode: OFF | |
package_generator: ZIP | |
steps: | |
- name: Check for llvm version mismatches | |
if: ${{ contains(matrix.compiler, 'llvm') && !contains(matrix.compiler, env.CLANG_TIDY_VERSION) }} | |
uses: actions/github-script@v3 | |
with: | |
script: | |
core.setFailed('There is a mismatch between configured llvm compiler and clang-tidy version chosen') | |
- uses: actions/checkout@v3 | |
- 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 }} | |
- name: Setup Cpp | |
uses: aminya/setup-cpp@v1 | |
with: | |
compiler: ${{ matrix.compiler }} | |
vcvarsall: ${{ contains(matrix.os, 'windows' )}} | |
cmake: true | |
ninja: true | |
conan: 2.0.10 | |
ccache: true | |
clangtidy: ${{ env.CLANG_TIDY_VERSION }} | |
cppcheck: true | |
gcovr: true | |
opencppcoverage: false | |
- name: Install dependencies | |
run: | |
conan profile detect; | |
conan install . --output-folder=build --build=missing --settings=build_type=${{matrix.build_type}}; | |
- name: Configure | |
run: | |
cd build; cmake .. -G "${{matrix.generator}}" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DENABLE_DEVELOPER_MODE:BOOL=${{matrix.developer_mode}} -DENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' && matrix.developer_mode == 'OFF' }} -DGIT_SHA:STRING=${{ github.sha }}; | |
- name: Build | |
# Remove llvm from env to avoid issues with gcc | |
# https://github.com/cpp-best-practices/gui_starter_template/issues/222 | |
env: | |
LLVM_PATH: "" | |
LD_LIBRARY_PATH: "" | |
DYLD_LIBRARY_PATH: "" | |
LDFLAGS: "" | |
CPPFLAGS: "" | |
LIBRARY_PATH: "" | |
CPATH: "" | |
# Execute the build. You can specify a specific target with "--target <NAME>" | |
run: | |
cmake --build ./build --config ${{matrix.build_type}} --verbose | |
- name: CTest | |
working-directory: ./build | |
run: | | |
ctest -C ${{matrix.build_type}} | |
- name: CPack | |
if: matrix.package_generator != '' | |
working-directory: ./build | |
run: | |
cpack -C ${{matrix.build_type}} -G ${{matrix.package_generator}} | |
- name: Publish Tagged Release | |
uses: softprops/action-gh-release@v1 | |
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.package_generator != '' }} | |
with: | |
files: | |
build/*-*${{ matrix.build_type }}*-*.* | |
- name: Coverage | |
# looks like there may be in bug preventing coverage reporting in gcc-11 so we only run this in in gcc-9 variant | |
if: matrix.compiler == 'gcc-9' && matrix.build_type == 'Debug' && matrix.developer_mode == 'OFF' | |
working-directory: ./build | |
run: | | |
gcovr -j ${{env.nproc}} --delete --root ../lib/ --print-summary --exclude-unreachable-branches --exclude-throw-branches --xml-pretty --xml coverage.xml . --gcov-executable '${{ matrix.gcov_executable }}' | |
# Disabled as it keeps sending empty coverage using manual upload unti fixed | |
# ~/codecov -t 40f0bacd-3dc4-46e4-b0b2-25fe417e46c2 -C 5ab4dc01b8e05566597380eb7f01c3b4ccbc18fe -f ./build/coverage.xml --slug '{user}/{project}' | |
- name: Publish to codecov # Only doing coverage from the GCC / Debug build | |
if: matrix.compiler == 'gcc-9' && matrix.build_type == 'Debug' && matrix.developer_mode == 'OFF' | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: unittests # optional | |
fail_ci_if_error: true # optional (default = false) | |
verbose: true # optional (default = false) |