Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHTA-60 add sonarqube integration #249

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: PR and main branch checks

on:
workflow_dispatch:
push:
branches:
- 'main'
paths-ignore:
- 'README.md'
- 'docs/**'
- 'mkdocs.yml'
- 'LICENSE'
- 'getting_started.md'
- 'docker-compose.yml'
- 'playground/**'
- 'CNAME'
- 'requirements.txt'
pull_request:
paths-ignore:
- 'README.md'
- 'docs/**'
- 'mkdocs.yml'
- 'LICENSE'
- 'getting_started.md'
- 'docker-compose.yml'
- 'playground/**'
- 'CNAME'
- 'requirements.txt'

env:
go-version: '1.23.2'
golangci-lint-version: v1.60
sonar-project-key: GreenmaskIO_greenmask
sonar-org: greenmaskio
sonar-exclude-files: docker/**,.github/**,docs/**,playground/**,test/**,**/*_test.go

permissions:
contents: read

jobs:
tests:
uses: ./.github/workflows/tests.yml

build:
uses: ./.github/workflows/build.yml
needs:
- tests

code_check:
name: lint
runs-on: ubuntu-latest
needs:
- tests
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v5
with:
go-version: ${{ env.go-version }}

- uses: actions/cache/restore@v4
id: restore-cache
with:
path: coverage.out
key: ${{ runner.os }}-coverage-${{ github.sha }}

- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: ${{ env.golangci-lint-version }}

- name: SonarQube Scan
uses: SonarSource/sonarcloud-github-action@master
with:
args: >
-Dsonar.go.coverage.reportPaths=coverage.out
-Dsonar.projectKey=${{ env.sonar-project-key }}
-Dsonar.organization=${{ env.sonar-org }}
-Dsonar.exclusions=${{ env.sonar-exclude-files }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
45 changes: 0 additions & 45 deletions .github/workflows/pull_request.yml

This file was deleted.

22 changes: 10 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:
go-version: '1.23.2'

jobs:
unit-tests:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -18,23 +18,21 @@ jobs:
with:
go-version: ${{ env.go-version }}

- name: Run tests
run: make tests

integration-tests:
runs-on: ubuntu-latest
needs:
- unit-tests
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Run unit tests
run: make coverage

- uses: actions/cache/save@v4
id: coverage_file_cache
with:
path: coverage.out
key: ${{ runner.os }}-coverage-${{ github.sha }}

- name: Run integration tests
run: |
docker compose -f docker-compose-integration.yml -p greenmask up \
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ backward-compatible with existing PostgreSQL utilities, fast and reliable.
[![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/greenmaskio/greenmask/total)](https://somsubhra.github.io/github-release-stats/?username=greenmaskio&repository=greenmask&page=1&per_page=5)
[![Docker pulls](https://img.shields.io/docker/pulls/greenmask/greenmask)](https://hub.docker.com/r/greenmask/greenmask)
[![Go Report Card](https://goreportcard.com/badge/github.com/greenmaskio/greenmask)](https://goreportcard.com/report/github.com/greenmaskio/greenmask)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=GreenmaskIO_greenmask&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=GreenmaskIO_greenmask)

![schema.png](docs/assets/schema.png)

Expand Down