Skip to content

[skip-ci] Update to allow clazy-standalone runs too #704

[skip-ci] Update to allow clazy-standalone runs too

[skip-ci] Update to allow clazy-standalone runs too #704

Workflow file for this run

name: Clang-Tidy Static Analysis
on:
[pull_request, workflow_dispatch]
env:
FEATURES: -DUSE_VTK=ON -DBUILD_GPL_PLUGINS=ON -DWITH_COORDGEN=OFF -DUSE_YAEHMOP=ON
BUILD_TYPE: RelWithDebInfo
QT_VERSION: 5.15.2
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu Analysis",
os: ubuntu-latest,
cc: "clang", cxx: "clang++",
cmake_flags: "-G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DUSE_SYSTEM_LIBXML2=ON -USE_SYSTEM_ZLIB=ON",
cpack: "",
}
steps:
- name: Install Dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo add-apt-repository -y universe
sudo apt-get -qq update
sudo apt-get -qq install ninja-build bear libeigen3-dev libboost-all-dev libglew-dev libxml2-dev
sudo apt-get -qq install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5x11extras5-dev libqt5svg5-dev
sudo apt-get -qq install clang-tidy clazy
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
cache: true
version: ${{ env.QT_VERSION }}
- name: Checkout openchemistry
uses: actions/checkout@v4
with:
repository: openchemistry/openchemistry
submodules: recursive
- name: Checkout avogadroapp
uses: actions/checkout@v4
with:
repository: openchemistry/avogadroapp
path: avogadroapp
- name: Checkout avogadrolibs
uses: actions/checkout@v4
with:
path: avogadrolibs
fetch-depth: 2
- name: Grab cache files
uses: actions/cache@v4
if: runner.os != 'Windows'
with:
path: |
${{ runner.workspace }}/build/thirdparty
${{ runner.workspace }}/build/Downloads
key: ${{ matrix.config.name }}-thirdparty
- name: Configure
run: |
if [ ! -d "${{ runner.workspace }}/build" ]; then mkdir "${{ runner.workspace }}/build"; fi
cd "${{ runner.workspace }}/build"
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake $GITHUB_WORKSPACE ${{env.FEATURES}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{matrix.config.cmake_flags}}
shell: bash
- name: Build
run: |
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} ninja
# only re-compile avogadrolibs
(cd avogadrolibs; ninja clean)
bear -- ninja
shell: bash
working-directory: ${{ runner.workspace }}/build
- name: Create results directory
run: |
mkdir ${{ runner.workspace }}/clang-tidy-result
# let's try manually running clazy
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
- name: Analyze
run: |
# generate the fixes and we'll make a diff
run-clang-tidy -p ../build -fix
cd avogadrolibs
pwd
echo "Generating diff"
git diff >${{ runner.workspace }}/clang-tidy-result/tidy.patch
working-directory: ${{ runner.workspace }}/avogadrolibs
- name: Save PR metadata
run: |
echo ${{ github.event.number }} > ${{ runner.workspace }}/clang-tidy-result/pr-id.txt
echo ${{ github.event.pull_request.head.repo.full_name }} > ${{ runner.workspace }}/clang-tidy-result/pr-head-repo.txt
echo ${{ github.event.pull_request.head.ref }} > ${{ runner.workspace }}/clang-tidy-result/pr-head-ref.txt
- uses: actions/upload-artifact@v4
with:
name: clang-tidy-result
path: ${{ runner.workspace }}/clang-tidy-result/