feat(ci): add automated Lighthouse audit pipeline #2
5
Jenkinsfile
vendored
5
Jenkinsfile
vendored
@@ -20,11 +20,14 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
// Temporary container to get data in /dist folder
|
// Temporary container to get data in /dist folder
|
||||||
// Reuse of just build portfolio image
|
// Reuse of just build portfolio image
|
||||||
sh "mkdir -p ./dist-audit ./.lighthouseci"
|
sh "mkdir -p ./dist-audit ./.lighthouseci"
|
||||||
sh "docker create --name audit-tmp portfolio:${env.APP_VERSION}"
|
sh "docker create --name audit-tmp portfolio:${env.APP_VERSION}"
|
||||||
sh "docker cp audit-tmp:/usr/share/caddy/. ./dist-audit"
|
sh "docker cp audit-tmp:/usr/share/caddy/. ./dist-audit"
|
||||||
sh "docker rm audit-tmp"
|
sh "docker rm audit-tmp"
|
||||||
|
|
||||||
|
// Add audit config in the same folder
|
||||||
|
sh "cp .lighthouserc.cjs ./dist-audit/audit-config.cjs"
|
||||||
|
|
||||||
// Launch special service in docker compose
|
// Launch special service in docker compose
|
||||||
sh "docker compose --profile audit run --rm lighthouse-audit"
|
sh "docker compose --profile audit run --rm lighthouse-audit"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ services:
|
|||||||
container_name: lighthouse-audit
|
container_name: lighthouse-audit
|
||||||
user: "0:0"
|
user: "0:0"
|
||||||
volumes:
|
volumes:
|
||||||
- ${PWD}/dist-audit:/app/dist
|
# astro file + config
|
||||||
- ${PWD}/.lighthouseci:/app/.lighthouseci
|
- ./dist-audit:/app/dist
|
||||||
- ${PWD}/.lighthouserc.cjs:/app/.lighthouserc.cjs
|
- ./.lighthouseci:/app/.lighthouseci
|
||||||
environment:
|
environment:
|
||||||
- CHROME_PATH=/usr/bin/chromium-browser
|
- CHROME_PATH=/usr/bin/chromium-browser
|
||||||
working_dir: /app
|
working_dir: /app
|
||||||
command: npx @lhci/cli@${LHCI_VERSION} collect --config=/app/.lighthouserc.cjs
|
command: npx @lhci/cli@${LHCI_VERSION} collect --config=/app/dist/audit-config.cjs
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
reverse-proxy:
|
reverse-proxy:
|
||||||
|
|||||||
Reference in New Issue
Block a user