Skip to content

feat: lighthouse setting #9

feat: lighthouse setting

feat: lighthouse setting #9

Workflow file for this run

name: lighthouse
on:
workflow_dispatch:
pull_request:
branches:
- "main"
- "dev"
types:
- opened
- synchronize
jobs:
lighthouseci:
runs-on: ubuntu-latest
steps:
- name: Checkout repository // 저장소 체크아웃
uses: actions/checkout@v4
- name: Install pnpm // pnpm 설치
uses: pnpm/action-setup@v3
with:
version: 9.7.0
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Build the project
run: pnpm run build
- name: Run Lighthouse CI // Lighthouse 실행
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
run: |
pnpm i -g @lhci/cli
lhci autorun || echo "Fail to Run Lighthouse CI!"
ls -R lhci_reports # lhci_reports 디렉토리의 구조 출력
- name: Format lighthouse score
id: format_lighthouse_score
uses: actions/github-script@v6
with:
script: |
const script = require('./scripts/lhciFormat.js')
await script({core})
- name: comment result
uses: unsplash/[email protected]
with:
msg: ${{ steps.format_lighthouse_score.outputs.comments }}