Skip to content

feat: lighthouse ci pipeline #55

feat: lighthouse ci pipeline

feat: lighthouse ci pipeline #55

Workflow file for this run

name: CI
on:
pull_request:
branches:
- "**"
jobs:
lhci:
name: Lighthouse
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install dependencies
run: |
npm install
npm run build
- name: run Lighthouse CI for the Application
run: |
npm install -g @lhci/[email protected]
lhci autorun --config=lighthouserc.json --collect.url="http://localhost:3000" --collect.startServerCommand="npm run start" --upload.outputDir="./lhci-reports/app"
# - name: run Lighthouse CI for Keploy.io Deployed Website
# run: |
# npm install -g @lhci/[email protected]
# lhci autorun --config=lighthouserc.json --collect.url="https://www.keploy.io" --upload.outputDir="./lhci-reports/keploy.io"
# - name: Compare Lighthouse Reports
# run: |
# node compare-lhci-reports.js
audit-main:
name: Audit Main Branch
runs-on: ubuntu-latest
steps:
# 1. Checkout the main branch
- name: Checkout Main Branch
uses: actions/checkout@v3
with:
ref: main
path: main
# 2. Setup Node.js 18.x for main branch
- name: Setup Node.js for Main
uses: actions/setup-node@v3
with:
node-version: 18.x
# 3. Install dependencies and build main branch
- name: Install Dependencies and Build Main
run: |
cd main
npm install
npm run build
# 6. Install Lighthouse CI globally
- name: Install Lighthouse CI
run: npm install -g @lhci/[email protected]
# 7. Run LHCI for the Main Branch
- name: Run Lighthouse CI for Main Branch
run: |
cd main
lhci autorun --config=../lighthouserc.json --collect.url="http://localhost:3000" --collect.startServerCommand="npm run start" --upload.outputDir="../lhci-reports/main"
compare-reports:
name: Compare Lighthouse Reports
runs-on: ubuntu-latest
needs: [audit-main, lhci]
steps:
# # 1. Download Main Report
# - name: Download Main Report
# uses: actions/download-artifact@v3
# with:
# name: main-report
# path: ./reports/main
# # 2. Download PR Report
# - name: Download PR Report
# uses: actions/download-artifact@v3
# with:
# name: pr-report
# path: ./reports/pr
# # 3. Checkout the repository (to access scripts)
# - name: Checkout Repository for Scripts
# uses: actions/checkout@v3
# 4. Run the Comparison Script
- name: Compare Lighthouse Reports
run: |
node compare-lhci-reports.js