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

Remove bundle size check from pre-push hook #19993

Merged
merged 4 commits into from Dec 20, 2018

Conversation

cathyxz
Copy link
Contributor

@cathyxz cathyxz commented Dec 19, 2018

UPDATE: removing bundle-size check from pre-push hook altogether. Context / discussion below.

I'm getting this error message a lot in my pre-push hook on PRs that don't touch anything in runtime, causing my pushes to fail unnecessarily. Since we have a rate-limit and this check is pretty pointless for PRs that don't touch runtime, let's remove it from the default pre-push hook. =)

Running gulp bundle-size
[17:54:59] Using gulpfile ~/Code/amphtml/gulpfile.js
[17:54:59] Starting 'bundle-size'...
[17:55:00] ERROR: Failed to retrieve the max allowed bundle size from GitHub.
[17:55:00] 'bundle-size' errored after 687 ms
[17:55:00] HttpError: API rate limit exceeded for 104.132.0.90. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)
    at response.text.then.message (/Users/cathyzhu/Code/amphtml/node_modules/@octokit/request/lib/request.js:55:27)
    at process._tickCallback (internal/process/next_tick.js:68:7)
error: failed to push some refs to 'git@github.com:cathyxz/amphtml.git'

@@ -350,6 +351,14 @@ async function performBundleSizeCheck() {
if (argv.on_skipped_build) {
return await skipBundleSize();
} else {
if (argv.on_pre_push_build) {
const files = gitDiffNameOnlyMaster();
const runtimeFiles = files.filter(fileName => fileName.startsWith('src'));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a pretty crude check to see if a diff-ed file is in runtime. Let me know if there's a better one.

@@ -25,7 +25,7 @@
GREEN() { echo -e "\033[0;32m$1\033[0m"; }
CYAN() { echo -e "\033[0;36m$1\033[0m"; }

GULP_BUNDLE_SIZE="gulp bundle-size"
GULP_BUNDLE_SIZE="gulp bundle-size --on_pre_push_build"
Copy link
Contributor

@rsimha rsimha Dec 19, 2018

Choose a reason for hiding this comment

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

I initially added this to the pre-push hook because it was an instant local-only check that would take ~1 second to run. (Pre-push hooks should be fast.)

Now that we're doing more complicated stuff, should we consider removing this check from the pre-push hook? I'm not sure the check is designed to run from developer machines.

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd be totally cool with removing it altogether. =)

Copy link
Contributor

Choose a reason for hiding this comment

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

Great. In that case, the only change needed is to delete this line :)

@danielrozenberg
Copy link
Member

I think I'd rather remove this pre-push check entirely, since bundle-size checks are now actionable (i.e., someone can approve/reject a size increase on GitHub)

@cathyxz cathyxz changed the title Remove bundle size check for PRs that don't touch src in pre-push hook Remove bundle size check from pre-push hook Dec 19, 2018
@cathyxz
Copy link
Contributor Author

cathyxz commented Dec 19, 2018

Thanks @rsimha and @danielrozenberg for the fast turnaround! Removed the bundle-size check from our pre-push hook. PTAL?

Copy link
Contributor

@rsimha rsimha left a comment

Choose a reason for hiding this comment

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

LGTM!

@cathyxz cathyxz merged commit 1e3839b into ampproject:master Dec 20, 2018
@cathyxz cathyxz deleted the feature/bundle-size branch December 20, 2018 00:01
noranazmy pushed a commit to noranazmy/amphtml that referenced this pull request Mar 22, 2019
* Skip check if no runtime files were touched

* Apply this to pre-push builds only

* Revert last 2 commits

* Straight up delete bundle size check from pre-push hook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants