diff --git a/.github/release-please/config.json b/.github/release-please/config.json index b3e5051..f17208d 100644 --- a/.github/release-please/config.json +++ b/.github/release-please/config.json @@ -16,6 +16,7 @@ ".": {} }, "extra-files": [ - "README.md" + "README.md", + "sonar-project.properties" ] } diff --git a/.github/workflows/snapshot.yaml b/.github/workflows/snapshot.yaml index 2972b9d..2dd03e3 100644 --- a/.github/workflows/snapshot.yaml +++ b/.github/workflows/snapshot.yaml @@ -7,41 +7,6 @@ on: jobs: - test: - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - - - name: Run tests - run: | - go test \ - -race \ - -count=1 \ - -vet=all \ - -timeout 3m \ - -coverpkg=./... \ - -covermode=atomic \ - -coverprofile=coverage.out \ - ./... - go tool cover \ - -html=coverage.out \ - -o coverage.html - - - name: Upload assets - uses: actions/upload-artifact@v4 - with: - name: coverage - path: coverage.* - build: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..aa659a5 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,50 @@ +name: test + +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] + +jobs: + + test: + runs-on: ubuntu-latest + steps: + + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Run tests + run: | + go test \ + -race \ + -count=1 \ + -vet=all \ + -timeout 3m \ + -coverpkg=./... \ + -covermode=atomic \ + -coverprofile=coverage.out \ + ./... + go tool cover \ + -html=coverage.out \ + -o coverage.html + + - name: SonarCloud Scan + uses: SonarSource/sonarqube-scan-action@v5.1.0 + env: + SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} + + - name: Upload assets + uses: actions/upload-artifact@v4 + with: + name: coverage + path: coverage.* diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..0127694 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,11 @@ +sonar.organization=firebolt-db +sonar.projectKey=firebolt-db_mcp-server +sonar.projectName=firebolt-db/mcp-server +sonar.projectVersion=0.2.0 # x-release-please-version + +sonar.sources=. +sonar.exclusions=**/*_test.go,cmd/docs-scrapper/** + +sonar.tests=. +sonar.test.inclusions=**/*_test.go +sonar.go.coverage.reportPaths=coverage.out