diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml deleted file mode 100644 index 3d7b770a..00000000 --- a/.github/workflows/run-test.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: "Test cpp-linter-action" - -on: - # push: - # branches: main - # paths-ignore: "docs/**" - pull_request_target: - branches: main - paths-ignore: "docs/**" - workflow_dispatch: - -jobs: - add-tag: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ github.token }} - - name: retag latest commit for testing - run: | - git config user.name 'github-actions' - git config user.email '41898282+github-actions[bot]@users.noreply.github.com' - git tag --delete latest || true - git push --delete origin latest || true - git tag -a latest -m 'Retag latest commit' - git push origin latest - - call-test-action: - uses: cpp-linter/test-cpp-linter-action/.github/workflows/cpp-lint-action.yml@master - secrets: inherit - needs: add-tag diff --git a/.github/workflows/self-test.yml b/.github/workflows/self-test.yml new file mode 100644 index 00000000..725a8773 --- /dev/null +++ b/.github/workflows/self-test.yml @@ -0,0 +1,59 @@ +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/**') }} + + - 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|venv + database: build + verbosity: debug + version: ${{ matrix.clang-version }} + thread-comments: ${{ matrix.clang-version == '12' && 'update' }} + file-annotations: ${{ runner.os == 'Linux' && matrix.clang-version == '12' }} + step-summary: ${{ 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 diff --git a/docs/examples/demo/CMakeLists.txt b/docs/examples/demo/CMakeLists.txt new file mode 100644 index 00000000..c618c927 --- /dev/null +++ b/docs/examples/demo/CMakeLists.txt @@ -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})