Skip to content

Commit

Permalink
Added healthcheck command, and docker-compose user
Browse files Browse the repository at this point in the history
  • Loading branch information
juanjol committed Apr 7, 2024
1 parent 6166cef commit 51671a4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion commands/lighthouse/lighthouse
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
## Usage: lighthouse
## Example: "ddev lighthouse"
## ExecRaw: true
lhci autorun || true
lhci autorun --collect.outputDir=~/export || true
sh -c 'tar -cf - *.json *.html' | tar -xvf - -C reports/lighthouse/
ls -l reports/lighthouse/
9 changes: 9 additions & 0 deletions commands/lighthouse/lighthouse-hc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

#ddev-generated

## Description: Run lighthouse healthcheck
## Usage: lighthouse-hc
## Example: "ddev lighthouse-hc"
## ExecRaw: true
lhci healthcheck
1 change: 0 additions & 1 deletion docker-compose.lighthouse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ services:
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.approot: $DDEV_APPROOT
user: 'lhci'
entrypoint: [ "docker-entrypoint.sh" ]
environment:
DDEV_HOSTNAME: $DDEV_HOSTNAME
Expand Down
5 changes: 3 additions & 2 deletions lighthouse/lighthouserc.js.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#ddev-generated
// https://github.com/GoogleChrome/lighthouse-ci/blob/main/docs/configuration.md
module.exports = {
ci: {
collect: {
url: [
'http://web/en'
'http://web/'
],
numberOfRuns: 2,
settings: {
Expand All @@ -21,7 +22,7 @@ module.exports = {
},
assert: {
assertions: {
"categories:performance": ["error", {"minScore": 0.88}],
"categories:performance": ["error", {"minScore": 0.9}],
"categories:accessibility": ["error", {"minScore": 0.9}],
"categories:best-practices": ["error", {"minScore": 0.9}],
"categories.seo": ["error", {"minScore": 0.9}],
Expand Down
2 changes: 1 addition & 1 deletion tests/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ setup() {
}

health_checks() {
output=$(ddev exec -s lighthouse lhci healthcheck)
output=$(ddev lighthouse-hc)
# Check if the output contains "Healthcheck passed!"
[[ $output == *"Healthcheck passed"* ]]
}
Expand Down

0 comments on commit 51671a4

Please sign in to comment.