Skip to content

GH Actions CI reporting #235

GH Actions CI reporting

GH Actions CI reporting #235

Workflow file for this run

name: GH Actions CI reporting
on:
workflow_run:
workflows: [ "GH Actions CI" ]
types: [ completed ]
defaults:
run:
shell: bash
env:
MAVEN_ARGS: "-e -B --settings .github/mvn-settings.xml --fail-at-end"
jobs:
publish-build-scans:
name: Publish Develocity build scans
if: github.repository == 'hibernate/hibernate-search' && github.event.workflow_run.conclusion != 'cancelled'
runs-on: ubuntu-latest
steps:
# Checkout target branch which has trusted code
- name: Check out target branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
with:
persist-credentials: false
ref: ${{ github.ref }}
- name: Set up Java 21
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # 4.6.0
with:
java-version: 21
distribution: temurin
# https://github.com/actions/cache/blob/main/examples.md#java---maven
- name: Cache local Maven repository
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # 4.2.0
with:
path: ~/.m2/repository
# use a different key than workflows running untrusted code
key: trusted-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
trusted-${{ runner.os }}-maven-
- name: Set up Maven
run: ./mvnw -v
- name: Download GitHub Actions artifacts for the Develocity build scans
id: downloadBuildScan
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8
with:
pattern: build-scan-data-*
github-token: ${{ github.token }}
repository: ${{ github.repository }}
run-id: ${{ github.event.workflow_run.id }}
path: /tmp/downloaded-build-scan-data/
# Don't fail the build if there are no matching artifacts
continue-on-error: true
- name: Publish Develocity build scans for previous builds
if: ${{ steps.downloadBuildScan.outcome != 'failure'}}
run: |
shopt -s nullglob # Don't run the loop below if there are no artifacts
status=0
mkdir -p ~/.m2/.develocity/
for build_scan_data_directory in /tmp/downloaded-build-scan-data/*
do
rm -rf ~/.m2/.develocity/build-scan-data
mv "$build_scan_data_directory" ~/.m2/.develocity/build-scan-data \
&& ./mvnw $MAVEN_ARGS develocity:build-scan-publish-previous || status=1
done
exit $status
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY_PR }}