Skip to content

Commit

Permalink
fix: modify lighthouse config for deployed PR
Browse files Browse the repository at this point in the history
  • Loading branch information
sniperadmin committed May 8, 2020
1 parent 30fe194 commit b973392
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/lighthouse/budget.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"resourceSizes": [
{
"resourceType": "script",
"budget": 300
"budget": 200
},
{
"resourceType": "stylesheet",
"budget": 120
},
{
"resourceType": "font",
"budget": 306
"budget": 200
},
{
"resourceType": "image",
Expand Down
4 changes: 4 additions & 0 deletions .github/lighthouse/lighthouserc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"ci": {
"collect": {
"numberOfRuns": 2,
"startServerCommand": "npm run serve"
},
"assert": {
"preset": "lighthouse:recommended",
"assertions": {
Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,34 @@ on:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job
build:
lighthouse:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v1

- name: NPM install and Build
run: |
npm i
npm run build
- name: Waiting for 200 from the Netlify Preview
uses: jakepartusch/wait-for-netlify-action@v1
id: waitFor200
with:
site_name: "lighthouse-ci-pr"

#runs the lighthouse
- name: Lighthouse CI Action
uses: treosh/lighthouse-ci-action@v2
with:
urls: |
localhost:8080/
$DEPLOY_URL
budgetPath: '.github/lighthouse/budget.json' # test performance budgets
configPath: '.github/lighthouse/lighthouserc.json'
# Path to a LHCI lighthouserc.json file
Expand All @@ -36,3 +49,5 @@ jobs:
# Number of runs to do per URL
serverBaseUrl: ${{ secrets.LHCI_SERVER_URL }}
serverToken: ${{ secrets.LHCI_SERVER_TOKEN }}
env:
DEPLOY_URL: ${{ steps.waitFor200.outputs.url }}

0 comments on commit b973392

Please sign in to comment.