ci: add steps to report valgrind memory results #888
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: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
- beta | |
- alpha | |
- +([0-9])?(.{+([0-9]),x}).x | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 | |
with: | |
python-version: 3.11 | |
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 | |
with: | |
extra_args: --hook-stage manual --all-files | |
consistency: | |
if: ${{ !cancelled() && ! failure() }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Git | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 | |
with: | |
python-version: 3.11 | |
- name: Install copier | |
run: pipx install copier==9.2.0 | |
- name: Generate the project with the default value | |
run: | | |
find . -maxdepth 1 ! -name '.' \ | |
! -name 'template' \ | |
! -name 'includes' \ | |
! -name '.git' \ | |
! -name 'copier.yml' \ | |
-exec rm -r {} + | |
copier copy -r HEAD -f . . | |
rm .copier-answers.yml | |
- name: Test for consistency | |
run: | | |
echo "List inconsistent files:" | |
git status --porcelain | |
git diff --exit-code || ( \ | |
echo "# :warning: Inconsistent files found" >> $GITHUB_STEP_SUMMARY && \ | |
echo "The following files are inconsistent with the template:" >> $GITHUB_STEP_SUMMARY && \ | |
git status --porcelain | while read file; do echo "- $file"; done >> $GITHUB_STEP_SUMMARY && \ | |
echo "" >> $GITHUB_STEP_SUMMARY && \ | |
echo "Please run 'copier copy -r HEAD -f . .' to fix them." >>$GITHUB_STEP_SUMMARY && \ | |
exit 1 \ | |
) | |
check-on-linux: | |
runs-on: ubuntu-22.04 | |
needs: [pre-commit, consistency] | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
triplet: [x64-linux] | |
compiler: [gcc-13, llvm-17] | |
std: [20] | |
build_type: [Debug, RelWithDebInfo] | |
name: check • ${{ matrix.triplet }} • ${{ matrix.compiler }} • c++${{ matrix.std }} • ${{ matrix.build_type }} | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
with: | |
path: | | |
~/vcpkg | |
~/.cache/vcpkg | |
key: ${{ matrix.triplet }}-${{ matrix.compiler }}-${{ hashFiles('vcpkg.json') }} | |
restore-keys: ${{ matrix.triplet }}-${{ matrix.compiler }}-${{ hashFiles('vcpkg.json') }} | |
- uses: aminya/setup-cpp@v1 | |
with: | |
compiler: ${{ matrix.compiler }} | |
cmake: true | |
ninja: true | |
ccache: true | |
- name: Prepare for lcov | |
if: contains(matrix.compiler, 'gcc') | |
run: | | |
sudo apt-get update; sudo apt-get install lcov -y | |
gcc_compiler=${{ matrix.compiler }} | |
gcov_version=${gcc_compiler##*-} | |
sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-$gcov_version 100 | |
- name: Prepare for llvm-cov | |
if: contains(matrix.compiler, 'llvm') | |
run: | | |
llvm_compiler=${{ matrix.compiler }} | |
llvm_cov_version=${llvm_compiler##*-} | |
sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-$llvm_cov_version 100 | |
- name: Configure CMake | |
run: > | |
cmake -S . --preset=default | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
-DCMAKE_CXX_STANDARD=${{ matrix.std }} | |
-DCMAKE_C_COMPILER=${{ contains(matrix.compiler, 'gcc') && 'gcc' || contains(matrix.compiler, 'llvm') && 'clang' }} | |
-DCMAKE_CXX_COMPILER=${{ contains(matrix.compiler, 'gcc') && 'g++' || contains(matrix.compiler, 'llvm') && 'clang++' }} | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON | |
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} | |
-DCODE_COVERAGE=ON | |
-DBUILD_TESTING=ON | |
- name: Build | |
run: cmake --build --preset=default --target all | |
- name: Test | |
run: ctest --preset=default | |
- name: Install | |
run: cmake --build --preset=default --target install | |
- name: Uninstall | |
run: cmake --build --preset=default --target uninstall | |
- name: Coverage | |
run: cmake --build --preset=default --target ccov-all | |
check-on-macos: | |
runs-on: macos-12 | |
needs: [pre-commit, consistency] | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
triplet: [x64-osx] | |
compiler: [gcc@13, llvm@17] | |
std: [20] | |
build_type: [Debug, RelWithDebInfo] | |
name: check • ${{ matrix.triplet }} • ${{ matrix.compiler }} • c++${{ matrix.std }} • ${{ matrix.build_type }} | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
with: | |
path: | | |
~/vcpkg | |
~/.cache/vcpkg | |
key: ${{ matrix.triplet }}-${{ matrix.compiler }}-${{ hashFiles('vcpkg.json') }} | |
restore-keys: ${{ matrix.triplet }}-${{ matrix.compiler }}-${{ hashFiles('vcpkg.json') }} | |
- name: Install compilers and tools | |
run: | | |
brew install ${{ matrix.compiler }} cmake ninja ccache | |
- name: Prepare PATH for compilers | |
run: echo "PATH=/usr/local/opt/${{ matrix.compiler }}/bin:$PATH" >> $GITHUB_ENV | |
- name: Prepare for llvm | |
if: contains(matrix.compiler, 'llvm') | |
run: | | |
echo "CC=clang" >> $GITHUB_ENV | |
echo "CXX=clang++" >> $GITHUB_ENV | |
- name: Prepare for gcc | |
if: contains(matrix.compiler, 'gcc') | |
run: | | |
echo "CC=gcc" >> $GITHUB_ENV | |
echo "CXX=g++" >> $GITHUB_ENV | |
compiler=${{ matrix.compiler }} | |
gcov_version=${compiler##*@} | |
echo "GCOV=$(which gcov-$gcov_version)" >> $GITHUB_ENV | |
- name: Prepare for lcov | |
if: contains(matrix.compiler, 'gcc') | |
run: | | |
curl -o /tmp/lcov.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/e92d2ae54954ebf485b484d8522104700b144fee/Formula/lcov.rb | |
HOMEBREW_NO_AUTO_UPDATE=1 brew install --formula /tmp/lcov.rb | |
brew pin lcov | |
- name: Configure CMake | |
run: > | |
cmake -S . --preset=default | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
-DCMAKE_CXX_STANDARD=${{ matrix.std }} | |
-DCMAKE_C_COMPILER="${CC}" | |
-DCMAKE_CXX_COMPILER="${CXX}" | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON | |
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} | |
-DCODE_COVERAGE=ON | |
-DBUILD_TESTING=ON | |
${{ contains(matrix.compiler, 'gcc') && '-DCODE_COVERAGE_GCOV=${GCOV}' }} | |
- name: Build | |
run: cmake --build --preset=default --target all | |
- name: Test | |
run: ctest --preset=default | |
- name: Install | |
run: cmake --build --preset=default --target install | |
- name: Uninstall | |
run: cmake --build --preset=default --target uninstall | |
- name: Coverage | |
run: cmake --build --preset=default --target ccov-all | |
check-on-windows: | |
runs-on: windows-2022 | |
needs: [pre-commit, consistency] | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
triplet: [x64-windows] | |
compiler: [msvc-2022, llvm-17] | |
std: [20] | |
build_type: [Debug, RelWithDebInfo] | |
name: check • ${{ matrix.triplet }} • ${{ matrix.compiler }} • c++${{ matrix.std }} • ${{ matrix.build_type }} | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
with: | |
path: | | |
~/vcpkg | |
~/.cache/vcpkg | |
~/AppData/Local/vcpkg | |
key: ${{ matrix.triplet }}-${{ matrix.compiler }}-${{ hashFiles('vcpkg.json') }} | |
restore-keys: ${{ matrix.triplet }}-${{ matrix.compiler }}-${{ hashFiles('vcpkg.json') }} | |
- uses: aminya/setup-cpp@v1 | |
with: | |
compiler: ${{ matrix.compiler }} | |
vcvarsall: true | |
cmake: true | |
ninja: true | |
ccache: true | |
opencppcoverage: true | |
- name: Configure CMake | |
run: > | |
cmake -S . --preset=default ${{ contains(matrix.compiler, 'llvm') && '-DVCPKG_PLATFORM_TOOLSET=ClangCL' || '' }} | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
-DCMAKE_CXX_STANDARD=${{ matrix.std }} | |
-DCMAKE_C_COMPILER=${{ contains(matrix.compiler, 'msvc') && '"cl"' || contains(matrix.compiler, 'llvm') && '"clang-cl.exe"' }} | |
-DCMAKE_CXX_COMPILER=${{ contains(matrix.compiler, 'msvc') && '"cl"' || contains(matrix.compiler, 'llvm') && '"clang-cl.exe"' }} | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON | |
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} | |
-DCODE_COVERAGE=ON | |
-DBUILD_TESTING=ON | |
- name: Build | |
run: cmake --build --preset=default --target all | |
- name: Test | |
run: ctest --preset=default | |
- name: Install | |
run: cmake --build --preset=default --target install | |
- name: Uninstall | |
run: cmake --build --preset=default --target uninstall | |
- name: Coverage | |
run: cmake --build --preset=default --target ccov-all | |
check-mingw: | |
runs-on: windows-2022 | |
needs: [pre-commit, consistency] | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
triplet: [x64-mingw-dynamic] | |
compiler: [mingw] | |
std: [20] | |
build_type: [Debug, RelWithDebInfo] | |
name: check • ${{ matrix.triplet }} • ${{ matrix.compiler }} • c++${{ matrix.std }} • ${{ matrix.build_type }} | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
with: | |
path: | | |
~/vcpkg | |
~/.cache/pip | |
~/.cache/vcpkg | |
~/AppData/Local/vcpkg | |
key: ${{ matrix.triplet }}-${{ matrix.compiler }}-${{ hashFiles('vcpkg.json') }} | |
restore-keys: ${{ matrix.triplet }}-${{ matrix.compiler }}-${{ hashFiles('vcpkg.json') }} | |
- uses: aminya/setup-cpp@v1 | |
with: | |
compiler: ${{ matrix.compiler }} | |
cmake: true | |
ninja: true | |
ccache: true | |
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 | |
with: | |
python-version: 3.x | |
- name: Prepare for gcovr | |
run: | | |
pip install gcovr==7.2 | |
- name: Configure CMake | |
run: > | |
cmake -S . --preset=default | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
-DCMAKE_CXX_STANDARD=${{ matrix.std }} | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON | |
-DVCPKG_TARGET_TRIPLET=x64-mingw-dynamic | |
-DCODE_COVERAGE=ON | |
-DBUILD_TESTING=ON | |
- name: Build | |
run: cmake --build --preset=default --target all | |
- name: Test | |
run: ctest --preset=default | |
- name: Install | |
run: cmake --build --preset=default --target install | |
- name: Uninstall | |
run: cmake --build --preset=default --target uninstall | |
- name: Coverage | |
run: cmake --build --preset=default --target ccov-all | |
check-sanitizers: | |
runs-on: ubuntu-22.04 | |
needs: [pre-commit, consistency] | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
sanitizer: | |
- address,undefined | |
build_type: [Debug, RelWithDebInfo] | |
name: check • sanitizers • ${{ matrix.sanitizer }} • ${{ matrix.build_type }} | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
with: | |
path: | | |
~/vcpkg | |
~/.cache/vcpkg | |
key: x64-linux-gcc-13-${{ hashFiles('vcpkg.json') }} | |
restore-keys: x64-linux-gcc-13-${{ hashFiles('vcpkg.json') }} | |
- uses: aminya/setup-cpp@v1 | |
with: | |
compiler: gcc-13 | |
cmake: true | |
ninja: true | |
ccache: true | |
- name: Configure CMake | |
run: > | |
cmake -S . --preset=default | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
-DCMAKE_CXX_STANDARD=20 | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON | |
-DVCPKG_TARGET_TRIPLET=x64-linux | |
-DUSE_SANITIZER=${{ matrix.sanitizer }} | |
-DBUILD_TESTING=ON | |
- name: Build | |
run: cmake --build --preset=default --target all | |
- name: Test | |
run: ctest --preset=default | |
check-valgrind: | |
runs-on: ubuntu-22.04 | |
needs: [pre-commit, consistency] | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
build_type: [Debug, RelWithDebInfo] | |
name: check • valgrind • ${{ matrix.build_type }} | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
with: | |
path: | | |
~/vcpkg | |
~/.cache/vcpkg | |
key: x64-linux-gcc-13-${{ hashFiles('vcpkg.json') }} | |
restore-keys: x64-linux-gcc-13-${{ hashFiles('vcpkg.json') }} | |
- uses: aminya/setup-cpp@v1 | |
with: | |
compiler: gcc-13 | |
cmake: true | |
ninja: true | |
ccache: true | |
- name: Install valgrind | |
run: sudo apt-get install valgrind | |
# Use Valgrind must disable sanitizer | |
- name: Configure CMake | |
run: > | |
cmake -S . --preset=default | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
-DCMAKE_CXX_STANDARD=20 | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON | |
-DVCPKG_TARGET_TRIPLET=x64-linux | |
-DUSE_VALGRIND=ON | |
-DBUILD_TESTING=ON | |
- name: Build | |
run: cmake --build --preset=default --target all | |
- name: Valgrind | |
run: cmake --build --preset=default --target ExperimentalMemCheck | tee out/valgrind.log | |
- name: Check if valgrind found some errors | |
run: | | |
if grep -q "Memory Leak" out/valgrind.log; then | |
echo "# :error: Memory Leak found! Please fix it." >> $GITHUB_STEP_SUMMARY | |
echo -e "References: \n - <https://valgrind.org/docs/manual/manual.html>\n - <https://stackoverflow.com/a/44989219/23467261>" >> $GITHUB_STEP_SUMMARY | |
tar -czf out/valgrind-results.tar.gz out/build/default/Testing | |
exit 1 | |
fi | |
- name: Upload test results | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: valgrind-results | |
path: out/valgrind-results.tar.gz | |
clang-tidy: | |
runs-on: ubuntu-22.04 | |
needs: [pre-commit, consistency] | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
with: | |
path: | | |
~/vcpkg | |
~/.cache/vcpkg | |
key: x64-linux-gcc-13-${{ hashFiles('vcpkg.json') }} | |
restore-keys: x64-linux-gcc-13-${{ hashFiles('vcpkg.json') }} | |
- uses: aminya/setup-cpp@v1 | |
with: | |
compiler: gcc-13 | |
cmake: true | |
ninja: true | |
ccache: true | |
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 | |
with: | |
python-version: 3.x | |
- name: Install latest clang-tidy | |
run: | | |
pip install clang-tidy==18.1.1 | |
- name: Configure CMake | |
run: > | |
cmake -S . --preset=default | |
-DCMAKE_BUILD_TYPE=Debug | |
-DCMAKE_CXX_STANDARD=20 | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON | |
-DVCPKG_TARGET_TRIPLET=x64-linux | |
-DUSE_CLANGTIDY=ON | |
-DUSE_CLANGTIDY_WARNINGS_AS_ERRORS=ON | |
-DBUILD_TESTING=ON | |
- name: Build | |
run: cmake --build --preset=default --target all | |
cppcheck: | |
runs-on: macos-12 | |
needs: [pre-commit, consistency] | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
with: | |
path: | | |
~/vcpkg | |
~/.cache/vcpkg | |
key: x64-osx-gcc@13-${{ hashFiles('vcpkg.json') }} | |
restore-keys: x64-osx-gcc@13-${{ hashFiles('vcpkg.json') }} | |
- name: Install compilers and tools # use cppcheck of macos, it's newest version | |
run: brew install gcc@13 cmake ninja ccache cppcheck | |
- name: Prepare for gcc@13 | |
run: | | |
echo "CC=gcc" >> $GITHUB_ENV | |
echo "CXX=g++" >> $GITHUB_ENV | |
- name: Configure CMake | |
run: > | |
cmake -S . --preset=default | |
-DCMAKE_BUILD_TYPE=Debug | |
-DCMAKE_CXX_STANDARD=20 | |
-DCMAKE_C_COMPILER="${CC}" | |
-DCMAKE_CXX_COMPILER="${CXX}" | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON | |
-DVCPKG_TARGET_TRIPLET=x64-osx | |
-DUSE_CPPCHECK=ON | |
-DUSE_CPPCHECK_WARNINGS_AS_ERRORS=ON | |
-DBUILD_TESTING=ON | |
- name: Build | |
run: cmake --build --preset=default --target all | |
check-docs: | |
name: Docs build and checks | |
runs-on: ubuntu-22.04 | |
needs: [pre-commit, consistency] | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
with: | |
path: | | |
~/vcpkg | |
~/.cache/pip | |
~/.cache/vcpkg | |
key: x64-linux-gcc-13-${{ hashFiles('vcpkg.json') }} | |
restore-keys: x64-linux-gcc-13-${{ hashFiles('vcpkg.json') }} | |
- uses: aminya/setup-cpp@v1 | |
with: | |
compiler: gcc-13 | |
cmake: true | |
ninja: true | |
ccache: true | |
doxygen: true | |
graphviz: true | |
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 | |
with: | |
python-version: 3.x | |
- name: Install docs dependencies | |
run: | | |
pip install -r docs/requirements.txt | |
- name: Configure CMake | |
run: > | |
cmake -S . --preset=default | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo | |
-DCMAKE_CXX_STANDARD=20 | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON | |
-DVCPKG_TARGET_TRIPLET=x64-linux | |
- name: Checks the docs with warnings as errors | |
run: cmake --build --preset=default --target ss-cpp-docs-check | |
- name: Checks the docs for broken links | |
run: cmake --build --preset=default --target ss-cpp-docs-linkcheck | |
codecov: | |
runs-on: ubuntu-22.04 | |
needs: [pre-commit, consistency] | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
with: | |
path: | | |
~/vcpkg | |
~/.cache/vcpkg | |
key: x64-linux-gcc-13-${{ hashFiles('vcpkg.json') }} | |
restore-keys: x64-linux-gcc-13-${{ hashFiles('vcpkg.json') }} | |
- uses: aminya/setup-cpp@v1 | |
with: | |
compiler: gcc-13 | |
cmake: true | |
ninja: true | |
ccache: true | |
- name: Prepare for lcov | |
run: | | |
sudo apt-get update; sudo apt-get install lcov -y | |
gcc_compiler=gcc-13 | |
gcov_version=${gcc_compiler##*-} | |
sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-$gcov_version 100 | |
- name: Configure CMake | |
run: > | |
cmake -S . --preset=default | |
-DCMAKE_BUILD_TYPE=Debug | |
-DCMAKE_CXX_STANDARD=20 | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON | |
-DVCPKG_TARGET_TRIPLET=x64-linux | |
-DCODE_COVERAGE=ON | |
-DBUILD_TESTING=ON | |
- name: Build | |
run: cmake --build --preset=default --target all | |
- name: Coverage | |
run: cmake --build --preset=default --target ccov-all | |
- name: Upload coverage report | |
uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # v4.4.1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
disable_search: true | |
file: ./out/build/default/code_coverage/coverage.info | |
verbose: true | |
check-export-mode: | |
runs-on: ubuntu-22.04 | |
needs: [pre-commit, consistency] | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
with: | |
path: | | |
~/vcpkg | |
~/.cache/vcpkg | |
key: x64-linux-gcc-13-${{ hashFiles('vcpkg.json') }} | |
restore-keys: x64-linux-gcc-13-${{ hashFiles('vcpkg.json') }} | |
- uses: aminya/setup-cpp@v1 | |
with: | |
compiler: gcc-13 | |
cmake: true | |
ninja: true | |
ccache: true | |
- name: Configure CMake | |
run: > | |
cmake -S . --preset=default | |
-DCMAKE_BUILD_TYPE=Debug | |
-DCMAKE_CXX_STANDARD=20 | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON | |
-DVCPKG_TARGET_TRIPLET=x64-linux | |
-DBUILD_TESTING=ON | |
-DVCPKG_EXPORT_MODE=ON | |
- name: Build | |
run: cmake --build --preset=default --target all | |
- name: Test | |
run: ctest --preset=default | |
- name: Install | |
run: cmake --build --preset=default --target install | |
- name: Uninstall | |
run: cmake --build --preset=default --target uninstall | |
check-auto-vcpkg-install: | |
runs-on: ubuntu-22.04 | |
needs: [pre-commit, consistency] | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
with: | |
path: | | |
~/vcpkg | |
~/.cache/vcpkg | |
key: x64-linux-gcc-13-${{ hashFiles('vcpkg.json') }} | |
restore-keys: x64-linux-gcc-13-${{ hashFiles('vcpkg.json') }} | |
- uses: aminya/setup-cpp@v1 | |
with: | |
compiler: gcc-13 | |
cmake: true | |
ninja: true | |
ccache: true | |
- name: Disable preinstalled vcpkg in the runner to test vcpkg automatic installation | |
run: echo "VCPKG_INSTALLATION_ROOT=" >> $GITHUB_ENV | |
- name: Configure CMake | |
run: > | |
cmake -S . --preset=default | |
-DCMAKE_BUILD_TYPE=Debug | |
-DCMAKE_CXX_STANDARD=20 | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON | |
-DVCPKG_TARGET_TRIPLET=x64-linux | |
-DBUILD_TESTING=ON | |
- name: Build | |
run: cmake --build --preset=default --target all | |
- name: Test | |
run: ctest --preset=default | |
- name: Install | |
run: cmake --build --preset=default --target install | |
- name: Uninstall | |
run: cmake --build --preset=default --target uninstall | |
check-auto-detect-triplet: | |
runs-on: ubuntu-22.04 | |
needs: [pre-commit, consistency] | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
with: | |
path: | | |
~/vcpkg | |
~/.cache/vcpkg | |
key: x64-linux-gcc-13-${{ hashFiles('vcpkg.json') }} | |
restore-keys: x64-linux-gcc-13-${{ hashFiles('vcpkg.json') }} | |
- uses: aminya/setup-cpp@v1 | |
with: | |
compiler: gcc-13 | |
cmake: true | |
ninja: true | |
ccache: true | |
- name: Configure CMake | |
run: > | |
cmake -S . --preset=default | |
-DCMAKE_BUILD_TYPE=Debug | |
-DCMAKE_CXX_STANDARD=20 | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON | |
-DBUILD_TESTING=ON | |
- name: Build | |
run: cmake --build --preset=default --target all | |
- name: Test | |
run: ctest --preset=default | |
- name: Install | |
run: cmake --build --preset=default --target install | |
- name: Uninstall | |
run: cmake --build --preset=default --target uninstall | |
check-auto-build-type: | |
runs-on: ubuntu-22.04 | |
needs: [pre-commit, consistency] | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
with: | |
path: | | |
~/vcpkg | |
~/.cache/vcpkg | |
key: x64-linux-gcc-13-${{ hashFiles('vcpkg.json') }} | |
restore-keys: x64-linux-gcc-13-${{ hashFiles('vcpkg.json') }} | |
- uses: aminya/setup-cpp@v1 | |
with: | |
compiler: gcc-13 | |
cmake: true | |
ninja: true | |
ccache: true | |
- name: Configure CMake | |
run: > | |
cmake -S . --preset=default | |
-DCMAKE_CXX_STANDARD=20 | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON | |
-DVCPKG_TARGET_TRIPLET=x64-linux | |
-DBUILD_TESTING=ON | |
- name: Build | |
run: cmake --build --preset=default --target all | |
- name: Test | |
run: ctest --preset=default | |
- name: Install | |
run: cmake --build --preset=default --target install | |
- name: Uninstall | |
run: cmake --build --preset=default --target uninstall | |
pass: | |
if: always() | |
needs: | |
- check-on-linux | |
- check-on-macos | |
- check-on-windows | |
- check-mingw | |
- check-docs | |
- check-sanitizers | |
- check-valgrind | |
- clang-tidy | |
- cppcheck | |
- codecov | |
- check-export-mode | |
- check-auto-vcpkg-install | |
- check-auto-detect-triplet | |
- check-auto-build-type | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 2 | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} | |
release: | |
name: release | |
runs-on: ubuntu-22.04 | |
if: github.event_name != 'pull_request' | |
permissions: | |
contents: write | |
id-token: write | |
issues: write | |
pull-requests: write | |
needs: [pass] | |
steps: | |
- name: Generate a bot token with BOT_APP_ID | |
id: bot_token | |
if: vars.BOT_APP_ID && env.BOT_PRIVATE_KEY != null | |
uses: actions/create-github-app-token@a0de6af83968303c8c955486bf9739a57d23c7f1 # v1 | |
env: | |
BOT_PRIVATE_KEY: ${{ secrets.BOT_PRIVATE_KEY }} | |
with: | |
app-id: ${{ vars.BOT_APP_ID }} | |
private-key: ${{ secrets.BOT_PRIVATE_KEY }} | |
- name: Warn if use GITHUB_TOKEN | |
if: env._GITHUB_TOKEN == env._TO_BE_VERIFIED_TOKEN | |
env: | |
_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
_TO_BE_VERIFIED_TOKEN: ${{ steps.bot_token.outputs.token || secrets.PAT || secrets.GITHUB_TOKEN }} | |
run: | | |
echo "# :warning: GITHUB_TOKEN is used" >> $GITHUB_STEP_SUMMARY | |
echo "The GITHUB_TOKEN is used instead of a bot token or PAT that will not emit the released publish event for triggering a released workflow." >> $GITHUB_STEP_SUMMARY | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ steps.bot_token.outputs.token || secrets.PAT || secrets.GITHUB_TOKEN }} | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4 | |
with: | |
node-version: 20 | |
- uses: cycjimmy/semantic-release-action@v4 | |
id: semantic | |
with: | |
semantic_version: 22 | |
extra_plugins: | | |
@semantic-release/exec | |
@semantic-release/github | |
conventional-changelog-conventionalcommits@7 | |
env: | |
GITHUB_TOKEN: ${{ steps.bot_token.outputs.token || secrets.PAT || secrets.GITHUB_TOKEN }} |