Skip to content

Commit

Permalink
Merge pull request #18 from SanjeebLama/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
SanjeebLama authored Apr 30, 2023
2 parents dce761f + abf1e20 commit 110b0c2
Show file tree
Hide file tree
Showing 5 changed files with 1,074 additions and 27 deletions.
48 changes: 48 additions & 0 deletions apps/docs/.github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Lighthouse CI

on: push

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Install Dependencies
run: npm install

- name: Build App
run: npm run build

- name: Deploy to Vercel
uses: amondnet/vercel-action@v20
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-args: --yes

- name: Wait for Deployment
run: |
echo "Waiting for deployment to finish..."
preview_url=$(curl -s -H "Authorization: Bearer ${{ secrets.VERCEL_TOKEN }}" "https://api.vercel.com/v6/deployments?projectId=${{ secrets.VERCEL_PROJECT_ID }}&limit=1" | jq -r ".deployments[0].url")
while [[ $(curl -sL -w "%{http_code}\\n" "${preview_url}" -o /dev/null) != "200" ]]; do sleep 10; done
echo "Deployment finished. Preview URL: $preview_url"
echo "PREVIEW_URL=$preview_url" >> $GITHUB_ENV
- name: Run Lighthouse Tests
run: |
npm install -g @lhci/[email protected]
lhci autorun
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}

- name: Upload Lighthouse Reports
uses: actions/upload-artifact@v2
with:
name: lhci-report
path: './.lighthouseci'
1 change: 1 addition & 0 deletions apps/docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.lighthouseci/
15 changes: 15 additions & 0 deletions apps/docs/lighthouserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
ci: {
collect: {
url: 'http://localhost:3001',
startServerCommand: 'yarn run dev',
},
assert: {
preset: 'lighthouse:no-pwa',
},
upload: {
target: 'temporary-public-storage',
},
},
};

7 changes: 5 additions & 2 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"dev": "next dev --port 3001",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"test:lighthouse": "yarn run build && lhci autorun"
},
"dependencies": {
"next": "^13.1.1",
Expand All @@ -16,6 +17,8 @@
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@lhci/cli": "^0.12.0",
"@lhci/server": "^0.12.0",
"@types/node": "^17.0.12",
"@types/react": "^18.0.22",
"@types/react-dom": "^18.0.7",
Expand All @@ -28,4 +31,4 @@
"tsconfig": "*",
"typescript": "^4.5.3"
}
}
}
Loading

0 comments on commit 110b0c2

Please sign in to comment.