Skip to content

Enable more clang-tidy checks and fix warnings #35

Enable more clang-tidy checks and fix warnings

Enable more clang-tidy checks and fix warnings #35

Workflow file for this run

name: CI pipeline
on:
push:
branches: [dev]
env:
build_dir: build
build_config: Release
jobs:
analyze:
name: Run analyzers
runs-on: ${{vars.ubuntu_runner || 'ubuntu-latest'}}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2
submodules: recursive
- name: Run pre-commit
run: |
python -m venv .venv
source .venv/bin/activate
pip install pre-commit
pre-commit run --from-ref=HEAD~1 --to-ref=HEAD
- name: Configure CMake
run: >
CC=clang cmake -B ${{env.build_dir}}
-DCOWL_CPP_TESTS=OFF
-DCOWL_LTO=OFF
-DCOWL_CLANG_TIDY=ON
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON
- name: Build
run: cmake --build ${{env.build_dir}} --target cowl-test cowl-bench cowl-examples cowl-tools
test:
name: Test
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os:
- ${{vars.ubuntu_runner || 'ubuntu-latest'}}
- ${{vars.windows_runner || 'windows-latest'}}
- ${{vars.macos_runner || 'macos-latest'}}
lib_type: [STATIC, SHARED]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Configure runner
run: |
if [ $RUNNER_OS == 'Windows' ]; then
choco install winflexbison3
elif [ $RUNNER_OS == 'macOS' ]; then
brew install flex bison
echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH
echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH
fi
shell: bash
- name: Configure CMake
run: >
cmake -B ${{env.build_dir}}
-DULIB_LEAKS=ON
-DULIB_SANITIZERS=ON
-DULIB_LIBRARY_TYPE=${{matrix.lib_type}}
-DCOWL_LIBRARY_TYPE=${{matrix.lib_type}}
-DCOWL_ENTITY_IDS=ON
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON
-DCMAKE_SYSTEM_VERSION=''
-DCMAKE_BUILD_TYPE=${{env.build_config}}
- name: Build
run: >
cmake --build ${{env.build_dir}}
--config ${{env.build_config}}
--target cowl-test cowl-cpp-test cowl-bench cowl-examples cowl-tools
- name: Debug
if: ${{always()}}
run: sed '4019q;d' ${{env.build_dir}}/src/reader/functional/cowl_func_yyparser.c
shell: bash
- name: Configure tests (Windows)
working-directory: ${{env.build_dir}}
if: runner.os == 'Windows'
run: |
mv test/${{env.build_config}}/*.exe test
mv examples/${{env.build_config}}/*.exe examples
mv tools/${{env.build_config}}/*.exe tools
if [ ${{matrix.lib_type}} == 'SHARED' ]; then
find . -name '*.dll' -exec cp -t test {} + -exec cp -t examples {} + -exec cp -t tools {} +
fi
shell: bash
- name: Run tests
working-directory: ${{env.build_dir}}/test
run: ./cowl-test
- name: Run tests (C++)
working-directory: ${{env.build_dir}}/test
run: ./cowl-cpp-test
- name: Run benchmark
working-directory: ${{env.build_dir}}/test
run: ./cowl-bench
- name: Run examples
working-directory: ${{env.build_dir}}/examples
run: |
if [ $RUNNER_OS == 'Windows' ]; then
EXAMPLES=(./*-example.exe)
else
EXAMPLES=(./*-example)
fi
for EXAMPLE in "${EXAMPLES[@]}"; do
"${EXAMPLE}"
done
shell: bash
- name: Run tools
working-directory: ${{env.build_dir}}/tools
run: ./cowl-stats test_onto.owl
docs:
name: Generate the documentation
runs-on: ${{vars.ubuntu_runner || 'ubuntu-latest'}}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build docs
run: |
sudo apt install doxygen
python -m venv .venv
source .venv/bin/activate
pip install Sphinx sphinx-rtd-theme breathe
cmake -B ${{env.build_dir}} -DCOWL_READERS=OFF -DCOWL_WRITERS=OFF
cmake --build ${{env.build_dir}} --target cowl-docs