Streamline SonarCloud scan step by using multiline syntax in GitHub Actions workflow.

This commit is contained in:
2026-03-08 11:11:30 +01:00
parent 4d7deb3f2c
commit 32618a942b
+41
View File
@@ -0,0 +1,41 @@
name: Build and Analyse
on:
push:
branches:
- develop
- feature*
pull_request:
types: [ opened, synchronize, reopened ]
defaults:
run:
shell: bash
jobs:
build-and-analyse:
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: Setup Java and Maven
uses: ./.github/actions/setup-java-maven
- name: Build and analyze with SonarCloud
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
run: |
echo "Running SonarCloud analysis..."
mvn -B -DtestClasspath=src/test/ verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=th-schwarz_CloudflareDNS-java
- name: Publish Test Report
uses: ./.github/actions/publish-report/
if: ${{ always() }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
report-name: Summary of JUnit Tests