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

Reduce the travis build time #9387

Closed
lannka opened this issue May 17, 2017 · 18 comments
Closed

Reduce the travis build time #9387

lannka opened this issue May 17, 2017 · 18 comments

Comments

@lannka
Copy link
Contributor

lannka commented May 17, 2017

Right now it takes travis ~30m for a pull request and ~40m for a release build. Let's speeeed it up!!

gulp.js lint. Total time: 0m 51s.
gulp.js check-types. Total time: 0m 47s.
gulp.js presubmit. Total time: 0m 25s.
gulp.js dep-check. Total time: 1m 46s.
gulp.js build. Total time: 2m 10s.
gulp.js dist --fortesting. Total time: 12m 22s.
gulp.js test --nobuild --compiled. Total time: 7m 33s.
gulp.js test --nobuild --saucelabs --integration --compiled. Total time: 7m 25s.
cd validator && python build.py. Total time: 1m 58s.
cd validator/webui && python build.py. Total time: 0m 16s.

Some ideas:

  • Parallelize jobs on different VMs. All presubmit checks can be moved to a separate VM (~4min). Validator checks too (~2m).
  • skip gulp build (2m 10s), since we only test against gulp dist (caveat: we might need gulp build --css-only to get gulp dist running, or we should fix the deps)
  • saucelabs tests do not consume local CPU, can be definitely parallelized. (7m 25s)
  • Optimize our compiler, build all extensions in one shot (12m) (@cramforce is it still possible?)
@cramforce
Copy link
Member

We will need to prioritize this.

Good news is that we do have a very significant speed up for the compilation part on the horizon. I believe this is on @erwinmombay's OKRs for this quarter. It does, however, require significant changes and will take a few months.

@lannka
Copy link
Contributor Author

lannka commented May 17, 2017

Besides the compiler script improvement, we can still get the low hanging fruit like Parallelizing jobs on different VMs.

gulp.js lint. Total time: 0m 51s.
gulp.js check-types. Total time: 0m 47s.
gulp.js presubmit. Total time: 0m 25s.
gulp.js dep-check. Total time: 1m 46s.
gulp.js build. Total time: 2m 10s.
gulp.js dist --fortesting. Total time: 12m 22s.
gulp.js test --nobuild --compiled. Total time: 7m 33s.
gulp.js test --nobuild --saucelabs --integration --compiled. Total time: 7m 25s.
cd validator && python build.py. Total time: 1m 58s.
cd validator/webui && python build.py. Total time: 0m 16s.

All the tasks in bold can be run in a different VM, as they're independent.
In fact, our unit test gulp test --nobuild (--compiled is superfluous) does not require building any code. Can be in a separate VM as well.

So, we could bring down the total time to ~20m for both pull request and release build.

@cramforce
Copy link
Member

cramforce commented May 17, 2017 via email

@rsimha
Copy link
Contributor

rsimha commented May 17, 2017

Picking this up now.

@rsimha
Copy link
Contributor

rsimha commented May 17, 2017

@lannka: FYI, from a comment in pr-check.js, it appears that gulp dep-check does depend on gulp build having been run, so that one task cannot be run in a different VM. I'm testing a parallel run with the rest of the tasks you've marked in bold.

@lannka
Copy link
Contributor Author

lannka commented May 17, 2017

@rsimha-amp I'm not sure why the dependency exists ( @erwinmombay can you chime in?), but this works:

gulp build --css-only && gulp dep-check

@rsimha
Copy link
Contributor

rsimha commented May 17, 2017

@lannka, css files is precisely the reason. I think I can do a css-only build and thereby separate out dep-check into a parallel task that's not on the main build task. Working on it.

@rsimha
Copy link
Contributor

rsimha commented May 17, 2017

From https://travis-ci.org/ampproject/amphtml/builds/233425954, it seems like Travis is running the shards one after another. I think we might need to enable concurrent builds for our project via the Travis settings. I'll look into doing that once I'm sure that the shards I've created are truly independent.

@lannka
Copy link
Contributor Author

lannka commented May 17, 2017

The result is promising: https://travis-ci.org/ampproject/amphtml/builds/233430708?utm_source=github_status&utm_medium=notification

The failed unit test seems to be integration tests which should be probably moved to /integration test.

I suggest we do a gulp build for unit test now, and create another issue for people to clean those tests up.

@rsimha
Copy link
Contributor

rsimha commented May 18, 2017

@lannka, change made. The sharded build was fully parallel this time, and the build time is down to ~16 mins. However, since the unit tests currently need a full dist build, and it's not possible to do two parallel dist builds on the same machine, we're going to first have to clean up the unit tests before merging this change.

