Draft: Re-do the infrastructure in preparation for the MySQL Interface #27
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 }} | |
continue-on-error: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' }} | |
strategy: | |
fail-fast: false | |
# 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 | |
- ubuntu-22.04 | |
- macos-12 | |
- macos-13 | |
- macos-14 | |
compiler: | |
# you can specify the version after `-` like "llvm-13.0.0". | |
- llvm-13.0.0 | |
- gcc-11 | |
generator: | |
- "Ninja Multi-Config" | |
build_type: | |
- Release | |
- Debug | |
developer_mode: | |
- ON | |
- OFF | |
exclude: | |
# mingw is determined by this author to be too buggy to support | |
- os: macos-12 | |
compiler: gcc-11 | |
- os: macos-13 | |
compiler: gcc-11 | |
- os: macos-14 | |
compiler: gcc-11 | |
- os: ubuntu-20.04 | |
compiler: llvm-13.0.0 | |
- os: ubuntu-22.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-11 | |
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: On | |
- os: windows-2022 | |
compiler: msvc | |
generator: "Visual Studio 17 2022" | |
build_type: Release | |
developer_mode: On | |
- 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@v7 | |
with: | |
script: | | |
core.setFailed('There is a mismatch between configured llvm compiler and clang-tidy version chosen') | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- 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: false | |
vcpkg: false | |
ccache: true | |
clangtidy: ${{ env.CLANG_TIDY_VERSION }} | |
cppcheck: true | |
gcovr: true | |
opencppcoverage: true | |
# make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage | |
# 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' && matrix.developer_mode == 'OFF' }} -DGIT_SHA:STRING=${{ github.sha }} | |
- name: Build | |
if: success() | |
# Execute the build. You can specify a specific target with "--target <NAME>" | |
run: | | |
cmake --build ./build --config ${{matrix.build_type}} | |
- name: Unix - Test and coverage | |
if: runner.os != 'Windows' && success() | |
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}} --output-on-failure -O ../test-result.txt | |
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' && success() | |
continue-on-error: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' }} | |
working-directory: ./build | |
run: | | |
OpenCppCoverage.exe --export_type cobertura:coverage.xml --cover_children -- ctest -C ${{matrix.build_type}} --output-on-failure -O ../test-result.txt | |
- name: Archive test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results-${{matrix.os}}-${{matrix.compiler}}-${{matrix.generator}}-${{matrix.build_type}}-${{matrix.developer_mode}} | |
path: test-result.txt | |
- name: CPack | |
if: matrix.package_generator != '' && success() | |
continue-on-error: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' }} | |
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 != '' && success() }} | |
continue-on-error: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' }} | |
with: | |
files: | | |
build/*-*${{ matrix.build_type }}*-*.* | |
- name: Publish to codecov | |
if: success() | |
continue-on-error: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' }} | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: ${{ runner.os }} | |
name: ${{ runner.os }}-coverage | |
files: ./build/coverage.xml | |
- name: Raise warning | |
if: ${{ failure() && matrix.os == 'macos-13' || matrix.os == 'macos-14' }} | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
core.summary.addRaw(':x: Experimental support failed for ${{ matrix.os }}, ${{ matrix.compiler }}, ${{ matrix.generator }}, ${{ matrix.build_type }}, ${{ matrix.developer_mode }}', false) | |
Deploy: | |
needs: [Test] | |
uses: ./.github/workflows/deploy.yaml | |
clang-format: | |
permissions: | |
contents: write | |
pull-requests: write | |
needs: [Deploy] | |
uses: ./.github/workflows/auto-clang-format.yml | |
gh-pages: | |
if: ${{ github.ref == 'refs/heads/main' }} | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
needs: [clang-format] | |
uses: ./.github/workflows/gh-pages.yaml |