update Github CI #13
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-latest | |
steps: | |
- run: | | |
sudo apt update | |
sudo apt install build-essential | |
shell: bash | |
# 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 | |
# Configure, Build, and Test using CMake Presets | |
- name: Configure, Build, and Test with CMake Presets | |
uses: lukka/run-cmake@v10 | |
with: | |
configurePreset: "ninja-multi-vcpkg-ci" | |
buildPreset: "ninja-vcpkg-release-ci" | |
testPreset: "test-release-ci" | |
buildPresetAdditionalArgs: "['--parallel 6']" | |
- 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 | |
# | |
# |