Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
erichaagdev committed Sep 8, 2024
1 parent 13f09f4 commit 2ad602e
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
gitCommitId: ${{ github.sha }}
projectDir: build-caching-maven-samples
goals: verify
args: -B
env:
DEVELOCITY_ACCESS_KEY: "${{ secrets.DV_SOLUTIONS_ACCESS_KEY }}"
- name: Verify goal outcomes
Expand All @@ -48,15 +49,15 @@ jobs:
buildScanIdSecondBuild="$(echo "${{ steps.build.outputs.buildScanSecondBuild }}" | rev | cut -d/ -f1 | rev )"
mavenBuildCachePerformanceFirstBuild="$(curl -s -H "Authorization: Bearer $DEVELOCITY_ACCESS_KEY" "$DEVELOCITY_URL/api/builds/$buildScanIdFirstBuild/maven-build-cache-performance")"
mavenBuildCachePerformanceSecondBuild="$(curl -s -H "Authorization: Bearer $DEVELOCITY_ACCESS_KEY" "$DEVELOCITY_URL/api/builds/$buildScanIdSecondBuild/maven-build-cache-performance")"
hasMisconfiguredCacheableGoals="$(echo "$mavenBuildCachePerformanceFirstBuild" | jq '[.goalExecution[] | select(.nonCacheabilityCategory != "goal_not_supported" and .nonCacheabilityCategory != null)] | length'
hasExecutedCacheableGoals="$(echo "$mavenBuildCachePerformanceSecondBuild" | jq '[.goalExecution[] | select(.avoidanceOutcome == "executed_cacheable")] | length')'
hasMisconfiguredCacheableGoals="$(echo "$mavenBuildCachePerformanceFirstBuild" | jq '[.goalExecution[] | select(.nonCacheabilityCategory != "goal_not_supported" and .nonCacheabilityCategory != null)] | length')"
hasExecutedCacheableGoals="$(echo "$mavenBuildCachePerformanceSecondBuild" | jq '[.goalExecution[] | select(.avoidanceOutcome == "executed_cacheable")] | length')"
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"
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&hide-timeline&outcome=success,failed"
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
Expand Down

0 comments on commit 2ad602e

Please sign in to comment.