-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f9450a
commit 062905f
Showing
1 changed file
with
29 additions
and
28 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,10 @@ jobs: | |
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
- name: Set up Maven | ||
uses: gradle/develocity-actions/[email protected] | ||
with: | ||
develocity-access-key: ${{ secrets.DV_SOLUTIONS_ACCESS_KEY }} | ||
- name: Setup Node.js and Npm | ||
uses: actions/setup-node@v4 | ||
with: | ||
|
@@ -41,31 +45,28 @@ jobs: | |
projectDir: build-caching-maven-samples | ||
goals: verify | ||
args: -B | ||
env: | ||
DEVELOCITY_ACCESS_KEY: "${{ secrets.DV_SOLUTIONS_ACCESS_KEY }}" | ||
- name: Verify goal outcomes | ||
run: | | ||
buildScanIdFirstBuild="$(echo "${{ steps.build.outputs.buildScanFirstBuild }}" | rev | cut -d/ -f1 | rev )" | ||
buildScanIdSecondBuild="$(echo "${{ steps.build.outputs.buildScanSecondBuild }}" | rev | cut -d/ -f1 | rev )" | ||
echo "$buildScanIdFirstBuild" | ||
echo "$buildScanIdSecondBuild" | ||
mavenBuildCachePerformanceFirstBuild="$(curl -vs -H "Authorization: Bearer $DEVELOCITY_ACCESS_KEY" "$DEVELOCITY_URL/api/builds/$buildScanIdFirstBuild/maven-build-cache-performance")" | ||
mavenBuildCachePerformanceSecondBuild="$(curl -vs -H "Authorization: Bearer $DEVELOCITY_ACCESS_KEY" "$DEVELOCITY_URL/api/builds/$buildScanIdSecondBuild/maven-build-cache-performance")" | ||
echo "$mavenBuildCachePerformanceFirstBuild" | ||
echo "$mavenBuildCachePerformanceSecondBuild" | ||
hasMisconfiguredCacheableGoals="$(echo "$mavenBuildCachePerformanceFirstBuild" | jq '[.goalExecution[] | select(.nonCacheabilityCategory != "goal_not_supported" and .nonCacheabilityCategory != null)] | length')" | ||
hasExecutedCacheableGoals="$(echo "$mavenBuildCachePerformanceSecondBuild" | jq '[.goalExecution[] | select(.avoidanceOutcome == "executed_cacheable")] | length')" | ||
echo "$hasMisconfiguredCacheableGoals" | ||
echo "$hasExecutedCacheableGoals" | ||
exitCode=0 | ||
if [[ "$hasMisconfiguredCacheableGoals" -gt 0 ]]; then | ||
echo "::error ::Build caching was not enabled for one or more goal executions. See this build scan for more details: ${{ steps.build.outputs.buildScanFirstBuild }}/timeline?cacheability=any-non-cacheable,not:goal-not-supported&hide-timeline" | ||
exitCode=1 | ||
fi | ||
if [[ "$hasExecutedCacheableGoals" -gt 0 ]]; then | ||
echo "::error ::One or more goal cacheable goals were re-executed. See this build scan for more details: ${{ steps.build.outputs.buildScanSecondBuild }}/timeline?cacheability=cacheable&outcome=success,failed&hide-timeline" | ||
exitCode=1 | ||
fi | ||
exit $exitCode | ||
env: | ||
DEVELOCITY_ACCESS_KEY: ${{ secrets.DV_SOLUTIONS_ACCESS_KEY }} | ||
# - name: Verify goal outcomes | ||
# run: | | ||
# bearerToken="$(echo "$DEVELOCITY_ACCESS_KEY" | cut -d= -f2) | ||
# buildScanIdFirstBuild="$(echo "${{ steps.build.outputs.buildScanFirstBuild }}" | rev | cut -d/ -f1 | rev )" | ||
# buildScanIdSecondBuild="$(echo "${{ steps.build.outputs.buildScanSecondBuild }}" | rev | cut -d/ -f1 | rev )" | ||
# echo "$buildScanIdFirstBuild" | ||
# echo "$buildScanIdSecondBuild" | ||
# mavenBuildCachePerformanceFirstBuild="$(curl -vs -H "Authorization: Bearer $DEVELOCITY_ACCESS_KEY" "$DEVELOCITY_URL/api/builds/$buildScanIdFirstBuild/maven-build-cache-performance")" | ||
# mavenBuildCachePerformanceSecondBuild="$(curl -vs -H "Authorization: Bearer $DEVELOCITY_ACCESS_KEY" "$DEVELOCITY_URL/api/builds/$buildScanIdSecondBuild/maven-build-cache-performance")" | ||
# echo "$mavenBuildCachePerformanceFirstBuild" | ||
# echo "$mavenBuildCachePerformanceSecondBuild" | ||
# hasMisconfiguredCacheableGoals="$(echo "$mavenBuildCachePerformanceFirstBuild" | jq '[.goalExecution[] | select(.nonCacheabilityCategory != "goal_not_supported" and .nonCacheabilityCategory != null)] | length')" | ||
# hasExecutedCacheableGoals="$(echo "$mavenBuildCachePerformanceSecondBuild" | jq '[.goalExecution[] | select(.avoidanceOutcome == "executed_cacheable")] | length')" | ||
# echo "$hasMisconfiguredCacheableGoals" | ||
# echo "$hasExecutedCacheableGoals" | ||
# exitCode=0 | ||
# if [[ "$hasMisconfiguredCacheableGoals" -gt 0 ]]; then | ||
# echo "::error ::Build caching was not enabled for one or more goal executions. See this build scan for more details: ${{ steps.build.outputs.buildScanFirstBuild }}/timeline?cacheability=any-non-cacheable,not:goal-not-supported&hide-timeline" | ||
# exitCode=1 | ||
# fi | ||
# if [[ "$hasExecutedCacheableGoals" -gt 0 ]]; then | ||
# echo "::error ::One or more goal cacheable goals were re-executed. See this build scan for more details: ${{ steps.build.outputs.buildScanSecondBuild }}/timeline?cacheability=cacheable&outcome=success,failed&hide-timeline" | ||
# exitCode=1 | ||
# fi | ||
# exit $exitCode |