Files
jwt-cpp/.github/workflows/lint.yml
Chris Mc 3e037df3e6 🧹 Improve linters for traits (#424)
* quick poc at using cmake to generate the defaults.h traits files

* add test preset to dev

* self review

* poc moving logic to actions

* Remove stale defaults.h generation configuration

* Fix file path in lint workflow configuration

* chmod +x

* linter

* linter

* clean up action and lint workflow

* rm source_dir cli arg from cmake script

now just assume the current directory is correct

* linter

* fix order

* add workflow preset for running unit test

sadly then is less reusable than i wanted
2026-03-24 18:11:15 -07:00

83 lines
2.2 KiB
YAML

name: Lint CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
clang-format:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
files:
- "include/jwt-cpp/*.h"
- "include/jwt-cpp/traits/**/*.h"
- "tests/*.cpp"
- "tests/**/*.cpp"
- "example/*.cpp"
- "example/**/*.cpp"
steps:
- run: |
sudo apt-get install clang-format-14
shopt -s globstar
- uses: actions/checkout@v4
- run: clang-format-14 -i ${{ matrix.files }}
- uses: ./.github/actions/process-linting-results
with:
linter_name: clang-format
cmake-format:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
files: ["**/CMakeLists.txt", "cmake/code-coverage.cmake", "cmake/generate-defaults-h.cmake"]
steps:
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- run: pip install cmakelang
- run: shopt -s globstar
- uses: actions/checkout@v4
- run: cmake-format -i ${{ matrix.files }}
- uses: ./.github/actions/process-linting-results
with:
linter_name: cmake-format
clang-tidy:
runs-on: ubuntu-latest
steps:
- uses: lukka/get-cmake@latest
- uses: actions/checkout@v4
- name: configure
run: cmake --preset examples -DCMAKE_CXX_CLANG_TIDY="clang-tidy;-fix"
- name: run
run: cmake --build --preset examples
- uses: ./.github/actions/process-linting-results
with:
linter_name: clang-tidy
generate-defaults:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- run: sudo apt-get install clang-format-14
- uses: ./.github/actions/generate-defaults-dot-h
- run: clang-format-14 -i include/jwt-cpp/traits/*/*.h
- run: git add include/jwt-cpp/traits/*/*.h
- uses: ./.github/actions/process-linting-results
with:
linter_name: generate-defaults
line-ending:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: git add --renormalize .
- uses: ./.github/actions/process-linting-results
with:
linter_name: line-ending