Skip to content

Commit

Permalink
add sonar workflow config (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
dasco144 authored Sep 6, 2024
1 parent e975ef8 commit a5a6df2
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Sonar Report

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'

- name: Generate Sonar Report
run: go test -coverpkg=./... -coverprofile=coverage.out -json ./... > sonar-report.json

- name: Upload coverage reports to Sonar
uses: sonarsource/sonarcloud-github-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
12 changes: 12 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
sonar.organization = luno
sonar.projectKey = luno_depgraph
sonar.projectName = depgraph
sonar.links.scm = https://github.com/luno/depgraph

sonar.sources = .
sonar.exclusions=**/*_test.go, **/*pb.go
sonar.go.coverage.reportPaths = coverage.out
sonar.go.tests.reportPaths = sonar-report.json
sonar.tests = .
sonar.test.inclusions = **/*_test.go
sonar.test.exclusions=_examples/**/*, **/*pb.go

0 comments on commit a5a6df2

Please sign in to comment.