Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix size deltas report infrastructure configuration #430

Merged
merged 2 commits into from
Feb 21, 2024
Merged

Fix size deltas report infrastructure configuration #430

merged 2 commits into from
Feb 21, 2024

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Feb 21, 2024

Revert Size Deltas Report Infrastructure Back to Public Repository-Appropriate Configuration

The repository infrastructure uses the arduino/report-size-deltas GitHub Actions action to generate a report of the changes in memory usage of the example sketches that would result from merging a pull request.

There are two use patterns for the arduino/report-size-deltas action:

The latter use pattern is only suitable for private repositories. The reason is that, when a pull request is submitted from a fork, the permissions of the access token used by the arduino/report-size-deltas action are downgraded to read-only in workflows triggered by a pull_request event, which means it is unable to make the report comment.

The reverted commit migrated the size deltas report infrastructure from the first use pattern to the second, which caused the "Compile Examples" workflow runs to fail on pull requests submitted from forks:

https://github.com/arduino-libraries/ArduinoIoTCloud/actions/runs/7985568163/job/21816272872?pr=427#step:4:18

Error: HTTPError: HTTP Error 403: Forbidden

For this reason, the infrastructure must be reverted back to using the first use pattern.

Fix Regression in Size Deltas Report Infrastructure Configuration

The sketches-reports-source input of the arduino/report-size-deltas action defines the regular expression that matches the names of the sketches report workflow artifacts produced by the "Compile Examples" workflow.

The key string in the names of these artifacts was set to "sketches-report" when the "Compile Examples" workflow was adjusted for compatibility (#423) with the breaking changes introduced by updating to version 4.x of the workflow's actions/upload-artifact GitHub Actions action dependency (#419):

name: sketches-report-${{ matrix.board.artifact-name-suffix }}

The pattern set in the size deltas report workflow was "sketches-reports":

sketches-reports-source: sketches-reports

The s at the end of that pattern caused it to no longer match against the key string in the artifact names after that adjustment of the "Compile Examples" workflow, resulting in size deltas reports no longer being generated by the workflow.

Although a minimal fix would be to simply remove the s from the end of the pattern, the decision was made to use a more strict regular expression. This will make it easier for maintainers and contributors to understand that this value is a regular expression and the exact nature of how that regular expression functions (which is less clear when relying on the arduino/report-size-deltas action's partial pattern matching behavior).

This partially reverts commit 836771a.

The repository infrastructure uses the "arduino/report-size-deltas" action to generate a report of the changes in memory
usage of the example sketches that would result from merging a pull request.

There are two use patterns for the "arduino/report-size-deltas" action:

* Run from a workflow triggered by a `schedule` event.
* Run from the same workflow as the "arduino/compile-sketches" action when triggered by a `pull_request` event.

The latter use pattern is only suitable for private repositories. The reason is that, when a pull request is submitted
from a fork, the permissions of the access token used by the "arduino/report-size-deltas" action are downgraded to
read-only in workflows triggered by a `pull_request` event, which means it is unable to make the report comment.

The reverted commit migrated the size deltas report infrastructure from the first use pattern to the second, which
caused the "Compile Examples" workflow runs to fail on pull requests submitted from forks:

Error: HTTPError: HTTP Error 403: Forbidden

For this reason, the infrastructure must be reverted back to using the first use pattern.
The "sketches-reports-source" input of the "arduino/report-size-deltas" GitHub Actions action defines the regular
expression that matches the names of the sketches report workflow artifacts produced by the "Compile Examples" workflow.

The key string in the names of these artifacts was set to "sketches-report" when the "Compile Examples" workflow was
adjusted for compatibility with the breaking changes introduced by updating to version 4.x of the workflow's
"actions/upload-artifact" GitHub Actions action dependency. The pattern set in the size deltas report workflow was
"sketches-reports". The "s" at the end of that pattern caused it to no longer match against the key string in the
artifact names after that adjustment of the "Compile Examples" workflow, resulting in size deltas reports no longer
being generated by the workflow.

Although a minimal fix would be to simply remove the "s" from the end of the pattern, the decision was made to use a
more strict regular expression. This will make it easier for maintainers and contributors to understand that this value
is a regular expression and the exact nature of how that regular expression functions (which is less clear when relying
on the "arduino/report-size-deltas" action's partial pattern matching behavior).
@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: infrastructure Related to project infrastructure labels Feb 21, 2024
@per1234 per1234 requested review from aentinger and pennam February 21, 2024 15:52
@per1234
Copy link
Contributor Author

per1234 commented Feb 21, 2024

Note for reviewers:

The re-added report-size-deltas.yml workflow will only start being triggered after this pull request is merged. So it is expected that there won't be a report comment on this pull request.

Copy link
Collaborator

@aentinger aentinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per, thank you very much for the detailed explanation 🙇 . Superb work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants