Skip to content

Commit

Permalink
feat: add sonar support
Browse files Browse the repository at this point in the history
  • Loading branch information
nunenuh committed Aug 23, 2023
1 parent be8fd0e commit a39996a
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: SonarCloud

on:
push:
branches: [ "main", "stag", "dev" ]
pull_request:
branches: [ "main", "stag", "dev" ]

jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
services:
postgres:
image: 'bitnami/postgresql:14.8.0'
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
POSTGRES_DB: iquote_fastapi
ports:
- 5432:5432

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.21.0' # Adjust to your desired Go version

- name: Install dependencies
run: go mod download

- name: Test with Go Test
run: go test -v ./... -coverprofile=coverage.out

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GH_ACTION_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_ORGANIZATION: nunenuh-github
14 changes: 14 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Basic project details
sonar.organization=nunenuh-github
sonar.projectKey=nunenuh_iquote-fiber
sonar.projectName=iquote-fiber
sonar.host.url=https://sonarcloud.io
sonar.projectVersion=0.1.0
sonar.sources=.

# Encoding
sonar.sourceEncoding=UTF-8

# Go specific properties
sonar.go.coverage.reportPaths=coverage.out
sonar.go.tests.reportPaths=coverage.out

0 comments on commit a39996a

Please sign in to comment.