Skip to content

Commit

Permalink
Improve linting, docs
Browse files Browse the repository at this point in the history
  • Loading branch information
denar90 committed Feb 29, 2020
1 parent 9d184cf commit d200ba3
Show file tree
Hide file tree
Showing 21 changed files with 1,227 additions and 196 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/LHCI-assert-netlify-on-budget-notification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: LHCI-assert-netlify-on-budget-notification
on: pull_request
jobs:
# This pass/fails a build with a budgets.json.
assert-on-budget:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Run Lighthouse on Netlify urls and validate with budgets.json
uses: ./
with:
urls: |
https://practical-allen-be16f3.netlify.com
https://practical-allen-be16f3.netlify.com/products/
https://practical-allen-be16f3.netlify.com/contact/
netlifySite: 'practical-allen-be16f3.netlify.com'
budgetPath: '.github/lighthouse/budget.json'
slackWebhookUrl: ${{ secrets.SLACK_WEBHOOK_URL }}
applicationGithubToken: ${{ secrets.GITHUB_TOKEN }}
personalGithubToken: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
logLevel: 'error'
70 changes: 70 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- 💾 Upload data to LHCI server
- 🔔 Slack notification
- 😻 GitHub notification
- 🛳️ Automatic check of Netlify preview urls

<img align="center" width="1046" alt="Lighthouse CI Action" src="https://user-images.githubusercontent.com/158189/68597493-58896f80-049d-11ea-97a2-5c4e7eb4285c.png">

Expand Down Expand Up @@ -174,6 +175,17 @@ Use `error` value to send notifications only for failed CI checks.
logLevel: 'error'
```

### netlifySite

Netlify site name.
It enables run LHCI check against [Netlify deploy preview](https://www.netlify.com/blog/2016/07/20/introducing-deploy-previews-in-netlify/) to make sure your changes are not gonna slow down production.

```yml
netlifySite: 'practical-allen-be16f3.netlify.com'
```

[Read more](#recipes) about detailed configuration.

## Recipes

<details>
Expand Down Expand Up @@ -283,6 +295,64 @@ Make a `budget.json` file with [budgets syntax](https://web.dev/use-lighthouse-f

</details>

<details>
<summary>Run LHCI against Netlify preview site</summary><br>

Create `.github/workflows/main.yml` with the list of URLs, enable notifications to audit
and identify a budget with `budgetPath`.

#### main.yml

```yml
name: LHCI-assert-netlify-on-budget-notification
on: pull_request
jobs:
# This pass/fails a build with a budgets.json.
assert-on-budget:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Run Lighthouse on Netlify urls and validate with budgets.json
uses: ./
with:
urls: |
https://practical-allen-be16f3.netlify.com
https://practical-allen-be16f3.netlify.com/products/
https://practical-allen-be16f3.netlify.com/contact/
netlifySite: 'practical-allen-be16f3.netlify.com'
budgetPath: '.github/lighthouse/budget.json'
slackWebhookUrl: ${{ secrets.SLACK_WEBHOOK_URL }}
applicationGithubToken: ${{ secrets.GITHUB_TOKEN }}
personalGithubToken: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
logLevel: 'error'
```

Make a `budget.json` file with [budgets syntax](https://web.dev/use-lighthouse-for-performance-budgets/).

> **Note**: Under the hood, this will be transformed into LHCI assertions.

#### budgets.json

```json
[
{
"path": "/*",
"resourceSizes": [
{
"resourceType": "document",
"budget": 18
},
{
"resourceType": "total",
"budget": 200
}
]
}
]
```

</details>

<details>
<summary>Run Lighthouse and validate against LHCI assertions.</summary><br>

Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ inputs:
description: 'GitHub Application access token for '
personalGithubToken:
description: 'GitHub access token'
netlifySite:
description: 'Netlify site name'
upload.serverBaseUrl:
description: 'Address of a LHCI server'
upload.token:
Expand Down
12 changes: 9 additions & 3 deletions node_modules/@types/node-fetch/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d200ba3

Please sign in to comment.