Merge pull request #296 from bric3/renovate/bnd #693
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. | |
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | |
name: Java CI with Gradle | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
concurrency: | |
group: ci-tests-${{ github.ref }}-1 | |
cancel-in-progress: true | |
env: | |
# https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request | |
GITHUB_PR_NUMBER: ${{github.event.pull_request.number}} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# - name: debug | |
# run: echo "${{ toJSON(github.event)}}" | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'zulu' | |
- name: Setup Gradle | |
id: setup-gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Build with Gradle | |
run: ./gradlew build --stacktrace | |
- name: Upload build reports | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: build-reports | |
path: "**/build/reports/*" | |
- name: Upload Test Report | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: junit-test-results | |
path: '**/build/test-results/test/TEST-*.xml' | |
retention-days: 1 | |
- name: Comment with build scan url | |
uses: actions/github-script@v7 | |
if: github.event_name == 'pull_request' && failure() | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '❌ ${{ github.workflow }} failed: ${{ steps.build.outputs.build-scan-url }}' | |
}) | |
- name: Publish snapshot when on master | |
if: success() && github.event_name != 'pull_request' && github.ref == 'refs/heads/master' | |
env: | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }} | |
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHUSERNAME }} | |
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHPASSWORD }} | |
run: ./gradlew publish -Ppublish.central=true -Psemver.stage=snapshot | |
# This job will update the PR with the JUnit report | |
# In order to be able to make the most of it this job in particular has | |
# augmented permissions. | |
junit-report: | |
name: JUnit Report | |
if: | | |
failure() | |
&& github.event_name == 'pull_request' | |
needs: [ build ] | |
permissions: | |
checks: write # for mikepenz/action-junit-report | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Test Report | |
uses: actions/download-artifact@v4 | |
with: | |
name: junit-test-results | |
- name: Publish Test Report | |
uses: mikepenz/action-junit-report@v5 | |
with: | |
check_name: Test Report | |
commit: ${{github.event.workflow_run.head_sha}} | |
report_paths: '**/build/test-results/test/TEST-*.xml' |