Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create test-cpp-linter-action.yml #26

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/test-cpp-linter-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Test cpp-linter-action

on:
workflow_dispatch:
workflow_call:

jobs:
test:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
clang-version: ['9','10', '11', '12', '13', '14', '15', '16', '17', '18']
fail-fast: false

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
repository: cpp-linter/test-cpp-linter-action

- name: Cache the build artifacts
id: cache-build
uses: actions/cache@v4
with:
path: build
key: ${{ runner.os }}-${{ hashFiles('src/CMakeLists.txt', 'src/demo.cpp', 'src/demo.hpp') }}

- name: Generate compilation database
if: steps.cache-build.outputs.cache-hit != 'true'
run: mkdir build && cmake -Bbuild src

- name: Run linter as action
uses: cpp-linter/cpp-linter-action@latest
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
style: file
files-changed-only: false
# to ignore all build folder contents
ignore: build
database: build
verbosity: 9
version: ${{ matrix.clang-version }}
thread-comments: ${{ matrix.clang-version == '12' }}
file-annotations: ${{ matrix.clang-version == '12' }}
extra-args: -std=c++14 -Wall

- name: Fail fast?!
# if: steps.linter.outputs.checks-failed > 0
run: |
echo "some linter checks failed"
echo "${{ steps.linter.outputs.checks-failed }}"
echo "${{ env.checks-failed }}"
# for actual deployment
# run: exit 1