-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
ci(docs-infra): store JS bundles as CI artifacts to debug size check flakes #37703
Conversation
8ddab71
to
8ba3a9f
Compare
…flakes As reported in angular#37699, the size of the main angular.io bundle sometimes ends up bigger than expected on CI. This usually goes away after rerunning the job a couple of times. It is unclear what is causing this. In order to help debug the issue, this commit stores the JS files that are checked as part of the aio payload-size check as CI artifacts, where they can be retrieved from and inspected.
8ba3a9f
to
75e2aad
Compare
@@ -395,6 +399,22 @@ jobs: | |||
- run: yarn --cwd aio test-a11y-score-localhost | |||
# Check the bundle sizes. | |||
- run: yarn --cwd aio payload-size | |||
# When `payload-size` check fails, copy the files that where checked into `debugArtifactsPath`. | |||
- run: | |||
when: on_fail |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can see how this step works here: https://circleci.com/workflow-run/5837947b-493e-4310-a0ab-efeea4b1643c.
(For that run, I set when: on_success
to have this step run even if previous steps succeeded.)
.circleci/config.yml
Outdated
const checkedFiles = fs.readdirSync(distDir).filter(x => /^(?:main|polyfills|runtime)-es2015\..+\.js$/.test(x)); | ||
fs.mkdirSync(artifactsDir); | ||
checkedFiles.forEach(x => fs.copyFileSync(path.join(distDir, x), path.join(artifactsDir, x))); | ||
" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I would prefer to put this code into a JS helper file and simply run it from here (passing the << parameters.debugArtifactsPath >>
as an argument). This makes it easier to check the code for syntax errors, provides more space for adding explanatory comments, and also can be made resilient to changes in the cwd by using __dirname
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this appears to be a copy of the code further down, so moving it into its own file would reduce the duplication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I intended this to be a temporary, hacky way to gather some info for debugging. Therefore, I wanted to touch as few places as possible and make this as self-contained as possible.
If we want this implemented for real, we should indeed move it to a script, move the steps to a re-usable command in config.yml
and make sure it only happens on payload-size check failures (currently it will happen for any failure).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a compromise - somewhere in-between - would be acceptable. :-)
Just because it is temporary (for now!!) I don't think it is nice to make CircleCI even more complicated than it is already.
db45aff
to
1191888
Compare
You can preview 1191888 at https://pr37703-1191888.ngbuilds.io/. |
1191888
to
a6aafce
Compare
You can preview a6aafce at https://pr37703-a6aafce.ngbuilds.io/. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
…flakes (angular#37703) As reported in angular#37699, the size of the main angular.io bundle sometimes ends up bigger than expected on CI. This usually goes away after rerunning the job a couple of times. It is unclear what is causing this. In order to help debug the issue, this commit stores the JS files that are checked as part of the aio payload-size check as CI artifacts, where they can be retrieved from and inspected. PR Close angular#37703
As reported in #37699, the size of the main angular.io bundle sometimes ends up bigger than expected on CI. This usually goes away after rerunning the job a couple of times.
It is unclear what is causing this. In order to help debug the issue, this commit stores the JS files that are checked as part of the aio payload-size check as CI artifacts, where they can be retrieved from and inspected.