feat: Add sonar-qube workflow

This commit is contained in:
2023-04-07 12:51:40 +03:00
parent d492e134ee
commit 70be68e6f8
3 changed files with 40 additions and 62 deletions

View File

@@ -33,37 +33,6 @@ on:
type: boolean
jobs:
sonar-check:
name: SonarQube check
runs-on: custom
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Build and analyze (exclude test)
if: ${{ !inputs.IS_TEST_ENABLED }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_CAN_READ_PACKAGES || secrets.GH_DEPBOT_TOKEN_CAN_READ_PACKAGES }}
GITHUB_USERNAME: ${{ secrets.GH_USER_CAN_READ_PACKAGES || secrets.GH_DEPBOT_USER_CAN_READ_PACKAGES }}
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST_URL }}
run: ./gradlew build sonar --info -x test -p ${{ inputs.MODULE_NAME }}
- name: Build and analyze (include test)
if: ${{ inputs.IS_TEST_ENABLED }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_CAN_READ_PACKAGES || secrets.GH_DEPBOT_TOKEN_CAN_READ_PACKAGES }}
GITHUB_USERNAME: ${{ secrets.GH_USER_CAN_READ_PACKAGES || secrets.GH_DEPBOT_USER_CAN_READ_PACKAGES }}
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST_URL }}
run: ./gradlew build test sonar --info -p ${{ inputs.MODULE_NAME }}
api-multi-module-workflow:
runs-on: custom
steps:

View File

@@ -29,37 +29,6 @@ on:
type: boolean
jobs:
sonar-check:
name: SonarQube check
runs-on: custom
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Build and analyze (exclude test)
if: ${{ !inputs.IS_TEST_ENABLED }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_CAN_READ_PACKAGES || secrets.GH_DEPBOT_TOKEN_CAN_READ_PACKAGES }}
GITHUB_USERNAME: ${{ secrets.GH_USER_CAN_READ_PACKAGES || secrets.GH_DEPBOT_USER_CAN_READ_PACKAGES }}
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST_URL }}
run: ./gradlew build sonar --info -x test
- name: Build and analyze (include test)
if: ${{ inputs.IS_TEST_ENABLED }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_CAN_READ_PACKAGES || secrets.GH_DEPBOT_TOKEN_CAN_READ_PACKAGES }}
GITHUB_USERNAME: ${{ secrets.GH_USER_CAN_READ_PACKAGES || secrets.GH_DEPBOT_USER_CAN_READ_PACKAGES }}
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST_URL }}
run: ./gradlew build test sonar --info
api-single-module-workflow:
runs-on: custom
steps:

View File

@@ -0,0 +1,40 @@
on:
workflow_call:
inputs:
IS_TEST_ENABLED:
description: "Using for start test before pushing to ECR if value is true."
required: true
type: boolean
jobs:
sonar-check:
name: SonarQube check
runs-on: custom
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Build and analyze
if: ${{ !inputs.IS_TEST_ENABLED }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_CAN_READ_PACKAGES || secrets.GH_DEPBOT_TOKEN_CAN_READ_PACKAGES }}
GITHUB_USERNAME: ${{ secrets.GH_USER_CAN_READ_PACKAGES || secrets.GH_DEPBOT_USER_CAN_READ_PACKAGES }}
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST_URL }}
run: ./gradlew build sonar --info -x test
- name: Build, test and analyze
if: ${{ inputs.IS_TEST_ENABLED }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_CAN_READ_PACKAGES || secrets.GH_DEPBOT_TOKEN_CAN_READ_PACKAGES }}
GITHUB_USERNAME: ${{ secrets.GH_USER_CAN_READ_PACKAGES || secrets.GH_DEPBOT_USER_CAN_READ_PACKAGES }}
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST_URL }}
run: ./gradlew build test sonar --info