Refactor configuration module and update directory structure #28
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: C++ CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
VCPKG_ROOT: ${{ github.workspace }}/vcpkg | |
CMAKE_BUILD_TYPE: Release | |
BUILD_DIR: build | |
VCPKG_TRIPLET: x64-linux | |
jobs: | |
build-and-test: | |
name: Build and Test | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Show C++ version | |
run: | | |
/usr/bin/c++ --version | |
# Checkout the repository | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
# Install latest CMake and Ninja | |
- name: Install CMake and Ninja | |
uses: lukka/get-cmake@latest | |
# Set up vcpkg using lukka/get-vcpkg action | |
- name: Setup vcpkg | |
uses: | |
lukka/run-vcpkg@v11 | |
# Run CMake to generate Ninja project files, using the vcpkg's toolchain file to resolve and install | |
# the dependencies as specified in vcpkg.json. Note that the vcpkg's toolchain is specified | |
# in the CMakePresets.json file. | |
# This step also runs vcpkg with Binary Caching leveraging GitHub Action cache to | |
# store the built packages artifacts. | |
- name: Restore from cache the dependencies and generate project files | |
run: | | |
cmake --preset ninja-multi-vcpkg-ci | |
# Build (Release configuration only) the whole project with Ninja (which is spawn by CMake). | |
# | |
# Note: if the preset misses the "configuration", it is possible to explicitly select the | |
# configuration with the `--config` flag, e.g.: | |
# run: cmake --build --preset ninja-vcpkg --config Release | |
- name: Build (Release configuration) | |
run: | | |
cmake --build --preset ninja-vcpkg-release-ci | |
# Test the whole project with CTest, again Release configuration only. | |
- name: Test (Release configuration) | |
run: | | |
ctest --preset test-release-ci | |
# - name: Install clang-tidy | |
# run: sudo apt-get update && sudo apt-get install -y clang-tidy | |
# | |
# # Run clang-tidy on all source and header files | |
# - name: Run clang-tidy | |
# run: | | |
# find src tests -type f \( -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 clang-tidy -p build | |
# | |
# | |
# format: | |
# name: Code Formatting | |
# runs-on: ubuntu-latest | |
# | |
# steps: | |
# # 1. Checkout the repository | |
# - name: Checkout Repository | |
# uses: actions/checkout@v3 | |
# | |
# # 2. Install clang-format | |
# - name: Install clang-format | |
# run: sudo apt-get update && sudo apt-get install -y clang-format | |
# | |
# # 3. Run clang-format on source and header files | |
# - name: Run clang-format | |
# run: | | |
# find src tests -type f \( -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 clang-format -i --style=file | |
# # Check for formatting changes | |
# git diff --exit-code | |
# | |
# |