-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (69 loc) · 2.33 KB
/
clang-tidy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <[email protected]>
#
# 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 this workflow manually from the Actions tab
workflow_dispatch:
inputs:
target:
type: choice
description: The CMake target to run
default: power_grid_model_io_native_c
options:
- all
- power_grid_model_io_native_c
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
clang-tidy:
runs-on: ubuntu-latest
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
with:
submodules: 'true'
- name: Initialize and update submodules
run: |
git submodule update --init --recursive
- 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: github.event_name != 'workflow_dispatch'
run: |
echo "TARGET=power_grid_model_io_native_c" >> $GITHUB_ENV
- name: Set build target in case of workflow dispatch
if: github.event_name == 'workflow_dispatch'
run: |
echo "TARGET=${{ github.event.inputs.target }}" >> $GITHUB_ENV
- name: Build
run: |
cmake --preset ${{ env.PRESET }}
cmake --build --preset ${{ env.PRESET }} --target ${{ env.TARGET }}