add GHA pipeline for sonarqube test
This commit is contained in:
40
.github/workflows/sonarqube.yaml
vendored
40
.github/workflows/sonarqube.yaml
vendored
@@ -3,21 +3,25 @@ name: Build
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- '!main'
|
||||
- '!develop'
|
||||
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
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
|
||||
- uses: actions/setup-java@v4.2.2
|
||||
if: ${{ hashFiles('**/pom.xml') }}
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: zulu
|
||||
cache: 'maven'
|
||||
- name: Cache SonarQube packages
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
@@ -30,6 +34,36 @@ jobs:
|
||||
path: ~/.m2
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: ${{ runner.os }}-m2
|
||||
- name: maven-settings-xml-action
|
||||
uses: whelk-io/maven-settings-xml-action@v22
|
||||
with:
|
||||
profiles: >
|
||||
[{
|
||||
"id": "homelab",
|
||||
"properties": {
|
||||
"altSnapshotDeploymentRepository": "nexus-snapshot::${env.SNAPSHOT_DEPLOYMENT_REPOSITORY_URL}",
|
||||
"altReleaseDeploymentRepository": "nexus-release::${env.RELEASE_DEPLOYMENT_REPOSITORY_URL}"
|
||||
}
|
||||
}]
|
||||
repositories: >
|
||||
[{
|
||||
"id": "maven-public",
|
||||
"url": "${env.MAVEN_PUBLIC_REPOSITORY_URL}",
|
||||
"snapshots": {
|
||||
"enabled": "true"
|
||||
}
|
||||
}]
|
||||
servers: >
|
||||
[{
|
||||
"id": "nexus-snapshot",
|
||||
"username": "${env.NEXUS_USERNAME}",
|
||||
"password": "${env.NEXUS_PASSWORD}"
|
||||
},
|
||||
{
|
||||
"id": "nexus-release",
|
||||
"username": "${env.NEXUS_USERNAME}",
|
||||
"password": "${env.NEXUS_PASSWORD}"
|
||||
}]
|
||||
- name: Build and analyze
|
||||
env:
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user