Skip to content

Commit

Permalink
docs: added first version of docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Danilo Velasquez committed Jul 1, 2024
1 parent f03eb27 commit dacc9b9
Showing 1 changed file with 98 additions and 0 deletions.
98 changes: 98 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,105 @@
# Lighthouse CI Compare Action

[![GitHub Super-Linter](https://github.com/adevinta/actions-lighthouseci-compare/actions/workflows/linter.yml/badge.svg)](https://github.com/super-linter/super-linter)
![CI](https://github.com/adevinta/actions-lighthouseci-compare/actions/workflows/ci.yml/badge.svg)
[![Check dist/](https://github.com/adevinta/actions-lighthouseci-compare/actions/workflows/check-dist.yml/badge.svg)](https://github.com/adevinta/actions-lighthouseci-compare/actions/workflows/check-dist.yml)
[![CodeQL](https://github.com/adevinta/actions-lighthouseci-compare/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/adevinta/actions-lighthouseci-compare/actions/workflows/codeql-analysis.yml)
[![Coverage](./badges/coverage.svg)](./badges/coverage.svg)

This action helps you to based on the results of running lighthouse ci, compare
the current results with the ancestor commit results.

This comparison can be used to create a Markdown table and a comment on the pull
request.

## Getting started

### Prerequisites

- You need to have a Lighthouse CI server running.
- You need to have a Lighthouse CI project created.
- You need to have a `links.json` file generated by Lighthouse CI (this action
needs to run after the Lighthouse CI action).

### Usage

```yaml
- name: Lighthouse CI Compare
uses: adevinta/actions-lighthouseci-compare@v1
with:
links-filepath: '.lighthouseci/links.json'
base-url: 'https://your-lhci-server.com/v1'
project-id: 'your-project-id'
current-commit-sha: ${{ github.sha }}
```
## Inputs
### `links-filepath`

- **Description**: The location of the links.json file generated by Lighthouse
CI.
- **Required**: Yes
- **Default**: `.lighthouseci/links.json`

### `base-url`

- **Description**: The base URL of your lighthouse ci server, for example
`https://your-lhci-server.com/v1`.
- **Required**: Yes

### `project-id`

- **Description**: The project ID of your Lighthouse CI project. This is a GUID.
- **Required**: Yes

### `current-commit-sha`

- **Description**: The current commit SHA.
- **Required**: Yes

## Outputs

### `markdown`

This is a Markdown table with the results of the comparison.

The table looks like this:

<!-- markdownlint-disable -->

| URL | Performance | LCP | CLS | TBT | Link to Report |
| :---------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------: | --------------------------------------------------: | ------------------------------------------: | --------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [/](https://lhci-lighthouse-ci-comparison-lbc.polaris.ariane.leboncoin.ci/) | [72/100 🟢](## 'Performance has improved in +0 points') | [1338 ms 🔴](## 'The lcp has increased in +110 ms') | [0.059 🟢](## 'The CLS has decreased in 0') | [1747 ms 🟢](## 'The tbt has decreased in -42 ms') | [Report](https://lhci.bon-coin.net/app/projects/ravnext/compare/53a135c7-fc1e-4d7e-8636-f4a2852b1e6c?compareUrl=https%3A%2F%2Flhci-BRANCH_NAME-lbc.polaris.ariane.leboncoin.ci%2F) |
| [/_maison_jardin_/offres](https://lhci-lighthouse-ci-comparison-lbc.polaris.ariane.leboncoin.ci/_maison_jardin_/offres) | [68/100 🔴](## 'Performance has decreased in -3 points') | [2045 ms 🔴](## 'The lcp has increased in +532 ms') | [0.048 🟢](## 'The CLS has decreased in 0') | [2518 ms 🔴](## 'The tbt has increased in +258 ms') | [Report](https://lhci.bon-coin.net/app/projects/ravnext/compare/53a135c7-fc1e-4d7e-8636-f4a2852b1e6c?compareUrl=https%3A%2F%2Flhci-BRANCH_NAME-lbc.polaris.ariane.leboncoin.ci%2F_maison_jardin_%2Foffres) |
| [/classified/latest/12](https://lhci-lighthouse-ci-comparison-lbc.polaris.ariane.leboncoin.ci/classified/latest/12) | [73/100 🔴](## 'Performance has decreased in -2 points') | [1181 ms 🔴](## 'The lcp has increased in +120 ms') | [0.002 🟢](## 'The CLS has decreased in 0') | [1803 ms 🔴](## 'The tbt has increased in +347 ms') | [Report](https://lhci.bon-coin.net/app/projects/ravnext/compare/53a135c7-fc1e-4d7e-8636-f4a2852b1e6c?compareUrl=https%3A%2F%2Flhci-BRANCH_NAME-lbc.polaris.ariane.leboncoin.ci%2Fclassified%2Flatest%2F12) |

<!-- markdownlint-enable -->

### `comparedMetrics`

This is the object used to create the table. You can use this output to create
your own results or programmatically in a different script.

The object looks like the following:

```js
{
/classified/latest/12:
{ performance:{currentValue:73,previousValue:75,diff:-2,isRegression:true},
lcp:{currentValue:1181,previousValue:1061,diff:120,isRegression:true},
cls:{currentValue:0.002,previousValue:0.002,diff:0,isRegression:false},
tbt:{currentValue:1803,previousValue:1456,diff:347,isRegression:true}},
/_maison_jardin_/offres:
{ performance:{currentValue:68,previousValue:71,diff:-3,isRegression:true},
lcp:{currentValue:2045,previousValue:1513,diff:532,isRegression:true},
cls:{currentValue:0.048,previousValue:0.048,diff:0,isRegression:false},
tbt:{currentValue:2518,previousValue:2260,diff:258,isRegression:true}},
/:
{ performance:{currentValue:72,previousValue:72,diff:0,isRegression:false},
lcp:{currentValue:1338,previousValue:1228,diff:110,isRegression:true},
cls:{currentValue:0.059,previousValue:0.059,diff:0,isRegression:false},
tbt:{currentValue:1747,previousValue:1789,diff:-42,isRegression:false}}}
```

Which includes the URL as the key and the metrics as the value.

0 comments on commit dacc9b9

Please sign in to comment.