Skip to content

Create Lighthouse Audit #60

Create Lighthouse Audit

Create Lighthouse Audit #60

name: lighthouse-report
run-name: Create Lighthouse Audit
on:
push:
branches: [feature/IVYPORTAL-17377-Create-pipeline-to-run-Lighthouse-report]
pull_request:
branches: [master]
env:
ENGINE_DIR: $GITHUB_WORKSPACE/ivy/engine/nightly
ENGINE_URL: https://developer.axonivy.com/permalink/nightly/axonivy-engine.zip
WAIT_TIME: 180
SERVER_URL: http://localhost:8080
jobs:
setup:
runs-on: ubuntu-latest
outputs:
engine_dir: ${{ env.ENGINE_DIR }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '21'
- uses: stCarolas/setup-maven@v5
with:
maven-version: 3.9.8
- name: Setup Engine
run: |
mkdir -p $ENGINE_DIR
cd $ENGINE_DIR
wget $ENGINE_URL -O engine.zip
unzip -o engine.zip
chmod +x bin/AxonIvyEngine
build:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Build Modules
run: |
for module in {portal-components,portal,PortalKitTestHelper}; do
mvn -f AxonIvyPortal/$module/pom.xml clean install
done
lighthouse:
needs: [setup, build]
runs-on: ubuntu-latest
steps:
- name: Setup Chrome
run: |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install -y google-chrome-stable xvfb
- name: Run Audit
run: |
mkdir -p reports
xvfb-run --server-args="-screen 0 1920x1080x24" \
npx lighthouse ${{ env.SERVER_URL }} \
--chrome-flags="--headless --no-sandbox --disable-gpu" \
--output=json,html \
--output-path=./reports/report
- name: Upload Reports
id: upload
uses: actions/upload-artifact@v4
with:
name: lighthouse-reports
path: reports/*
- name: Generate Summary
run: |
cd reports
if [ -f "report.json" ]; then
{
echo "# 🚦 Lighthouse Results"
echo "Generated: $(date)"
echo "## Performance Scores"
jq -r '.categories[] | "### \(.title)\n📊 Score: \(.score * 100 | floor)%"' report.json
echo "---"
echo "📋 [View Report](https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/artifacts/${{ steps.upload.outputs.artifact-id }})"
} >> $GITHUB_STEP_SUMMARY
fi