Skip to content

Commit

Permalink
Merge pull request #39 from wednesday-solutions/feat/add-lighthouse-conf
Browse files Browse the repository at this point in the history
feat: add lighthouse conf
  • Loading branch information
alichherawalla authored May 10, 2024
2 parents 8b0ef35 + 2983797 commit 70c9fe8
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 14 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
name: Next Bulletproof Template CI

on:
pull_request:
branches: [main]
push:
branches: [main]

jobs:
build-lint-test-lhci:
name: Build & Lint
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
node-version: [20.x]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
Expand All @@ -33,23 +36,21 @@ 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 }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

# commenting for now to make CI green , will try this
# Commenting out SonarQube Quality Gate action for now
# - uses: sonarsource/sonarqube-quality-gate-action@master
# timeout-minutes: 5
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run Lighthouse CI
run: |
yarn global add @lhci/[email protected]
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/*
20 changes: 20 additions & 0 deletions lighthouserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
ci: {
collect: {
startServerCommand: "yarn start",
url: ["http://localhost:3000"],
numberOfRuns: 3,
},
assert: {
assertions: {
'categories:performance': ['error', { minScore: 0.90 }],
'categories:accessibility': ['error', { minScore: 0.90 }],
'categories:best-practices': ['error', { minScore: 0.90 }],
'categories:seo': ['error', { minScore: 0.90 }]
}
},
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 70c9fe8

Please sign in to comment.