ResInsight/.github/workflows/clang-tidy.yml
2022-10-14 08:50:00 +02:00

97 lines
3.4 KiB
YAML

name: clang-tidy
on:
workflow_dispatch:
schedule:
# Once every night
- cron: "0 1 * * * "
jobs:
ResInsight-x64-buildcache:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu 20.04",
os: ubuntu-20.04,
cc: "gcc",
cxx: "g++",
vcpkg-response-file: vcpkg_x64-linux.txt,
vcpkg-triplet: x64-linux,
cmake-toolchain: "ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake",
}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: 5.12.12
modules: qtscript
dir: "${{ github.workspace }}/Qt/"
cache: true
- name: Install Linux dependencies
if: "contains( matrix.config.os, 'ubuntu')"
run: sudo apt-get install libxkbcommon-x11-0 libgl1-mesa-dev mesa-common-dev libglfw3-dev libglu1-mesa-dev libhdf5-dev
- name: Set vcpkg's response file path used as part of cache's key.
uses: lukka/set-shell-env@master
with:
VCPKGRESPONSEFILE: ${{ github.workspace }}/${{ matrix.config.vcpkg-response-file }}
- name: Run vcpkg
uses: lukka/run-vcpkg@v7
id: runvcpkg
with:
vcpkgArguments: "@${{ github.workspace }}/${{ matrix.config.vcpkg-response-file }}"
vcpkgDirectory:
"${{ github.workspace }}/ThirdParty/vcpkg"
# Ensure the cache key changes any time the content of the response file changes.
appendedCacheKey: ${{ hashFiles(env.VCPKGRESPONSEFILE) }}-clang-tidy-v01
- 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=${{ matrix.config.cmake-toolchain }} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
sudo apt-get install clang-tidy
mv compile_commands.json compile_commands_original.json
python ../scripts/fix_json_database.py compile_commands_original.json >> compile_commands.json
- name: clang-tidy on ApplicationLibCode/Application
run: |
cd build
run-clang-tidy -fix files ApplicationLibCode/Application
- name: clang-tidy on ApplicationLibCode/ProjectDataModel
run: |
cd build
run-clang-tidy -fix files ApplicationLibCode/ProjectDataModel
- name: clang-tidy on ApplicationLibCode/ReservoirDataModel
run: |
cd build
run-clang-tidy -fix files ApplicationLibCode/ReservoirDataModel
- name: clang-tidy on ApplicationLibCode/Commands
run: |
cd build
run-clang-tidy -fix files ApplicationLibCode/Commands
- name: clang-tidy on ApplicationLibCode/GeoMech
run: |
cd build
run-clang-tidy -fix files ApplicationLibCode/GeoMech
- name: Remove Qt before creating PR
run: |
rm -rf Qt
cd ThirdParty/vcpkg
git reset --hard HEAD
git clean -fxd
- uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Fixes by clang-tidy"
title: "Fixes by clang-tidy"
branch: clang-tidy-patches
branch-suffix: random