-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/IVYPORTAL-17377-Create-pipeline-to-run-Lighthouse-report
_ create github workflow to check lighthouse
- Loading branch information
1 parent
eceb874
commit b1eddae
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: lighthouse-report | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
env: # Define reusable environment variables | ||
NODE_VERSION: '16' | ||
SERVER_URL: http://localhost:8080 | ||
WAIT_TIME: 30 # Time to wait for server to be ready | ||
REPORT_PATH: ./lighthouse-report.html | ||
|
||
jobs: | ||
lighthouse-audit: # Renamed job for clarity | ||
runs-on: portal-01 | ||
steps: | ||
# Step 1: Install Lighthouse CLI | ||
- name: Setup Node.js and Install Lighthouse CLI | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- run: npm install -g lighthouse | ||
|
||
# Step 2: Wait for Application to Start | ||
- name: Wait for Server to Start | ||
run: sleep ${{ env.WAIT_TIME }} | ||
|
||
# Step 3: Run Lighthouse Audit | ||
- name: Execute Lighthouse Audit | ||
run: lighthouse ${{ env.SERVER_URL }} --output=json --output=html --output-path=${{ env.REPORT_PATH }} | ||
|
||
# Step 4: Upload Lighthouse Report as Artifact | ||
- name: Upload Audit Report | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: lighthouse-report | ||
path: ${{ env.REPORT_PATH }} |