feat: Add sonar-qube workflow
This commit is contained in:
@@ -33,37 +33,6 @@ on:
|
|||||||
type: boolean
|
type: boolean
|
||||||
|
|
||||||
jobs:
|
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:
|
api-multi-module-workflow:
|
||||||
runs-on: custom
|
runs-on: custom
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -29,37 +29,6 @@ on:
|
|||||||
type: boolean
|
type: boolean
|
||||||
|
|
||||||
jobs:
|
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:
|
api-single-module-workflow:
|
||||||
runs-on: custom
|
runs-on: custom
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
40
.github/workflows/api-sonar-qube-workflow.yml
vendored
Normal file
40
.github/workflows/api-sonar-qube-workflow.yml
vendored
Normal 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
|
||||||
Reference in New Issue
Block a user