Skip to content

Commit

Permalink
feat: add lighthouse conf
Browse files Browse the repository at this point in the history
  • Loading branch information
apurv-wednesday committed Apr 30, 2024
1 parent 036985e commit bbf092d
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 12 deletions.
13 changes: 2 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
node-version: [20.x]

steps:
- uses: actions/checkout@v4
Expand All @@ -33,16 +33,7 @@ jobs:

- name: Build Project
run: yarn build

# commenting for now to make CI green , will try this
# - name: run Lighthouse CI
# run: |
# yarn global add @lhci/[email protected]
# lhci autorun --collect.staticDistDir

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/lighthouseci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
lhci:
name: Lighthouse
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: yarn install and build
run: |
yarn install
yarn build
- name: run Lighthouse CI
run: |
yarn global add @lhci/cli
lhci autorun
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ yarn-error.log*
/public/worker-*.js.map
/public/fallback-*.js
reports
.lighthouseci/*
19 changes: 19 additions & 0 deletions lighthouserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
ci: {
collect: {
startServerCommand: "yarn start",
url: ["http://localhost:3000"],
numberOfRuns: 3,
// default value is mobile
// settings: {
// preset: "desktop",
// },
},
assert: {
preset: "lighthouse:recommended",
},
upload: {
target: "temporary-public-storage",
},
},
};
3 changes: 2 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ sonar.tests=src

# Exclude node_modules
# Let's not exclude anything for now, after refractoring changes we can decide what to exclude from the analysis
sonar.exclusions=node_modules/**/*
sonar.exclusions=node_modules/**/*,lighthouserc.js

sonar.test.inclusions=**/*.test.tsx,**/*.test.js,**/*.test.ts
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
sonar.testExecutionReportPaths=./reports/test-report.xml
Expand Down

0 comments on commit bbf092d

Please sign in to comment.