SC-32488 Add sq analysis (#67)

* SC-32488 Add sq analysis

* SC-32488 Fix analysis issues
This commit is contained in:
Stanislav
2025-10-16 16:02:11 +02:00
committed by GitHub
parent 174f8360a0
commit 95b1cc6c02
8 changed files with 137 additions and 11 deletions
+22
View File
@@ -0,0 +1,22 @@
name: CI
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
workflow_call:
jobs:
run-unit-tests:
uses: ./.github/workflows/unit-tests.yml
run-sqc-eu-analysis:
needs: run-unit-tests
uses: ./.github/workflows/sonar-scan.yml
with:
platform_name: "SQC-EU"
host_url: "https://sonarcloud.io"
vault_path: "development/kv/data/sonarcloud"
permissions:
id-token: write
contents: read
+46
View File
@@ -0,0 +1,46 @@
name: SonarQube Scan
on:
workflow_call:
inputs:
platform_name:
description: 'Platform name (e.g., Next, SQC-EU, SQC-US)'
required: true
type: string
host_url:
description: 'SonarQube Server/Cloud host URL'
required: true
type: string
vault_path:
description: 'Vault path to retrieve the Sonar token'
required: true
type: string
jobs:
sonar-scan:
name: Run ${{ inputs.platform_name }} Analysis
runs-on: github-ubuntu-latest-s
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Vault
id: secrets
uses: SonarSource/vault-action-wrapper@320bd31b03e5dacaac6be51bbbb15adf7caccc32 # 3.1.0
with:
secrets: |
${{ inputs.vault_path }} token | SONAR_TOKEN;
- name: Run SonarQube Analysis
uses: SonarSource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).SONAR_TOKEN }}
SONAR_HOST_URL: ${{ inputs.host_url }}
with:
args: >
-Dsonar.projectKey=SonarSource_sonarqube-quality-gate-action
-Dsonar.organization=sonarsource
-Dsonar.sources=script
-Dsonar.sourceEncoding=UTF-8
-Dsonar.sca.enabled=false
+56
View File
@@ -0,0 +1,56 @@
name: Unified Dogfooding scans
on:
schedule:
- cron: '0 4 * * 1' # Run weekly on Monday at 04:00 UTC
workflow_dispatch:
jobs:
run-ci:
name: CI
uses: ./.github/workflows/ci.yml
permissions:
id-token: write
contents: read
run-next-analysis:
name: Next Scan
needs: run-ci
uses: ./.github/workflows/sonar-scan.yml
with:
platform_name: "Next"
host_url: "https://next.sonarqube.com/sonarqube"
vault_path: "development/kv/data/next"
permissions:
id-token: write
contents: read
run-sqc-us-analysis:
name: SQC US Scan
needs: run-ci
uses: ./.github/workflows/sonar-scan.yml
with:
platform_name: "SQC-US"
host_url: "https://sonarqube.us"
vault_path: "development/kv/data/sonarqube-us"
permissions:
id-token: write
contents: read
run-iris:
name: IRIS
needs: [run-ci, run-next-analysis, run-sqc-us-analysis]
runs-on: github-ubuntu-latest-s
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Run IRIS Analysis
uses: SonarSource/unified-dogfooding-actions/run-iris@v1
with:
primary_project_key: SonarSource_sonarqube-quality-gate-action
primary_platform: "SQC-EU"
shadow1_project_key: SonarSource_sonarqube-quality-gate-action
shadow1_platform: "Next"
shadow2_project_key: SonarSource_sonarqube-quality-gate-action
shadow2_platform: "SQC-US"
@@ -1,21 +1,19 @@
name: QA
name: Unit Tests
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
workflow_call:
jobs:
run-unit-tests:
name: Run Unit Tests
runs-on: github-ubuntu-latest-s
steps:
- name: checkout action
uses: actions/checkout@v2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: main
fetch-depth: 0
- name: checkout bats-core
uses: actions/checkout@v2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: bats-core
repository: bats-core/bats-core
+1 -1
View File
@@ -1,3 +1,3 @@
.idea
.DS_Store
.vscode
+4
View File
@@ -0,0 +1,4 @@
{
"sonarQubeUri": "https://next.sonarqube.com/sonarqube",
"projectKey": "SonarSource_sonarqube-quality-gate-action"
}
+1 -1
View File
@@ -1,4 +1,4 @@
# SonarQube Quality Gate check [![QA](https://github.com/SonarSource/sonarqube-quality-gate-action/actions/workflows/run-qa.yml/badge.svg)](https://github.com/SonarSource/sonarqube-quality-gate-action/actions/workflows/run-qa.yml)
# SonarQube Quality Gate check [![CI](https://github.com/SonarSource/sonarqube-quality-gate-action/actions/workflows/ci.yml/badge.svg)](https://github.com/SonarSource/sonarqube-quality-gate-action/actions/workflows/ci.yml)
Check the Quality Gate of your code with [SonarQube Server](https://www.sonarsource.com/products/sonarqube/) or [SonarQube Community Build](https://www.sonarsource.com/open-source-editions/sonarqube-community-edition/) to ensure your code meets your own quality standards before you release or deploy new features.
+1 -1
View File
@@ -29,7 +29,7 @@ else
ceTaskUrl="$(sed -n 's/ceTaskUrl=\(.*\)/\1/p' "${metadataFile}")"
fi
if [ -z "${serverUrl}" ] || [ -z "${ceTaskUrl}" ]; then
if [[ -z "${serverUrl}" || -z "${ceTaskUrl}" ]]; then
echo "Invalid report metadata file."
exit 1
fi