diff --git a/.github/workflows/sonarlint.yml b/.github/workflows/sonarlint.yml new file mode 100644 index 0000000..15e7805 --- /dev/null +++ b/.github/workflows/sonarlint.yml @@ -0,0 +1,31 @@ +on: + # Trigger analysis when pushing in master or pull requests, and when creating + # a pull request. + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] +name: sonarlint +jobs: + sonarcloud: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + # Disabling shallow clone is recommended for improving relevancy of reporting + fetch-depth: 0 + - name: Install sonar-scanner and build-wrapper + uses: sonarsource/sonarcloud-github-c-cpp@v2 + - name: Run build-wrapper + run: | + mkdir build + cd build + cmake .. -DCMAKE_BUILD_TYPE=Debug -DCPPTRACE_BUILD_DEMO=On -DCPPTRACE_BUILD_TEST=On -DCMAKE_EXPORT_COMPILE_COMMANDS=On + make -j + cd .. + - name: Run sonar-scanner + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: sonar-scanner diff --git a/README.md b/README.md index 38f02c1..69aa30e 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,9 @@ [![build](https://github.com/jeremy-rifkin/cpptrace/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/jeremy-rifkin/cpptrace/actions/workflows/build.yml) [![test](https://github.com/jeremy-rifkin/cpptrace/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/jeremy-rifkin/cpptrace/actions/workflows/test.yml) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=jeremy-rifkin_cpptrace&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=jeremy-rifkin_cpptrace)
-[![Community Discord Link](https://img.shields.io/badge/Chat%20on%20(the%20very%20small)-Community%20Discord-blue?labelColor=2C3239&color=7289DA&style=flat&logo=discord&logoColor=959DA5)](https://discord.gg/7kv5AuCndG) +[![Community Discord Link](https://img.shields.io/badge/Chat%20on%20(the%20very%20small)-Community%20Discord-blue?labelColor=2C3239&color=7289DA&style=flat&logo=discord&logoColor=959DA5)](https://discord.gg/frjaAZvqUZ) Cpptrace is a simple, portable, and self-contained C++ stacktrace library supporting C++11 and greater on Linux, macOS, and Windows including MinGW and Cygwin environments. The goal: Make stack traces simple for once. @@ -94,7 +95,8 @@ if(WIN32) add_custom_command( TARGET your_target POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different - $ $ + $ + $ ) endif() ``` diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..7ea4cd8 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,8 @@ +sonar.organization=jeremy-rifkin +sonar.projectKey=jeremy-rifkin_cpptrace + +# relative paths to source directories. More details and properties are described +# in https://sonarcloud.io/documentation/project-administration/narrowing-the-focus/ +sonar.sources=src +sonar.sourceEncoding=UTF-8 +sonar.cfamily.compile-commands=build/compile_commands.json