Skip to content

Update instruction files #18

Update instruction files

Update instruction files #18

Workflow file for this run

name: Performance Monitoring
on:
pull_request:
branches: [main, develop]
push:
branches: [main, develop]
jobs:
lighthouse:
name: Lighthouse CI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Build assets
run: npm run build
- name: Setup WordPress test environment
run: |
docker run -d --name wordpress \
-p 8888:80 \
-e WORDPRESS_DB_HOST=mysql \
-e WORDPRESS_DB_USER=wordpress \
-e WORDPRESS_DB_PASSWORD=wordpress \
-e WORDPRESS_DB_NAME=wordpress \
wordpress:latest
docker run -d --name mysql \
-e MYSQL_ROOT_PASSWORD=rootpass \
-e MYSQL_DATABASE=wordpress \
-e MYSQL_USER=wordpress \
-e MYSQL_PASSWORD=wordpress \
mysql:8.0
- name: Wait for WordPress
run: |
timeout 60 bash -c 'until curl -f http://localhost:8888; do sleep 2; done'
- name: Run Lighthouse CI
run: npx @lhci/[email protected] autorun
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
- name: Upload Lighthouse reports
uses: actions/upload-artifact@v4
if: always()
with:
name: lighthouse-reports
path: lighthouse-reports/
retention-days: 30
bundle-size:
name: Bundle Size Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Build for production
run: npm run build
- name: Check bundle size
run: npm run size-limit
- name: Analyze bundle
run: npm run analyze-bundle
continue-on-error: true
- name: Upload bundle analysis
uses: actions/upload-artifact@v4
if: always()
with:
name: webpack-bundle-report
path: build/bundle-report.html
retention-days: 30
performance-budget:
name: Performance Budget Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Build assets
run: npm run build
- name: Check file sizes
run: |
echo "## Build Asset Sizes" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| File | Size | Gzipped |" >> $GITHUB_STEP_SUMMARY
echo "|------|------|---------|" >> $GITHUB_STEP_SUMMARY
for file in build/*.js build/*.css build/blocks/*/*.js build/blocks/*/*.css; do
if [ -f "$file" ]; then
size=$(wc -c < "$file" | numfmt --to=iec-i --suffix=B)
gzip_size=$(gzip -c "$file" | wc -c | numfmt --to=iec-i --suffix=B)
echo "| $(basename $file) | $size | $gzip_size |" >> $GITHUB_STEP_SUMMARY
fi
done
- name: Fail if size limits exceeded
run: npm run size-limit