Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 44 additions & 18 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ on:
push:
branches:
- main
# for PRs from forked repos and non forked repos
# in order to write status info to the PR we require write repository token (https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/)
pull_request_target:
pull_request:
branches:
- main
types: [opened, synchronize, reopened]

# restrict privileges except for setting commit status, adding PR comments and writing statuses
permissions:
Expand All @@ -30,11 +27,11 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
jdk: [11, 17]
jdk: [11, 17, 21, 25]
include:
# lengthy build steps should only be performed on linux with Java 11 (SonarQube analysis, deployment)
# lengthy build steps should only be performed on linux with Java 21 (SonarQube analysis, deployment)
- os: ubuntu-latest
jdk: 11
jdk: 21
isMainBuildEnv: true
namePrefix: 'Main '
fail-fast: false
Expand All @@ -44,16 +41,13 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
# always act on the modified source code (even for event pull_request_target)
# is considered potentially unsafe (https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) but actions are only executed after approval from committers
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
# no additional git operations after checkout triggered in workflow, no need to store credentials
persist-credentials: false

- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v5
with:
cache: 'maven'
distribution: 'temurin'
Expand All @@ -68,11 +62,11 @@ jobs:
shell: bash
run: |
if [ "${{ matrix.isMainBuildEnv }}" = "true" ]; then
echo "MVN_ADDITIONAL_OPTS=-Dsonar.projectKey=Netcentric_aem-cloud-validator -Dsonar.organization=netcentric -Dsonar.host.url=https://sonarcloud.io -Pjacoco-report" >> $GITHUB_ENV
echo "MVN_ADDITIONAL_OPTS=-Dsonar.projectKey=Netcentric_aem-cloud-validator -Dsonar.organization=netcentric -Dsonar.host.url=https://sonarcloud.io -Pjacoco-report -Dsonar.scanner.skipJreProvisioning=true" >> $GITHUB_ENV
if [ "${{github.ref}}" = "refs/heads/main" ] && [ "${{github.event_name}}" = "push" ]; then
echo "MAVEN_USERNAME=${{ secrets.OSSRH_TOKEN_USER }}" >> $GITHUB_ENV
echo "MAVEN_PASSWORD=${{ secrets.OSSRH_TOKEN_PASSWORD }}" >> $GITHUB_ENV
echo "MVN_GOAL=clean deploy org.sonarsource.scanner.maven:sonar-maven-plugin:sonar" >> $GITHUB_ENV
echo "MVN_GOAL=clean deploy org.sonarsource.scanner.maven:sonar-maven-plugin:5.5.0.6356:sonar" >> $GITHUB_ENV
echo "STEP_NAME_SUFFIX=(Deploys to OSSRH)" >> $GITHUB_ENV
else
echo "MVN_GOAL=clean verify" >> $GITHUB_ENV
Expand All @@ -87,8 +81,40 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -e -B -V ${{ env.MVN_GOAL }} ${{ env.MVN_ADDITIONAL_OPTS }}

- name: Publish Test Report
if: ${{ always() }} # make sure to run even if previous Maven execution failed (due to failed test)
uses: scacap/action-surefire-report@v1
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v7
with:
check_name: Test report (${{ matrix.os }}, JDK ${{ matrix.jdk }})
name: Test Results (${{ matrix.os }}, JDK ${{ matrix.jdk }}))
path: |
target/surefire-reports/TEST*.xml
target/invoker-reports/TEST*.xml
target/it/**/build.log

publish-test-results:
name: "Publish Tests Results"
needs: build
runs-on: ubuntu-latest
permissions:
checks: write

# only needed unless run with comment_mode: off
pull-requests: write

# only needed for private repository
contents: read

# only needed for private repository
issues: read
if: always()

steps:
- name: Download Artifacts
uses: actions/download-artifact@v8
with:
path: artifacts

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@c950f6fb443cb5af20a377fd0dfaa78838901040
with:
files: "artifacts/**/*.xml"
43 changes: 26 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,60 +129,60 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.0</version>
<version>3.5.5</version>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.1.0</version>
<version>3.5.5</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<version>3.15.0</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.1</version>
<version>3.1.4</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.1</version>
<version>3.1.4</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<version>3.5.0</version>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.2.0</version>
<version>3.5.0</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<version>3.5.0</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.5.0</version>
<version>3.12.0</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<version>3.4.0</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>3.0.0</version>
<version>3.3.1</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.5.0</version>
<version>3.10.0</version>
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.3.0</version>
<version>3.6.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<version>3.2.8</version>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
Expand All @@ -192,16 +192,16 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.0.1</version>
<version>2.7.1</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.10</version>
<version>0.8.14</version>
</plugin>
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.5.1</version>
<version>3.9.1</version>
</plugin>
</plugins>
</pluginManagement>
Expand All @@ -228,6 +228,15 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessors>
<!-- generate META-INF/services-->
<annotationProcessor>org.kohsuke.metainf_services.AnnotationProcessorImpl</annotationProcessor>
</annotationProcessors>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
Expand Down
Loading