2024-10-22 10:21:25 -04:00
|
|
|
name: GH Actions CI reporting
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_run:
|
|
|
|
workflows: [ "GH Actions CI" ]
|
|
|
|
types: [ completed ]
|
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
publish-build-scans:
|
|
|
|
name: Publish Develocity build scans
|
|
|
|
if: github.repository == 'hibernate/hibernate-orm' && 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@v4
|
|
|
|
with:
|
|
|
|
persist-credentials: false
|
|
|
|
ref: ${{ github.ref }}
|
|
|
|
- name: Set up Java 17
|
|
|
|
uses: actions/setup-java@v4
|
|
|
|
with:
|
|
|
|
distribution: 'temurin'
|
|
|
|
java-version: '17'
|
2024-10-25 05:28:29 -04:00
|
|
|
|
|
|
|
- name: Generate cache key
|
|
|
|
id: cache-key
|
|
|
|
run: |
|
|
|
|
CURRENT_BRANCH="${{ github.repository != 'hibernate/hibernate-orm' && 'fork' || github.base_ref || github.ref_name }}"
|
|
|
|
CURRENT_MONTH=$(/bin/date -u "+%Y-%m")
|
|
|
|
CURRENT_DAY=$(/bin/date -u "+%d")
|
|
|
|
ROOT_CACHE_KEY="buildtool-cache"
|
|
|
|
echo "buildtool-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT
|
|
|
|
echo "buildtool-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT
|
|
|
|
echo "buildtool-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT
|
2024-10-25 06:27:06 -04:00
|
|
|
- name: Restore Maven/Gradle Dependency/Dist Caches
|
2024-10-22 10:21:25 -04:00
|
|
|
uses: actions/cache/restore@v4
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.m2/repository/
|
|
|
|
~/.m2/wrapper/
|
2024-10-25 06:27:06 -04:00
|
|
|
~/.gradle/caches/modules-2
|
2024-10-22 10:21:25 -04:00
|
|
|
~/.gradle/wrapper/
|
2024-10-25 05:28:29 -04:00
|
|
|
key: ${{ steps.cache-key.outputs.buildtool-cache-key }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ steps.cache-key.outputs.buildtool-monthly-branch-cache-key }}-
|
|
|
|
${{ steps.cache-key.outputs.buildtool-monthly-cache-key }}-
|
|
|
|
|
2024-10-22 10:21:25 -04:00
|
|
|
- name: Download GitHub Actions artifacts for the Develocity build scans
|
|
|
|
id: downloadBuildScan
|
|
|
|
uses: actions/download-artifact@v4
|
|
|
|
with:
|
2024-10-25 06:05:42 -04:00
|
|
|
pattern: build-scan-data-*
|
2024-10-22 10:21:25 -04:00
|
|
|
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
|
2024-10-28 06:56:45 -04:00
|
|
|
mkdir -p ~/.gradle/
|
2024-10-22 10:21:25 -04:00
|
|
|
for build_scan_data_directory in /tmp/downloaded-build-scan-data/*
|
|
|
|
do
|
|
|
|
rm -rf ~/.gradle/build-scan-data
|
2024-10-28 06:56:45 -04:00
|
|
|
mv "$build_scan_data_directory" ~/.gradle/build-scan-data \
|
2024-10-22 10:21:25 -04:00
|
|
|
&& ./gradlew --no-build-cache buildScanPublishPrevious || status=1
|
|
|
|
done
|
|
|
|
exit $status
|
|
|
|
env:
|
|
|
|
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY_PR }}
|