@rsimha
Copy link
Contributor

rsimha commented May 18, 2017

We now have a parallel build, so this issue is fixed. Note that even though the time reported by Travis appears to have increased, it is a result of the total server time spent by all parallel jobs. (See travis-ci/travis-ci#1486 for a discussion on this.) The actual wall clock time for a full build has gone down from ~40 minutes to ~25 minutes.

@lannka
Copy link
Contributor Author

lannka commented May 19, 2017

this is awesome. I suggest we can enable integration test for each pull request now.

@cramforce
Copy link
Member

@lannka that is a separate issue. It is now possible with changes of how secrets work in Travis. @erwinmombay started work, but I think it got stuck. What is the status?

@lannka
Copy link
Contributor Author

lannka commented May 19, 2017

@cramforce i thought it will be a simple change in pr-check.js to enable integration test for pull requests, not just builds?

@cramforce
Copy link
Member

cramforce commented May 19, 2017 via email

@rsimha rsimha modified the milestones: FIXIT I/O Week, Sprint H2 May May 19, 2017
@rsimha
Copy link
Contributor

rsimha commented May 19, 2017

@cramforce, from reading https://docs.travis-ci.com/user/pull-requests#Pull-Requests-and-Security-Restrictions, I was under the impression that secure keys are not available to PRs because if they were, anyone could write a test that simply printed the env vars containing the keys. Am I missing something?

@cramforce
Copy link
Member

That used to be true, but their own info is outdated. See https://docs.travis-ci.com/user/sauce-connect/ for the JWT based solution.

It would be super awesome to finally get that to work for PRs!

@rsimha
Copy link
Contributor

rsimha commented May 22, 2017

Cool, good to know. I'll look into JWT this week.

torch2424 pushed a commit to torch2424/amphtml that referenced this issue Jun 6, 2017
Travis builds have become slow during busy periods of the day due to various reasons. This PR does the following:

Reorganizes build tasks across fewer build shards
Reduces the number of VMs used by PR and master builds to 2
No longer does a full gulp dist for unit tests (Possible to do after ampproject#9404)
Reduces the total CPU time used for PR builds to < 20 mins
Fixes ampproject#9500
Fixes ampproject#9387
torch2424 pushed a commit to torch2424/amphtml that referenced this issue Jun 6, 2017
* Bidtellect amp implementation… (ampproject#9518)

* Bidtellect amp implementation…

* removing renderStartImplemented…

* spaces?

* adding example

* Fix test-amp-ad-network-doubleclick-impl (ampproject#9645)

* Optimizations to speed up Travis PR builds (ampproject#9626)

Travis builds have become slow during busy periods of the day due to various reasons. This PR does the following:

Reorganizes build tasks across fewer build shards
Reduces the number of VMs used by PR and master builds to 2
No longer does a full gulp dist for unit tests (Possible to do after ampproject#9404)
Reduces the total CPU time used for PR builds to < 20 mins
Fixes ampproject#9500
Fixes ampproject#9387

* Animations: full on-action API (ampproject#9641)

* Animations: full on-action API

* review fixes

* Fix Validator tests on Travis, which now uses Node v4 (ampproject#9654)

* Amp-imgur : Implement imgur embed (ampproject#9405) (ampproject#9434)

* Amp-imgur : Implement imgur embed (ampproject#9405)

* amp-imgur test code modified

* amp-imgur validation code changed

* fix amp-imgur lint check

* Remove unused Layour variables

* Test code modified

* Ingegration amp-imgur extension

* [amp-imgur] add resize logic

* Remove 3p iframes and add resize message listener

* Fix some code with reviews
* change some syntax
* change validation rules
* add find event source

* [amp-imgur] remove unnecessary code and add object check

* remove spec_name from validation code

* Remove unnecessary code and add owners file

* Change required tag name  to  in validation file

* data-imgurid -> data-imgur-id

* Add whitelist for amp-imgur

* remove unused AmpImgur import in test file

* remove unused preconnect callback

* Update amp-cors-requests.md (ampproject#9636)

Added updates and corrections per Dima's feedback.

* Expose login url building to amp access service (ampproject#9300)

* Animations: support style keyframes (ampproject#9647)

* Animations: support style keyframes

* docs

* review fixes

* lints

* Animations: subtargets format (ampproject#9655)

* Animations: subtargets format

* fix docs

* Fix extern for integration test (ampproject#9657)

* Remove whitelisted link for PR 9434 (ampproject#9656)

* Add callouts for CORS + cleanup (ampproject#9591)

* Add callouts for CORS + cleanup

* Update amp-access.md

* Doubleclick Fast Fetch: Send default safeframe version on ad request (ampproject#9613)

* Send default safeframe version on ad request

* fix test failure

* amp-ima-video: Fixes some undefined variables in compiled extension (ampproject#9617)

* Add experimental input-debounced to the actions and event doc (ampproject#9650)

* Copy and rename compiled script directly for deprecated version (ampproject#9587)

* Remove A4A Dependency on ads/_config.js (ampproject#9462)

* Added doubleclick specific config

* Modified other networks

* Update MockA4AImpl

* Remove unneeded config lines

* Add cid, remove renderStartImplemented

* Fix lint complaint

* Changed from mandatory config to overrrideable method

* Addressed feedback, modified getAdCid

* Addressed additional feedback

* Responded to feedback

* Removed unnneeded guard against null value

* Changed signature of function

* Fixed lint issues

* addressed comments

* Addressed comments, fixed broken test

* Change signature / update tests

* Fix wrong contents and white spaces in amp-imgur.md (ampproject#9658)

* Performance: separate ini-load from first visible ini-load (ampproject#9665)

* amp-bind: Fix more integration tests (ampproject#9598)

* more bind test fixes

* include object.assign polyfill

* move polyfills to separate file

* replace use of map() from bind-validator with ownProperty()

* fix types and test

* Stop using IOS elastic scroll when slidescroll takes over animation (Only for the NON SNAP-POINTS flow) (ampproject#9668)

* removing overflow touch on no-scroll for ios

* Stop using IOS elastic scroll when slidescroll takes over animation (Only for the NON SNAP-POINTS flow)

* make sure css is compiled before entry points (ampproject#9643)

* update npm package version (ampproject#9671)

* A4A: expose visibilityCsi (ampproject#9667)

* A4A: expose visibilityCsi

* tests

* amp-bind: Fix embedding in FIF (ampproject#9541)

* move element service changes from ampproject#9447

* store element service ids in extension struct

* add unit test, fix other tests

* Fix null value binding (ampproject#9674)

* Add amp-form's submit action to the docs (ampproject#9675)

* Write cookie for ad-cid. (ampproject#9594)

* Write cookie for ad-cid.

* fix tests

* amp-access-laterpay fixes (ampproject#9633)

* Add support for LaterPay subscriptions

* Fix canonical link on laterpay example

* Tweak default styling

* Add an example locale message for the header

* Fix indentation of JsDoc (ampproject#9677)

It should be indented at the same level as the method it's documenting.

* Add example to amp iframe docs (ampproject#9660)

* Change image to static link hosted on ampproject.org

* Update amp-iframe doc w example + gen cleanup

* Adds SFG experiment branches to doubleclick-a4a-config.js. (ampproject#9662)

* Added experiment branches corresponding to exp=a4a:(5|6).

* Removed test file.

* Removed changes to yarn.lock + minor fixes.

* Fixed adsense-a4a-config.js.

* Fixed return statement.

* Removed reference to style tag for opacity (ampproject#9634)

As style tag for `opacity` was replaced with `amp-boilerplate (back in this [commit](ampproject@0a056ca), updated the text to reflect those changes.

* De-flake amp-bind integration tests (ampproject#9683)

* split bind fixtures into one file per extension

* fix width/height binding bug, avoid race condition w/ dynamic containers

* actually, just skip the tests affected by race condition for now

* Remove timer calls to prevent future flakiness (ampproject#9478)

* Remove timer calls to prevent future flakiness

* Revert the line order change

* Poll instead of using stub callback constructor

* Add jsdoc and rename variables

* amp-animation: polyfill partial keyframes from CSS (ampproject#9689)

* Animations: whitelist offset distance and regroup condition types (ampproject#9688)

* Use Docker containers in Travis (ampproject#9666)

* clean up web-worker experiment (ampproject#9706)

* Load examiner.js when #development=2 (ampproject#9680)

* Load examiner.js when #development=1

* address comments

* Use development=2

* Fix presubmit

* Implementation of amp-ad-exit (ampproject#9390)

* Implementation of the amp-ad-exit component for managing ad navigation (ampproject#8515).

Changes from the I2I:
- Only RANDOM, CLICK_X, and CLICK_Y variables can be used, alongside custom vars.
- It doesn't work well with <a> tags - the tap action doesn't trigger on middle clicks. Recommendation is to use other elements.
- ClickLocationFilter for border click protection is not yet implemented. It will be added in a future change.

The component does some lightweight validation of the JSON config when it's
built. This may be overkill.

Tested:
gulp test --files 'extensions/amp-ad-exit/0.1/test/*'
gulp check-types

* Update JSDoc for some functions. Fix lint issue (ignore unused parameters in an interface method).

* sinon.spy -> sandbox.spy

* Add amp-ad-exit to the list of allowed extensions in A4A pages and fix validation rules.

Address PR: add experiment flag; use camelCase for config properties

address some comments

Instantiate a new Filter for each spec.

* Instantiate a new Filter for each spec.

* remove duplicate doctype tag in example

* Make ActionEventDef public for type annotations.

* Add filter factory.

* fix event var

* update type annotation for Filter.filter

* address PR comments

* Move filter config validation to the ctor. Remove Filter.buildCallback().

* camelCase in documentation examples

* Introducing "it.yield", a convenient way to test promise code (ampproject#9601)

* Introduce yield.

* Address comments.

* fix done state error handling

* Document amp-access as a special target (ampproject#9568)

`amp-access` is a special target that's not mentioned in this document.
It's special because you can't give an arbitrary ID to it, i.e., you
can't just change the id of the `amp-access` script tag to `amp-access2`
and expect `on="tap:amp-access2.login"` to work. Given that the
"actions" for `amp-access` is a bit dynamic depending on the structure
of the `amp-access` JSON, instead of listing out the actions in a
tabular form, a reference to the `amp-access` documentation is added.

* Run presubmit tests soon after building (ampproject#9716)

* Revert "Use Docker containers in Travis (ampproject#9666)" (ampproject#9717)

This reverts commit 98ecb9b.

It turns out that while using Docker containers instead of VMs on Travis reduces VM startup time, it has significantly increased build and test time, increasing the overall PR check round trip from < 20 mins to > 30 mins.

Compare https://travis-ci.org/ampproject/amphtml/jobs/238464404 (Docker) against https://travis-ci.org/ampproject/amphtml/jobs/238462066 (VM).

Fixes ampproject#9651

* Validator Rollup (ampproject#9719)

* Add validator tests for amp-imgur.

* Disallow amp-embed as child of amp-app-banner.

* Minor cleanup, Make sure our set numbers are consistent in javascript.

* amp-state: Allow both `src` and script child (ampproject#9721)

* adapt code from ampproject#8897

* also_requires_attr should be in trigger

* Remove experiment for input-debounced. Update docs. (ampproject#9724)

* Validator Rollup (ampproject#9727)

* Minor cleanup of amp-ad-exit

* Disallow amp-ad/amp-embed as children of amp ad containers when data-multi-size is present.

* Revision bump

* Enabling dynamic queryparam addition to anchour links  (ampproject#9684)

* Enabling queryparam addition to anchour links

* Code review changes

* Additional cache urls (ampproject#9733)

* Significantly speed up gulp build --css-only (ampproject#9726)

Prior to this PR, gulp build --css-only would take ~ 1 minute to run, and end up building a bunch of js files in addition to compiling css.

After this PR, gulp build --css-only takes ~ 0.5 seconds to run (a 100x speed up), and the only output files in build/ after running it are .css, and .css.js files.

Resulting speeds on my workstation:
gulp build --css-only: ~500ms
gulp build: ~1m 45s
gulp dist --fortesting: ~3m 30s

Fixes ampproject#9640

* add amp-analytics Facebook Pixel support (ampproject#9449)

* add amp-analytics Facebook Pixel support

* add amp-analytics Facebook Pixel support

* fix test on extensions/amp-analytics/0.1/test/vendor-requests.json

* add Facebook Pixel standard events https://developers.facebook.com/docs/ads-for-websites/pixel-events/v2.9#events

* Update vendors.js

fix conflicts

* Update vendors.js

fix conflicts

* Update vendor-requests.json

fix conflicts

* Update vendor-requests.json

fix conflicts

* Update vendor-requests.json

* Update analytics.amp.html

* Update analytics-vendors.amp.html

* Update vendors.js

* Update analytics-vendors.amp.html

* fix lint error

* update

* facebook pixel

* Update vendor-requests.json

* Update analytics.amp.html

* fix lint error

* fix lint error

*  fix alphabetical order

* Update yarn.lock

* AMP-ad supports Seznam Imedia ad network (ampproject#8893)

* AMP-ad supports Seznam Imedia ad network

* Fixed requested changes

* Fixed requested changes

* Render API implemented

* Improved placing ads

* Fixed requested changes

* Render API fixed context
* Renamed IM.cz to Imedia
* Described JSON parameters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants