Simplify and merge Maven build and SonarCloud scan steps
Consolidated the Maven build and SonarCloud analysis into a single step for efficiency. Removed redundant workflow definitions and ensured proper environment variable handling. This change reduces complexity and streamlines the CI/CD workflow.
This commit is contained in:
@@ -26,34 +26,11 @@ jobs:
|
|||||||
path: ~/.m2/repository
|
path: ~/.m2/repository
|
||||||
key: maven
|
key: maven
|
||||||
restore-keys: maven
|
restore-keys: maven
|
||||||
- name: Build with Maven and Test
|
- name: Build with Maven verify for sonar
|
||||||
env:
|
env:
|
||||||
API_EMAIL: ${{ secrets.API_EMAIL }}
|
API_EMAIL: ${{ secrets.API_EMAIL }}
|
||||||
API_KEY: ${{ secrets.API_KEY }}
|
API_KEY: ${{ secrets.API_KEY }}
|
||||||
API_TOKEN: ${{ secrets.API_TOKEN }}
|
API_TOKEN: ${{ secrets.API_TOKEN }}
|
||||||
run: mvn clean test
|
|
||||||
|
|
||||||
sonarcloud-scan:
|
|
||||||
needs: mvn-test
|
|
||||||
name: Build and analyze with sonarcloud
|
|
||||||
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@v4.5.0
|
|
||||||
with:
|
|
||||||
distribution: 'corretto'
|
|
||||||
java-version: '17'
|
|
||||||
- name: Cache maven repository
|
|
||||||
uses: actions/cache@v4.2.0
|
|
||||||
with:
|
|
||||||
path: ~/.m2/repository
|
|
||||||
key: maven
|
|
||||||
restore-keys: maven
|
|
||||||
- name: Build and analyze
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=th-schwarz_DynDRest #-Dsonar.projectName=DynDRest
|
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=th-schwarz_CloudflareDNS-jav
|
||||||
Reference in New Issue
Block a user