Conversation
Motivation: It must be useful to see test results on a website and share the link with other folks. Since Gradle enterprise is activated in the Armeria project, we can upload build scans to https://ge.armeria.dev. An access token is required to upload build scans. As GitHub secrets are not exposed to the pull requests from public forks, it is not possible to directly upload the build scans in a CI build workflow while keeping the access token securely. @ribafish suggested a good idea that uploads `build-scan-data` to GitHub Actions artifacts and then publishing the backup scan data in a sperate workflow run on Armeria repository later. Modifications: - Added a new step that uploads Gradle build scan data to GitHub Actions artifacts to the CI build. - Redefined the build job name as a deterministic name. - A job name is used to fetch the job result from the JOB API. - GitHub does not provide a way to get a job ID or a job name in a workflow, - https://github.com/orgs/community/discussions/8945 - https://stackoverflow.com/questions/71593861/how-to-get-github-actions-matrix-job-name-within-job - Added some useful GitHub links to the build scan. - Added `gradle-build-scan.yml` for downloading and executing the previous build scan. - Added `get-pr-number-by-sha.ts` to find a pull request number based on the given commit SHA that was triggered the build. - The pull request number is used to comment the scan result on a pull request. - Miscellaneous) - Bump `actions/checkout` to v3 from v2 - Bump `actions/setup-java` to v3 from v2 Result: You can now see Gradle build scan of a pull request on https://ge.armeria.dev
|
ikhoon#39 (comment) is an example of the scan result. |
3d026dc to
e87e0b2
Compare
Co-authored-by: Gašper Kojek <[email protected]>
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #5104 +/- ##
============================================
- Coverage 74.33% 74.32% -0.01%
- Complexity 19603 19604 +1
============================================
Files 1682 1682
Lines 72252 72252
Branches 9241 9241
============================================
- Hits 53707 53702 -5
- Misses 14204 14211 +7
+ Partials 4341 4339 -2 ☔ View full report in Codecov by Sentry. |
| name: Upload build scans | ||
| run: | | ||
| DOWNLOAD_DIR="build-scans/" | ||
| BUILD_SCAN_DIR="${HOME}/.gradle/build-scan-data" |
There was a problem hiding this comment.
Is there a way to upload the build scans at a specified directory other than the default location? We could upload from build-scans/ without copying them to a shared directory (~/.gradle/build-scan-data), which could potentially cause a race condition.
There was a problem hiding this comment.
When I read the Javadoc of buildScan, there is no option to customize the folder (~/.gradle/build-scan-data).
As GitHub Actions executes only one run in an instance, we would not encounter race conditions at the moment. That said, it sounds very helpful if we can specify the folder.
@ribafish Please correct me if I'm wrong.
There was a problem hiding this comment.
Correct, there's no way to specify a different directory to upload the build scans from as such. If you wanted to run these in parallel, you could create copies of the project to run parallel builds while specifying a different gradle user home directory for each build with -Dgradle.user.home=(path to directory).
This reverts commit 5da5ea4.
Motivation:
It must be useful to see test results on a website and share the link
with other folks. Since Gradle enterprise is activated in the Armeria
project, we can upload build scans to https://ge.armeria.dev.
An access token is required to upload build scans. As GitHub secrets are
not exposed to the pull requests from public forks, it is not possible to
directly upload the build scans in a CI build workflow while keeping the
access token securely.
@ribafish suggested a good idea that uploads
build-scan-datato GitHubActions artifacts and then publishes the backup scan data in a sperate
workflow run on the Armeria repository later.
Modifications:
artifacts to the CI build.
gradle-build-scan.ymlfor downloading and executing theprevious build scan.
get-pr-number-by-sha.tsto find a pull request number based onthe given commit SHA that triggered the build.
request.
actions/checkoutto v3 from v2actions/setup-javato v3 from v2Result:
You can now see Gradle build scan of a pull request on https://ge.armeria.dev