Lighthouse: execution de pa11y pour compléter l'audit d'accessibilité
This commit is contained in:
parent
4fe6feb1a1
commit
19884e6719
|
@ -35,6 +35,7 @@ RUN apk add --no-cache \
|
||||||
chromium
|
chromium
|
||||||
|
|
||||||
RUN npm install -g lighthouse
|
RUN npm install -g lighthouse
|
||||||
|
RUN PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 npm install -g pa11y pa11y-reporter-html
|
||||||
|
|
||||||
RUN adduser -D lighthouse
|
RUN adduser -D lighthouse
|
||||||
|
|
||||||
|
@ -42,6 +43,7 @@ COPY run-audit.sh /usr/local/bin/run-audit
|
||||||
RUN chmod +x /usr/local/bin/run-audit
|
RUN chmod +x /usr/local/bin/run-audit
|
||||||
|
|
||||||
COPY config.js.tmpl /home/lighthouse/config.js.tmpl
|
COPY config.js.tmpl /home/lighthouse/config.js.tmpl
|
||||||
|
COPY patty.json.tmpl /home/lighthouse/patty.json.tmpl
|
||||||
|
|
||||||
WORKDIR /home/lighthouse
|
WORKDIR /home/lighthouse
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"chromeLaunchConfig": {
|
||||||
|
"args": ["--disable-dev-shm-usage", "--no-sandbox", "--disable-gpu"],
|
||||||
|
"ignoreHTTPSErrors": true
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
envtpl -o config.js /home/lighthouse/config.js.tmpl
|
envtpl -o config.js /home/lighthouse/config.js.tmpl
|
||||||
|
envtpl -o patty.json /home/lighthouse/patty.json.tmpl
|
||||||
|
|
||||||
mkdir -p reports
|
mkdir -p reports
|
||||||
rm -f reports/*
|
rm -f reports/*
|
||||||
|
@ -14,4 +17,12 @@ lighthouse \
|
||||||
--output json --output html \
|
--output json --output html \
|
||||||
--output-path=lighthouse \
|
--output-path=lighthouse \
|
||||||
-- \
|
-- \
|
||||||
"$LIGHTHOUSE_URL"
|
"$LIGHTHOUSE_URL"
|
||||||
|
|
||||||
|
export PUPPETEER_EXECUTABLE_PATH=$(which chromium-browser)
|
||||||
|
|
||||||
|
pa11y --reporter html \
|
||||||
|
--config ../patty.json \
|
||||||
|
--include-warnings \
|
||||||
|
--include-notices \
|
||||||
|
"$LIGHTHOUSE_URL" > pa11y.report.html || exit 0
|
||||||
|
|
|
@ -30,7 +30,7 @@ def call() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage("Run Lighthouse audit") {
|
stage("Run Lighthouse and pa11y audits") {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def lighthouseImage = buildDockerImage()
|
def lighthouseImage = buildDockerImage()
|
||||||
|
@ -39,12 +39,14 @@ def call() {
|
||||||
"""
|
"""
|
||||||
timeout(params.auditTimeout.toInteger()) {
|
timeout(params.auditTimeout.toInteger()) {
|
||||||
lighthouseImage.inside(dockerArgs) {
|
lighthouseImage.inside(dockerArgs) {
|
||||||
sh 'run-audit'
|
sh 'chown -R lighthouse: ./'
|
||||||
|
sh 'su lighthouse - /usr/local/bin/run-audit'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
|
@ -54,8 +56,8 @@ def call() {
|
||||||
alwaysLinkToLastBuild: false,
|
alwaysLinkToLastBuild: false,
|
||||||
keepAll: true,
|
keepAll: true,
|
||||||
reportDir: 'reports',
|
reportDir: 'reports',
|
||||||
reportFiles: 'lighthouse.report.html',
|
reportFiles: '*.report.html',
|
||||||
reportName: "Rapport Lighthouse"
|
reportName: "Rapports d'audit"
|
||||||
]
|
]
|
||||||
cleanWs()
|
cleanWs()
|
||||||
}
|
}
|
||||||
|
@ -64,10 +66,13 @@ def call() {
|
||||||
rocketSend (
|
rocketSend (
|
||||||
avatar: 'https://jenkins.cadol.es/static/b5f67753/images/headshot.png',
|
avatar: 'https://jenkins.cadol.es/static/b5f67753/images/headshot.png',
|
||||||
message: """
|
message: """
|
||||||
L'audit Lighthouse pour `${params.url}` est terminé.
|
Les audits pour `${params.url}` sont terminés:
|
||||||
|
|
||||||
[Voir le rapport](${env.BUILD_URL}Rapport_20Lighthouse/)
|
- [Voir le rapport Lighthouse (bonnes pratiques)](${env.BUILD_URL}Rapports_20d_27audit/lighthouse.report.html)
|
||||||
|
- [Voir le rapport pa11y (accessibilité)](${env.BUILD_URL}Rapports_20d_27audit/pa11y.report.html)
|
||||||
|
|
||||||
|
[Lancer un nouvel audit](${env.BUILD_URL}../build)
|
||||||
|
|
||||||
@${env.BUILD_USER_ID ? env.BUILD_USER_ID : 'here'}
|
@${env.BUILD_USER_ID ? env.BUILD_USER_ID : 'here'}
|
||||||
""".stripIndent(),
|
""".stripIndent(),
|
||||||
rawMessage: true
|
rawMessage: true
|
||||||
|
@ -75,17 +80,19 @@ def call() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
failure {
|
failure {
|
||||||
rocketSend (
|
wrap([$class: 'BuildUser']) {
|
||||||
avatar: 'https://jenkins.cadol.es/static/b5f67753/images/headshot.png',
|
rocketSend (
|
||||||
message: """
|
avatar: 'https://jenkins.cadol.es/static/b5f67753/images/headshot.png',
|
||||||
L'audit Lighthouse pour `${params.url}` a échoué:
|
message: """
|
||||||
|
L'audit Lighthouse pour `${params.url}` a échoué:
|
||||||
[Voir le job](${env.RUN_DISPLAY_URL})
|
|
||||||
|
[Voir le job](${env.RUN_DISPLAY_URL})
|
||||||
@${env.BUILD_USER_ID ? env.BUILD_USER_ID : 'here'}
|
|
||||||
""".stripIndent(),
|
@${env.BUILD_USER_ID ? env.BUILD_USER_ID : 'here'}
|
||||||
rawMessage: true
|
""".stripIndent(),
|
||||||
)
|
rawMessage: true
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,6 +104,7 @@ def buildDockerImage() {
|
||||||
def resourceFiles = [
|
def resourceFiles = [
|
||||||
'com/cadoles/lighthouse/Dockerfile',
|
'com/cadoles/lighthouse/Dockerfile',
|
||||||
'com/cadoles/lighthouse/config.js.tmpl',
|
'com/cadoles/lighthouse/config.js.tmpl',
|
||||||
|
'com/cadoles/lighthouse/patty.json.tmpl',
|
||||||
'com/cadoles/lighthouse/run-audit.sh'
|
'com/cadoles/lighthouse/run-audit.sh'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue