Feature/Optional ID structural refactor #4116
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
# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org> | |
# | |
# SPDX-License-Identifier: MPL-2.0 | |
name: Clang Tidy | |
on: | |
# run pipeline on push event of main branch | |
push: | |
branches: | |
- main | |
# run pipeline on pull request | |
pull_request: | |
# run pipeline on merge queue | |
merge_group: | |
# run pipeline from another workflow | |
workflow_call: | |
inputs: | |
target: | |
type: string | |
description: "The CMake target to run (e.g.: all)" | |
required: true | |
# run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
target: | |
type: choice | |
description: The CMake target to run | |
default: all power_grid_model_benchmark_cpp | |
options: | |
- all | |
- all power_grid_model_benchmark_cpp | |
- power_grid_model_c | |
- power_grid_model_unit_tests | |
- power_grid_model_api_tests | |
- power_grid_model_validation_tests | |
- power_grid_model_benchmark_cpp | |
- power_grid_model_c_example | |
required: true | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-clang-tidy | |
cancel-in-progress: true | |
jobs: | |
clang-tidy: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
build-option: [ debug, release ] | |
env: | |
CMAKE_PREFIX_PATH: /home/linuxbrew/.linuxbrew | |
PRESET: ci-clang-tidy-${{ matrix.build-option }} | |
TARGET: nonexistent # will be overwritten later in this action | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ninja-build clang-15 clang-tidy-15 | |
sudo ln -s /usr/bin/clang-15 /usr/local/bin/clang | |
sudo ln -s /usr/bin/clang++-15 /usr/local/bin/clang++ | |
sudo ln -s /usr/bin/clang-tidy-15 /usr/local/bin/clang-tidy | |
- name: Enable brew | |
run: | | |
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH | |
- name: Install C++ dependencies | |
run: | | |
brew install boost eigen nlohmann-json msgpack-cxx doctest | |
- name: Set build target in case of push | |
if: inputs.target == null | |
run: | | |
echo "TARGET=power_grid_model_api_tests" >> $GITHUB_ENV | |
- name: Set build target in case of workflow dispatch | |
if: inputs.target != null | |
run: | | |
echo "TARGET=${{ inputs.target }}" >> $GITHUB_ENV | |
- name: Build | |
run: | | |
cmake --preset ${{ env.PRESET }} | |
cmake --build --preset ${{ env.PRESET }} --target ${{ env.TARGET }} |