diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml new file mode 100644 index 0000000..71275dc --- /dev/null +++ b/.github/workflows/sonarcloud.yml @@ -0,0 +1,41 @@ +name: SonarCloud +on: + push: + branches: + - master + pull_request: + types: + - opened + - synchronize + - reopened +jobs: + build: + name: Build and analyze + runs-on: ubuntu-latest + env: + BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory + CC: clang-17 + CXX: clang++-17 + steps: + - name: Check out code + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + + - name: Install dependencies + uses: ./.github/actions/install-dependencies + + - name: Install sonar-scanner and build-wrapper + uses: SonarSource/sonarcloud-github-c-cpp@v2.0.2 + + - name: Run build-wrapper + run: | + cmake -B build -DCMAKE_BUILD_TYPE=MinSizeRel + build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build + + - name: Run sonar-scanner + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..a77e49e --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,4 @@ +sonar.projectKey=sjinks_tfhttp +sonar.organization=wildwolf +sonar.sources=src +sonar.sourceEncoding=UTF-8