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

Framework: Travis build performance #15159

Closed
6 of 14 tasks
aduth opened this issue Apr 24, 2019 · 10 comments
Closed
6 of 14 tasks

Framework: Travis build performance #15159

aduth opened this issue Apr 24, 2019 · 10 comments
Labels
[Type] Build Tooling Issues or PRs related to build tooling [Type] Performance Related to performance efforts [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.

Comments

@aduth
Copy link
Member

aduth commented Apr 24, 2019

Previously: #14289

This serves as a tracking ticket for various suggested improvements to Travis build performance. See various comments within #14289 for more detail.

@aduth aduth added [Type] Build Tooling Issues or PRs related to build tooling [Type] Performance Related to performance efforts [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues. labels Apr 24, 2019
@gziolo
Copy link
Member

gziolo commented Apr 29, 2019

We also should look into how to optimize for Travis the usage of cross-env SCRIPT_DEBUG=false ./bin/reset-e2e-tests.sh. It seems like it might be a part of ./bin/setup-local-env.js since you never re-run the same job without starting Docker from scratch.

@aduth
Copy link
Member Author

aduth commented Apr 29, 2019

We also should look into how to optimize for Travis the usage of cross-env SCRIPT_DEBUG=false ./bin/reset-e2e-tests.sh. It seems like it might be a part of ./bin/setup-local-env.js since you never re-run the same job without starting Docker from scratch.

I agree. I added a checklist item to the original comment.

@aduth
Copy link
Member Author

aduth commented May 20, 2019

I've added a new section "Streamline Docker setup". Observing the Travis end-to-end tasks, it's clear that the Docker setup takes a substantial amount of time. Individual docker-compose run commands in install-wordpress.sh are the main contributor here.

Keep containers active while setup process is run (avoid Starting gutenberg_mysql_1 ... done)

I spent some time trying to sort this out: It seems like we shouldn't be expecting "Starting ..." to be occurring for every individual command, since the mysql Docker container is already up while the commands are being run.

I wasn't able to make progress here, but perhaps someone with a bit more Docker-fu could advise? (cc @youknowriad)

A few things I tried:

I also wondered: Can the wordpress:cli image be kept up, then use docker-compose exec instead of docker-compose run to avoid starting up a new container for each command? I tried this as well, unsuccessfully due to errors that the local site is not available (which is expected I suppose, since the script itself is responsible for installing the site).

@gziolo
Copy link
Member

gziolo commented May 21, 2019

I tried to remove npm i & npm run build from Travis jobs which run PHP unit tests. It turns out they are necessary to make all tests pass.

Screen Shot 2019-05-21 at 10 49 44

More at: https://travis-ci.com/WordPress/gutenberg/jobs/201750063

Related changes: 53a4ea9

We could still seek for a solution which would mock those CSS files instead.

@aduth
Copy link
Member Author

aduth commented May 21, 2019

@gziolo It's intended that those tests should automatically stub a file if one does not exist. It may not be working correctly.

} elseif ( $should_exist ) {
$this->style_contents = '';
file_put_contents( $path, $this->style_contents );
$this->original_file = null;
}

Also noting that there was some work in #14289 which could serve as prior art for trying to eliminate the need for NPM to be installed in the PHP tasks.

@aduth
Copy link
Member Author

aduth commented May 24, 2019

I chatted briefly with @noisysocks about what options we might have for specifically improving the Docker setup. While I'd been inclined to at least explore some options around moving all of the WP-CLI setup into a single script file to be run in the container image, it may be worth further exploration to either pre-build or create a custom container image with all of the setup steps. Looking to discussions like in travis-ci/travis-ci#5358 , it's not clear how well this could be cached, though as in travis-ci/travis-ci#5358 (comment) there are some options to explore. Alternatively, we may consider to publish custom images to Docker Hub.

The ideal outcome here would be that the setup-local-env.sh steps never need to happen (at least not as part of regular usage).

@noisysocks
Copy link
Member

I'll have a try at using a custom Docker image—it's something I've been experimenting with on and off.

@aduth
Copy link
Member Author

aduth commented Apr 1, 2020

Noting that as of #18942, the npm run build script will now run tsc to compile and output types for packages. While this is definitely the intended behavior for publishing packages, and is used in checking types in the project, it is redundant or not strictly relevant for many of the jobs where we are currently running npm run build, including:

  • PHP unit tests
  • PHP unit tests (PHP 5.6)
  • E2E tests (Admin) (1/4)
  • E2E tests (Admin) (2/4)
  • E2E tests (Admin) (3/4)
  • E2E tests (Admin) (4/4)
  • E2E tests (Author) (1/4)
  • E2E tests (Author) (2/4)
  • E2E tests (Author) (3/4)
  • E2E tests (Author) (4/4)

Especially if those types are built in a "clean" environment, it may take a non-trivial amount of time to complete. It would be nice if we could avoid this by some means.

cc @sirreal

@sirreal
Copy link
Member

sirreal commented Apr 1, 2020

Good point. Anecdotally, my machine takes >30s to do a cold build of types, and <1s for subsequent builds. Some ideas:

  • We could pretty easily skip type building on CI outside of the typecheck job.
  • Cache type files. From memory that would be something like:
    • packages/*/build-types
    • packages/*/*.tsbuildinfo
    • bin/.cache/*

@Mamaduka
Copy link
Member

I think this can be closed since we're using Github actions now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Build Tooling Issues or PRs related to build tooling [Type] Performance Related to performance efforts [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Projects
None yet
Development

No branches or pull requests

6 participants