Skip to content

Commit

Permalink
replace C linter with clang-tidy CI (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale authored May 16, 2024
1 parent 755b5d5 commit dc11317
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 45 deletions.
45 changes: 0 additions & 45 deletions .github/workflows/c-linter.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "clang-tidy"

on: [pull_request]

concurrency:
group: ${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
clang_tidy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Get submodules
run: |
git submodule update --init
cd external/Microphysics
git fetch; git checkout development
echo "MICROPHYSICS_HOME=$(pwd)" >> $GITHUB_ENV
cd ../amrex
git fetch; git checkout development
echo "AMREX_HOME=$(pwd)" >> $GITHUB_ENV
cd ../..
- name: Install dependencies
run: |
.github/workflows/dependencies_clang-tidy-apt-llvm.sh 17
- name: Compile wdconvect
run: |
echo $AMREX_HOME
echo $MICROPHYSICS_HOME
cd Exec/science/wdconvect
make USE_MPI=FALSE USE_OMP=FALSE USE_CLANG_TIDY=TRUE CLANG_TIDY=clang-tidy-17 CLANG_TIDY_WARN_ERROR=TRUE -j 4
22 changes: 22 additions & 0 deletions .github/workflows/dependencies_clang-tidy-apt-llvm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

set -eu -o pipefail

# `man apt.conf`:
# Number of retries to perform. If this is non-zero APT will retry
# failed files the given number of times.
echo 'Acquire::Retries "3";' | sudo tee /etc/apt/apt.conf.d/80-retries

if [[ ! -f /etc/apt/trusted.gpg.d/apt.llvm.org.asc ]]; then
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
fi

source /etc/os-release # set UBUNTU_CODENAME

sudo add-apt-repository "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME} main"
sudo add-apt-repository "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}-$1 main"

sudo apt-get update

sudo apt-get install -y --no-install-recommends \
clang-tidy-$1 libomp-$1-dev

0 comments on commit dc11317

Please sign in to comment.