Skip to content

Commit

Permalink
Add analysis workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-PLACET committed Apr 3, 2024
1 parent 8236875 commit 7d7927c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: cpp-linter

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
tool: [clang-format, clang-tidy, cppcheck]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set conda environment
uses: mamba-org/setup-micromamba@main
with:
environment-name: myenv
environment-file: environment-dev.yml
init-shell: bash
cache-downloads: true

- name: Configure using CMake
run: cmake -G Ninja -Bbuild -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DBUILD_TESTS=ON

- name: Run C++ analysis
uses: cpp-linter/cpp-linter-action@v2
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: 18
lines-changed-only: true
database: 'build/compile_commands.json'
style: 'file' # Use .clang-format config file
tidy-checks: '-*' # disable clang-tidy checks.
10 changes: 1 addition & 9 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ jobs:
if: matrix.sys.compiler == 'clang'
run: sudo apt install ${{matrix.sys.stdlib}}-dev -y


- name: Checkout code
uses: actions/checkout@v3

Expand All @@ -61,9 +60,7 @@ jobs:
cache-downloads: true

- name: Configure using CMake
run: |
activate_linter=${{ matrix.sys.compiler == 'clang' && 'ON' || 'OFF' }}
cmake -G Ninja -Bbuild ${{matrix.sys.config-flags}} -DCMAKE_BUILD_TYPE:STRING=${{matrix.config.name}} -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DBUILD_TESTS=ON -DACTIVATE_LINTER=$activate_linter
run: cmake -G Ninja -Bbuild ${{matrix.sys.config-flags}} -DCMAKE_BUILD_TYPE:STRING=${{matrix.config.name}} -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DBUILD_TESTS=ON

- name: Install
working-directory: build
Expand All @@ -76,8 +73,3 @@ jobs:
- name: Run tests
working-directory: build
run: ctest -C ${{matrix.config.name}} --output-on-failure

- name: Run clang-format dry-run
if: matrix.sys.compiler == 'clang'
working-directory: build
run: cmake --build . --config ${{matrix.config.name}} --target clang-format_dry_run

0 comments on commit 7d7927c

Please sign in to comment.