Ensure 'ualloc.h' always defines allocator macros #51
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 pipeline | |
on: | |
push: | |
branches: [dev] | |
env: | |
build_dir: build | |
build_config: Release | |
test_target: ulib-test | |
cpp_test_target: ulib-cpp-test | |
bench_target: ulib-bench | |
docs_target: ulib-docs | |
jobs: | |
analyze: | |
name: Run analyzers | |
runs-on: ${{vars.ubuntu_runner || 'ubuntu-latest'}} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- 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}} | |
-DULIB_CLANG_TIDY=ON | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON | |
- name: Build | |
run: cmake --build ${{env.build_dir}} | |
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] | |
types: [normal, tiny, huge] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Configure CMake | |
run: > | |
cmake -B ${{env.build_dir}} | |
-DULIB_LIBRARY_TYPE=${{matrix.lib_type}} | |
-DULIB_TINY=${{matrix.types == 'tiny' && 'ON' || 'OFF'}} | |
-DULIB_HUGE=${{matrix.types == 'huge' && 'ON' || 'OFF'}} | |
-DULIB_LEAKS=ON | |
-DULIB_SANITIZERS=ON | |
-DCMAKE_SYSTEM_VERSION='' | |
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON | |
-DCMAKE_BUILD_TYPE=${{env.build_config}} | |
- name: Build | |
run: > | |
cmake --build ${{env.build_dir}} | |
--config ${{env.build_config}} | |
--target ${{env.test_target}} ${{env.cpp_test_target}} ${{env.bench_target}} | |
- name: Configure tests (Windows) | |
working-directory: ${{env.build_dir}}/test | |
if: runner.os == 'Windows' | |
run: | | |
mv ${{env.build_config}}/*.exe ./ | |
if [ ${{matrix.lib_type}} == 'SHARED' ]; then | |
mv ../${{env.build_config}}/*.dll ./ | |
fi | |
shell: bash | |
- name: Run tests | |
working-directory: ${{env.build_dir}}/test | |
run: ./${{env.test_target}} | |
- name: Run tests (C++) | |
working-directory: ${{env.build_dir}}/test | |
run: ./${{env.cpp_test_target}} | |
- name: Run benchmark | |
working-directory: ${{env.build_dir}}/test | |
run: ./${{env.bench_target}} | |
docs: | |
name: Generate the documentation | |
runs-on: ${{vars.ubuntu_runner || 'ubuntu-latest'}} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- 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}} | |
cmake --build ${{env.build_dir}} --target ${{env.docs_target}} |