[ issue#18 ]- Implement Lighthouse in CI Pipeline #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test-and-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm ci | |
- name: Run linter | |
run: npm run lint | |
- name: Check for TypeScript errors | |
run: npm run type-check | |
- name: Run tests | |
run: npm test | |
- name: Build | |
run: npm run build | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: .next | |
lighthouse: | |
needs: test-and-build | |
name: run Lighthouse CI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: .next | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Lighthouse CI | |
run: npm install -g @lhci/[email protected] | |
- name: Run Lighthouse CI | |
run: lhci autorun | |
env: | |
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} |