You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Fixed] Run CI on a single machine by generating cloudbuild files (#4186)
* Run CI on a single machine by generating cloudbuild files
Instead of running each CI test on a separate Google Cloud machine, generate a cloudbuild.yml file to test all affected packages on a single machine. The benifits of this strategy include the following:
* Fewer machines are required for a single test (2 instead of up to 12), so queuing should happen much less often.
* Packages only need to be built once, instead of once per machine.
* Multithreaded steps have access to more cores.
When CI is run, the root cloudbuild.yml is launched on Google Cloud. This file has only three steps: Install yarn dependencies, run `yarn generate-cloudbuild-for-packages`, and run `run-build.sh`. The second step finds what packages were affected by the change and combines their cloudbuild.yml files into a single `cloudbuild_generated.yml` file, and the third step launches the generated build on Google Cloud. The steps in the generated build are set to `waitFor` each other according to the dependency tree `scripts/package_dependencies.json`, and each package's `build-deps` step is removed in favor of waiting for its dependencies to be built.
Each package's cloudbuild file still works as expected, and there are two new yarn commands at the root:
* `yarn test-packages` tests all packages affected by a change. It performs the same steps as CI.
* `yarn generate-cloudbuild-for-packages [PACKAGE]...` generates the cloudbuild file to test each `PACKAGE` and packages it might affect. If given no packages, it detects what packages have been changed in the current PR.
* Verify the dependency graph is a valid graph
* Add dependencies to e2e
* Use the node:12 docker image for tfjs-node CI
tfjs-node builds N-API bindings that end-to-end tests need to use. End-to-end uses our custom docker image (gcr.io/learnjs-174218/release) since it has to build tfjs-backend-wasm when it's run by itself (which requires emscripten). Our custom image uses node 12, and is incompatible with node 10 N-API bindings. Eventually, we'll want to move everything that's using node:10 to node:12, but that's out of the scope of this commit.
* Remove TODO and allow changes to generate_cloudbuild.js to trigger a full rebuild
* Add tfjs-backend-cpu to tfjs-data in package_dependencies.json
tfjs-backend-cpu is listed in tfjs-data's package.json as a linked dependency, but was missing form package_dependencies.json.
* Don't have tfjs-backend-webgpu build its dependencies in CI
Move tfjs-backend-webgpu's dependency building to the 'build-deps' step so it can be removed during CI.
This commit also updates the test cloudbuild files that should have been updated in f9c1fdd. It would probably be best to amend that commit, but last time I tried force-pushing in GitHub, I broke the PR I was working on.
* Revert changes in tfjs-backend-webgpu to master
tfjs-backend-webgpu is now pinned at v2.7.0 for all its tfjs dependencies.
* Add the update-cloudbuild-tests script to package.json
update-cloudbuild-tests updates the change detection tests for scripts/generate_cloudbuild.js. It should be run iff a change affects cloudbuild files or the dependency tree.
* Make tfjs-backend-webgpu tests wait for yarn to run
* Add a destination argument to generate_cloudbuild_for_packages.js
Co-authored-by: Ping Yu <[email protected]>
0 commit comments