-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (43 loc) · 1.59 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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: yarn
- name: Build App -- But do you we need to build here?
working-directory: apps/docs
#run: yarn workspace docs run build
run: yarn run build
- name: Deploy apps/docs to Vercel
uses: amondnet/vercel-action@v20
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-args: --yes
build-dir: apps/docs/.next
- 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: |
cd apps/docs
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'