-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(getting-started): add Cloudbuild example (#501)
- Loading branch information
Showing
2 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,7 +168,7 @@ module.exports = { | |
**.gitlab-ci.yml** | ||
|
||
```yaml | ||
image: cypress/browsers:node10.16.0-chrome77 | ||
image: cypress/browsers:node14.15.0-chrome86-ff82 | ||
lhci: | ||
script: | ||
- npm install | ||
|
@@ -221,6 +221,58 @@ lhci autorun | |
|
||
</details> | ||
|
||
<details> | ||
<summary>Google Cloudbuild</summary> | ||
<br /> | ||
|
||
**NOTE:** Learn more about the [security tradeoffs](./recipes/docker-client/README.md#--no-sandbox-container-tradeoffs) behind use of the `--no-sandbox` Chrome option before proceeding. | ||
|
||
**.lighthouserc.js** | ||
|
||
```js | ||
module.exports = { | ||
ci: { | ||
collect: { | ||
settings: {chromeFlags: '--no-sandbox'}, | ||
}, | ||
upload: { | ||
target: 'temporary-public-storage', | ||
}, | ||
}, | ||
}; | ||
``` | ||
|
||
**Notes** | ||
* `LHCI_BUILD_CONTEXT__CURRENT_BRANCH` doesn't pick up the right variables in cloudbuild so passing through `$BRANCH_NAME` will fix this. | ||
* `machineType` defines the machine you can pick. The bigger the machine the more stable the performance results will be (see [Lighthouse variability documentation](https://github.com/GoogleChrome/lighthouse/blob/master/docs/variability.md)). WARNING: Look through the [Cloudbuild machine pricing](https://cloud.google.com/cloud-build/pricing) before deciding on a machine type. | ||
|
||
**cloudbuild.yml** | ||
|
||
```yaml | ||
steps: | ||
- id: 'install' | ||
args: ['npm', 'ci'] | ||
name: node:14-alpine | ||
- id: 'build' | ||
waitFor: ['install'] | ||
name: node:14-alpine | ||
args: ['npm', 'run', 'build'] | ||
- id: 'lighthouse' | ||
waitFor: ['build'] | ||
name: cypress/browsers:node14.15.0-chrome86-ff82 | ||
entrypoint: '/bin/sh' | ||
args: ['-c', 'npm install -g @lhci/[email protected] && lhci autorun --failOnUploadFailure'] | ||
env: | ||
- 'LHCI_BUILD_CONTEXT__CURRENT_BRANCH=$BRANCH_NAME' | ||
options: | ||
machineType: 'N1_HIGHCPU_8' | ||
``` | ||
|
||
</details> | ||
|
||
That's it! With this in place, you'll have Lighthouse reports collected and uploaded with links to each report on every push. | ||
|
||
Temporary public storage provides access to individual reports, but not historical data, report diffing, or build failures. Read on to find out how to [add assertions](#add-assertions), configure the [Lighthouse CI server](#the-lighthouse-ci-server) for report diffs and timeseries charts, and enable [GitHub status checks](#github-status-checks). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters