pull/576/head
Brad House 1 year ago committed by GitHub
parent be8706cb36
commit c00c208cb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 33
      .github/workflows/sonarcloud.yml
  2. 15
      sonar-project.properties

@ -0,0 +1,33 @@
# Copyright (C) The c-ares project and its contributors
# SPDX-License-Identifier: MIT
name: SonarCloud
on:
push:
branches:
- main
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 # Directory where build-wrapper output will be placed
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2
- name: Run build-wrapper
run: |
mkdir build
cmake -DCARES_BUILD_TESTS=ON -S . -B build
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build/ --config Release
- 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 }}"

@ -0,0 +1,15 @@
# Copyright (C) The c-ares project and its contributors
# SPDX-License-Identifier: MIT
sonar.projectKey=c-ares_c-ares
sonar.organization=c-ares
# This is the name and version displayed in the SonarCloud UI.
sonar.projectName=c-ares
sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
sonar.sources=.
sonar.tests=test/
# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8
Loading…
Cancel
Save