Files
ResInsight/.github/workflows/clang-tidy.yml
Magne Sjaastad ab9e8646db Update vcpkg and GitHub Actions (#8682)
* Update vcpkg to latest release (2021.05.12) Use https://github.com/microsoft/vcpkg
* Update all GHA to latest from dev
* Python code linting changes detected by black
2022-03-15 08:19:44 +01:00

99 lines
3.6 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@v2
with:
submodules: true
- name: Cache Qt
id: cache-qt
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/Qt/
key: ${{ matrix.config.os }}-QtCache-5-12-12
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: 5.12.12
modules: qtscript qtcharts
dir: '${{ github.workspace }}/Qt/'
cached: ${{ steps.cache-qt.outputs.cache-hit }}
- 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@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Fixes by clang-tidy'
title: 'Fixes by clang-tidy'
branch: clang-tidy-patches
branch-suffix: random