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 1f9450a commit 062905f
Showing 1 changed file with 29 additions and 28 deletions.
57 changes: 29 additions & 28 deletions .github/workflows/maven-build-caching-samples-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

0 comments on commit 062905f

Please sign in to comment.