Files
CloudflareDNS-java/.github/workflows/build-and-test.yml
T
thischwa ae14436b08 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.
2025-03-24 15:07:12 +01:00

36 lines
1.0 KiB
YAML

name: Build and Test
on:
push:
branches:
- develop
- feature*
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
mvn-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4.5.0
with:
java-version: '17'
distribution: 'corretto'
- name: Cache maven repository
uses: actions/cache@v4.2.0
with:
path: ~/.m2/repository
key: maven
restore-keys: maven
- name: Build with Maven verify for sonar
env:
API_EMAIL: ${{ secrets.API_EMAIL }}
API_KEY: ${{ secrets.API_KEY }}
API_TOKEN: ${{ secrets.API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=th-schwarz_CloudflareDNS-jav