Skip to content

Commit

Permalink
Improve workflow for clang-tidy
Browse files Browse the repository at this point in the history
Use github action cache for vcpkg
  • Loading branch information
magnesj authored Aug 14, 2024
1 parent 3fbe383 commit 3fdb30d
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,20 @@ on:
# Once every night
- cron: "0 1 * * *"

env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"

jobs:
ResInsight-x64-buildcache:
runs-on: ${{ matrix.config.os }}
ResInsight-clang-tidy:
runs-on: ubuntu-22.04
continue-on-error: true
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu 22.04",
os: ubuntu-22.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@v4
with:
submodules: true

- name: Install Linux dependencies
if: ${{contains( matrix.config.os, 'ubuntu') }}
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
Expand All @@ -49,20 +38,23 @@ jobs:
dir: "${{ github.workspace }}/Qt/"
cache: true
modules: "qtnetworkauth"

- name: Run vcpkg
uses: lukka/run-vcpkg@v7
id: runvcpkg

- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
vcpkgArguments: "@${{ github.workspace }}/${{ matrix.config.vcpkg-response-file }}"
vcpkgDirectory:
"${{ github.workspace }}/ThirdParty/vcpkg"
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=${{ matrix.config.cmake-toolchain }} -DRESINSIGHT_USE_OPENMP=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
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
Expand Down

0 comments on commit 3fdb30d

Please sign in to comment.