Skip to content

Commit

Permalink
ci: clang-tidy: Add clang-tidy job
Browse files Browse the repository at this point in the history
Experimental job to enable clang-tidy. This action should only run
against the changes made in the PR.

This closes bpftrace#2971.
  • Loading branch information
danobi committed Jan 30, 2024
1 parent ee95f08 commit ccb8916
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/tidy.yml
@@ -0,0 +1,41 @@
name: "Clang Tidy"

on:
pull_request:
branches: [ "master" ]

# Cancel previous run if a new one is started
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
pull-requests: write

steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2

- name: Generate compile_commands.json and headers
run: |
mkdir $GITHUB_WORKSPACE/build && cd $GITHUB_WORKSPACE/build
nix develop --command cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=1
nix develop --command make -j$(nproc)
- name: Run clang-tidy
uses: ZedThree/clang-tidy-review@v0.17.1
id: review
with:
build_dir: build
lgtm_comment_body: ""

- name: Fail job if comments posted
if: steps.review.outputs.total_comments > 0
run: exit 1

0 comments on commit ccb8916

Please sign in to comment.