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

[MSMRC-2463] SonarQube enablement #110

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
55 changes: 55 additions & 0 deletions .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
on:
# Trigger analysis for pushes and pull requests
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

name: SonarQube
jobs:
ie_deploy_quality_gate:
runs-on: ubuntu-latest
if: github.event.pull_request.user.login != 'dependabot[bot]'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Fetch full history for better SCM information
fetch-depth: 0

# - name: Set up Go
# uses: actions/setup-go@v5
# with:
# go-version: "1.23.0"

# If necessary, include additional steps, such as installing dependencies.

# - name: Run Tests
# env:
# Add test environment variables if needed
# TEST_ENV_VAR1: value1
# TEST_ENV_VAR2: value2
# run: |
# # Replace with your command which run tests and generates coverage report, e.g., `make test`
# <test_command>

# - name: Upload Coverage Report
# uses: actions/upload-artifact@v4
# with:
# name: coverage-report
# path: coverage.out
# Adjust to the path of your coverage report (name has to be the same as in sonar-project.properties file)

- name: Run SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # add these secrets to GitHub
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

- name: Quality Gate Check
uses: sonarsource/sonarqube-quality-gate-action@master
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
36 changes: 36 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Server and project configuration
sonar.host.url=https://sonar.wpengine.io/
sonar.projectVersion=1.0-beta
sonar.sourceEncoding=UTF-8
sonar.scm.provider=git

# Project identifiers
sonar.projectName=base-images-public
sonar.projectKey=wpengine_base-images-public_28b2728e-ae21-4512-ae17-20ed7584dd99

# Individual configurations
# e.g., go, java, js, php

sonar.language=ruby

# Paths to source code directories (use relative paths)

# sonar.sources=cmd, pkg

# Additional parameters for advanced configurations
# Common exclusion patterns

# sonar.exclusions=**/*_test.*, **/mocks/**, **/node_modules/**

# Paths to test code directories (use relative paths)

# sonar.tests=.

# Adjust for your language

# sonar.test.inclusions=**/*_test.go

# Coverage report configuration
# sonar.coverage.exclusions=
# sonar.go.coverage.reportPaths=coverage.out
# example path for javascript and lcov coverage report: sonar.javascript.lcov.reportPaths=coverage/lcov.info