This commit is contained in:
18
Jenkinsfile
vendored
18
Jenkinsfile
vendored
@@ -33,32 +33,32 @@ pipeline {
|
||||
sh "docker run --rm --volumes-from jenkins -w \$(pwd) static-toolbox '${env.SOURCE_DIR}/**/*.html' --config .htmlhintrc"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Lighthouse Audit') {
|
||||
steps {
|
||||
echo "Running Lighthouse audit..."
|
||||
// Clean old report and containers
|
||||
echo "Running Lighthouse audit..."
|
||||
// Clean old report and prepare reports and npm cache folders
|
||||
sh """
|
||||
docker run --rm --volumes-from jenkins -w \$(pwd) alpine:latest \
|
||||
sh -c "rm -rf ./.lighthouseci && mkdir -p ./.lighthouseci && chmod 777 ./.lighthouseci"
|
||||
"""
|
||||
|
||||
sh "docker rm -f lighthouse-audit || true"
|
||||
# On s'assure que le dossier existe et qu'il est accessible par tous les conteneurs
|
||||
docker run --rm -v /home/lucas/.npm-cache:/tmp/npm-cache alpine:latest \
|
||||
sh -c "mkdir -p /tmp/npm-cache && chmod 777 /tmp/npm-cache"
|
||||
"""
|
||||
|
||||
// Run
|
||||
sh """
|
||||
docker run --name lighthouse-audit \
|
||||
docker run --rm \
|
||||
--volumes-from jenkins \
|
||||
-w \$(pwd) \
|
||||
-e CHROME_PATH=/usr/bin/chromium-browser \
|
||||
-v /home/lucas/.npm-cache:/tmp/npm-cache \
|
||||
-e npm_config_cache=/tmp/npm-cache \
|
||||
-e CHROME_PATH=/usr/bin/chromium-browser \
|
||||
--entrypoint "" \
|
||||
zenika/alpine-chrome:with-node \
|
||||
npx --prefer-offline -p @lhci/cli@0.13.0 lhci autorun --config=./.lighthouserc.cjs
|
||||
"""
|
||||
|
||||
// Clean
|
||||
sh "docker rm -f lighthouse-audit"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user