-
Notifications
You must be signed in to change notification settings - Fork 91
80 lines (72 loc) · 2.84 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
name: clang-tidy
on:
push:
branches:
- main
- dev
paths:
- '**.clang-tidy'
workflow_dispatch:
schedule:
# Once every night
- cron: "0 1 * * *"
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
jobs:
ResInsight-clang-tidy:
runs-on: ubuntu-22.04
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Install Linux dependencies
run: |
sudo apt-get update --option="APT::Acquire::Retries=3"
sudo apt-get install --option="APT::Acquire::Retries=3" libxkbcommon-x11-0 libgl1-mesa-dev mesa-common-dev libglfw3-dev libglu1-mesa-dev libhdf5-dev
sudo apt-get install clang-tidy-15 clang-format-15
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: 5.12.12
dir: "${{ github.workspace }}/Qt/"
cache: true
modules: "qtnetworkauth"
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: vcpkg bootstrap
run: ThirdParty/vcpkg/bootstrap-vcpkg.sh
- name: Create compile commands and run clang-tidy
# https://clang.llvm.org/extra/doxygen/run-clang-tidy_8py_source.html
run: |
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-linux-release -DRESINSIGHT_USE_OPENMP=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
mv compile_commands.json compile_commands_original.json
python ../scripts/fix_json_database.py compile_commands_original.json >> compile_commands.json
- name: Run clang-tidy and apply fixes, clang-format after fixes
run: |
cd build
run-clang-tidy-15 -config-file ../ApplicationLibCode/.clang-tidy -fix files ApplicationLibCode
run-clang-tidy-15 -config-file ../GrpcInterface/.clang-tidy -fix files GrpcInterface
- name: Run clang-format after clang-tidy
run: |
cd ApplicationLibCode
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | xargs clang-format-15 -i
cd ../GrpcInterface
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | xargs clang-format-15 -i
- uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Fixes by clang-tidy"
title: "Fixes by clang-tidy"
branch: clang-tidy-patches
branch-suffix: random
add-paths: |
ApplicationLibCode/*
GrpcInterface/*