Skip to content

Commit

Permalink
add a self test action
Browse files Browse the repository at this point in the history
  • Loading branch information
shenxianpeng committed Mar 22, 2024
1 parent aaa1ce7 commit 44e53dc
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/self-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Self test action

on:
push:
branches: main
paths-ignore: "docs/**"
pull_request:
branches: main
paths-ignore: "docs/**"

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:
- name: Checkout
uses: actions/checkout@v4

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

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

- name: Self test action
uses: ./
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
12 changes: 12 additions & 0 deletions docs/examples/demo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.15)

# Set the project name to your project name
project(demo C CXX)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

add_executable(demo_app
${CMAKE_BINARY_SOURCE_DIR}demo.hpp
${CMAKE_BINARY_SOURCE_DIR}demo.cpp
)
target_include_directories(demo_app PUBLIC ${CMAKE_BINARY_SOURCE_DIR})

0 comments on commit 44e53dc

Please sign in to comment.