Skip to content

JBoss Roaster migration #327

JBoss Roaster migration

JBoss Roaster migration #327

Workflow file for this run

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Java CI with Maven
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
types: [opened, synchronize, reopened]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
checks: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for better SonarCloud analysis
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
cache: maven
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: mvn -B install -Pmetrics --file pom.xml
- name: Check for uncommitted generated source changes
if: github.event_name == 'pull_request'
run: |
echo "Checking for uncommitted generated source changes..."
# Check if there are any changes in generated-sources directories
if git diff --name-only HEAD | grep -E "target/generated-sources/"; then
echo "❌ ERROR: Found uncommitted generated source changes!"
echo ""
echo "The following generated files have changed:"
git diff --name-only HEAD | grep -E "target/generated-sources/" | sed 's/^/ /'
echo ""
echo "Please commit these changes to the repository:"
echo " git add target/generated-sources/"
echo " git commit -m \"Update generated sources\""
echo ""
exit 1
else
echo "✅ No uncommitted generated source changes found"
fi
- name: SonarCloud Analysis
# Skip for Dependabot PRs (no access to secrets)
if: github.actor != 'dependabot[bot]'
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B org.sonarsource.scanner.maven:sonar-maven-plugin:sonar --file pom.xml
- name: Upload JaCoCo HTML report (processor)
if: always()
uses: actions/upload-artifact@v4
with:
name: jacoco-report-html-processor
path: processor/target/site/jacoco/
if-no-files-found: warn
- name: Upload JaCoCo XML report (processor)
if: always()
uses: actions/upload-artifact@v4
with:
name: jacoco-report-xml-processor
path: processor/target/site/jacoco/jacoco.xml
if-no-files-found: warn
- name: Upload test results to Codecov (processor)
# Skip for Dependabot PRs (no access to secrets)
if: always() && github.actor != 'dependabot[bot]'
uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: |
processor/target/surefire-reports/*.xml
processor/target/failsafe-reports/*.xml
fail_ci_if_error: true
verbose: false
- name: Upload coverage to Codecov (processor)
# Skip for Dependabot PRs (no access to secrets)
if: always() && github.actor != 'dependabot[bot]'
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7
with:
fail_ci_if_error: true
files: processor/target/site/jacoco/jacoco.xml
flags: processor
name: codecov-upload
verbose: false
token: ${{ secrets.CODECOV_TOKEN }}