Update Prometheus metrics + Add Grafana sample (#339) #1418
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 and test | |
on: | |
push: | |
branches: | |
- 'master' | |
pull_request: | |
permissions: | |
contents: read | |
env: | |
CCACHE_DIR: ${{ github.workspace }}/.ccache | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
static-analysis: | |
runs-on: ubuntu-latest | |
container: egecetinn/alpine | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
with: | |
submodules: recursive | |
- name: Run clang-format | |
run: clang-format include/**/*.hpp src/*.cpp src/**/*.cpp --verbose --dry-run --Werror | |
- name: Run cppcheck | |
run: cppcheck -Iinclude/ src --verbose --enable=all --error-exitcode=1 --std=c++17 --language=c++ --suppressions-list=cppcheckSuppressions.txt --inline-suppr --check-level=exhaustive | |
- name: Configure for clang-tidy | |
run: cmake -S . -B build | |
- name: Clang-tidy | |
run: run-clang-tidy -j`nproc` -p=build -header-filter=`pwd`/include/ src/*.cpp src/**/*.cpp | |
memleak: | |
runs-on: ubuntu-latest | |
container: egecetinn/ubuntu2204 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
with: | |
submodules: recursive | |
- name: Prepare | |
run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- name: Restore ccache | |
id: ccache-restore | |
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: | | |
${{ env.CCACHE_DIR }} | |
key: memleak-ccache-${{ github.run_id }} | |
restore-keys: | | |
memleak-ccache | |
- name: Install Test Requirements | |
run: | | |
python3 -m venv .venv | |
. .venv/bin/activate | |
pip3 install -r tests/data/requirements.txt | |
- name: Configure | |
run: cmake -DXXX_ENABLE_MEMLEAK_CHECK=ON -S . -B build | |
- name: Build | |
run: cmake --build build --parallel | |
- name: Run tests | |
run: | | |
. .venv/bin/activate | |
ctest --output-on-failure --test-dir build | |
- name: Save ccache | |
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: ${{ steps.ccache-restore.outputs.cache-primary-key }} | |
fuzztests: | |
runs-on: ubuntu-latest | |
container: egecetinn/ubuntu2204 | |
strategy: | |
matrix: | |
sanitizer: [ASAN, USAN] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
with: | |
submodules: recursive | |
- name: Prepare | |
run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- name: Restore ccache | |
id: ccache-restore | |
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: | | |
${{ env.CCACHE_DIR }} | |
key: ${{ matrix.sanitizer }}-ccache-${{ github.run_id }} | |
restore-keys: | | |
${{ matrix.sanitizer }}-ccache | |
- name: Install Test Requirements | |
run: | | |
python3 -m venv .venv | |
. .venv/bin/activate | |
pip3 install -r tests/data/requirements.txt | |
- name: Configure | |
run: cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DXXX_BUILD_UNITTESTS=OFF -DXXX_BUILD_FUZZTESTS=ON -DXXX_ENABLE_${{ matrix.sanitizer }}=ON -S . -B build | |
- name: Build | |
run: cmake --build build --parallel | |
- name: Run tests | |
run: | | |
. .venv/bin/activate | |
ctest --output-on-failure --test-dir build | |
- name: Save ccache | |
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: ${{ steps.ccache-restore.outputs.cache-primary-key }} | |
- name: Upload regressions | |
if: failure() | |
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
with: | |
name: regressions-${{ matrix.sanitizer }} | |
path: build/tests/fuzztests/crash* | |
unittests: | |
runs-on: ubuntu-latest | |
container: egecetinn/${{ matrix.image }} | |
strategy: | |
matrix: | |
include: | |
- image: rockylinux8 | |
- image: rockylinux9 | |
- image: ubuntu2204 | |
- image: ubuntu2404 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
with: | |
submodules: recursive | |
- name: Prepare | |
run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- name: Restore ccache | |
id: ccache-restore | |
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: | | |
${{ env.CCACHE_DIR }} | |
key: ${{ matrix.image }}-ccache-${{ github.run_id }} | |
restore-keys: | | |
${{ matrix.image }}-ccache | |
- name: Install Test Requirements | |
run: | | |
python3 -m venv .venv | |
. .venv/bin/activate | |
pip3 install -r tests/data/requirements.txt | |
- name: Configure | |
run: cmake -S . -B build | |
- name: Build | |
run: cmake --build build --parallel | |
- name: Run Tests | |
run: | | |
. .venv/bin/activate | |
ctest --output-on-failure --test-dir build | |
- name: Save ccache | |
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: ${{ steps.ccache-restore.outputs.cache-primary-key }} |