Skip to content

Commit 8e2e113

Browse files
authored
feat: lighthouse-github-actions-integrations-added (#17)
* feat: lighthouse-github-actionsintegrations-added Signed-off-by: Achanandhi-M <[email protected]> * lighthouse-modified --------- Signed-off-by: Achanandhi-M <[email protected]>
1 parent e02dd9f commit 8e2e113

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/lighthouse.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Lighthouse score
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '**'
7+
8+
jobs:
9+
lighthouse:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout PR branch
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: 18
19+
20+
- name: Install static server
21+
run: npm install -g serve
22+
23+
- name: Serve PR branch (background on port 3001)
24+
run: |
25+
serve . -l 3001 &
26+
sleep 5
27+
- name: Checkout main branch into separate folder
28+
run: |
29+
git fetch origin main
30+
git worktree add main-branch origin/main
31+
- name: Serve Main branch (background on port 3000)
32+
run: |
33+
cd main-branch
34+
serve . -l 3000 &
35+
cd ..
36+
sleep 5
37+
38+
- name: Create output directory for Lighthouse
39+
run: mkdir -p ${{ github.workspace }}/tmp/artifacts
40+
41+
- name: Run Lighthouse audit for both PR and Main
42+
uses: foo-software/lighthouse-check-action@master
43+
with:
44+
gitAuthor: ${{ github.actor }}
45+
gitBranch: ${{ github.head_ref }}
46+
outputDirectory: ${{ github.workspace }}/tmp/artifacts
47+
urls: 'http://localhost:3000/?branch=main,http://localhost:3001/?branch=pr'
48+
sha: ${{ github.sha }}

0 commit comments

Comments
 (0)