feat(ci): add automated Lighthouse audit pipeline
All checks were successful
Portfolio/pipeline/head This commit looks good
All checks were successful
Portfolio/pipeline/head This commit looks good
This commit is contained in:
28
local-lighthouse.sh
Executable file
28
local-lighthouse.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Clean old audits and containers
|
||||
rm -rf ./.lighthouseci
|
||||
docker rm -f lighthouse-audit || true
|
||||
|
||||
# Load env file and avoid warning for unused portofolio version
|
||||
if [ -f .env.dist ]; then
|
||||
export $(grep -v '^#' .env.dist | xargs)
|
||||
fi
|
||||
export PORTFOLIO_VERSION="local-audit"
|
||||
|
||||
# Create container but no start
|
||||
docker compose --profile audit create --no-build --remove-orphans lighthouse-audit
|
||||
|
||||
# Inject data and config to container
|
||||
docker cp ./dist/. lighthouse-audit:/app/dist/
|
||||
docker cp .lighthouserc.cjs lighthouse-audit:/app/dist/audit-config.cjs
|
||||
|
||||
# Now run
|
||||
docker start -a lighthouse-audit
|
||||
|
||||
# Get reports
|
||||
mkdir -p ./.lighthouseci
|
||||
docker cp lighthouse-audit:/app/.lighthouseci/. ./.lighthouseci/
|
||||
|
||||
# Clean container
|
||||
docker rm -f lighthouse-audit
|
||||
Reference in New Issue
Block a user