diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000000..fa54b84016a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,15 @@ +name: Build +on: workflow_dispatch +jobs: + sonarcloud: + name: SonarCloud + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000000..e3f8bc17326 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,19 @@ +sonar.organization=elastic-1 +sonar.projectKey=elastic-agent +sonar.host.url=https://sonarcloud.io + +sonar.sources=. +sonar.exclusions=**/*_test.go, .git/**, dev-tools/**, /magefile.go, changelog/**, _meta/**, deploy/**, docs/**, img/** +sonar.tests=. +sonar.test.inclusions=**/*_test.go + +sonar.go.tests.reportPaths=build/TEST-go-unit.out.json +sonar.go.coverage.reportPaths=**/build/TEST-*.cov +sonar.go.exclusions=**/vendor/**,**/*_mock.go + +sonar.sourceEncoding=UTF-8 + +#Prevent C analysis +sonar.c.file.suffixes=- +sonar.cpp.file.suffixes=- +sonar.objc.file.suffixes=-