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

Adding in Cloudbuild documentation #501

Merged
merged 3 commits into from
Nov 30, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 53 additions & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 better (see: https://github.com/GoogleChrome/lighthouse/blob/master/docs/variability.md). Look through the [Cloudbuild machine pricing](https://cloud.google.com/cloud-build/pricing)
annez marked this conversation as resolved.
Show resolved Hide resolved

**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/cli@0.6.x && lhci autorun --failOnUploadFailure']
env:
- 'LHCI_BUILD_CONTEXT__CURRENT_BRANCH=$BRANCH_NAME'

options:
machineType: 'N1_HIGHCPU_32'
annez marked this conversation as resolved.
Show resolved Hide resolved
```

</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).
Expand Down
1 change: 1 addition & 0 deletions docs/introduction-to-ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ There are many CI providers out there to choose from. Lighthouse CI works with a
- [GitLab CI](https://docs.gitlab.com/ee/ci/quick_start/)
- [Travis CI](https://docs.travis-ci.com/user/tutorial/)
- [Circle CI](https://circleci.com/docs/2.0/getting-started/)
- [Google Cloudbuild](https://cloud.google.com/cloud-build/docs/quickstart-build)