Skip to content

Commit

Permalink
refactor(ci): improved Sonarqube configuration (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
ardevd authored Feb 14, 2024
1 parent f997808 commit fc8df33
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Go",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/go:1-1.21-bookworm",
"image": "mcr.microsoft.com/devcontainers/go:1-1.22-bookworm",

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
go-version: '1.22'

- name: Build
run: go build -v ./cmd/flash/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
go-version: '1.22'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

permissions:
Expand All @@ -41,6 +40,17 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

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

- name: Run tests and generate coverage profile
run: go test ./... -coverprofile=coverage.prof

- name: Analyze with SonarQube

# You can pin the exact commit or the version.
Expand All @@ -57,7 +67,7 @@ jobs:
# mandatory
-Dsonar.projectKey=flash
# Comma-separated paths to directories containing main source files.
#-Dsonar.sources= # optional, default is project base directory
#-Dsonar.sources=.
# When you need the analysis to take place in a directory other than the one from which it was launched
#-Dsonar.projectBaseDir= # optional, default is .
# Comma-separated paths to directories containing test source files.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/ardevd/flash

go 1.21.1
go 1.22

require (
github.com/btcsuite/btcd/btcutil v1.1.5
Expand Down
7 changes: 7 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sonar.projectVersion=v0.0.1
sonar.sources=.
sonar.sourceEncoding=UTF-8
sonar.language=go

sonar.exclusions=**/*_test.go,*.py
sonar.go.coverage.reportPaths=./coverage.prof

0 comments on commit fc8df33

Please sign in to comment.