Skip to content

Commit

Permalink
Merge f3cfc6a into b3ce67a
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffin143 committed Nov 30, 2019
2 parents b3ce67a + f3cfc6a commit 2af9a63
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ coverage
public/js/
bin/
dist/

# Lighthouse audit report files
.lighthouseci/
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
sudo: false
language: node_js
node_js:
- '8'
- '10'
services: mongodb
branches:
only:
- master
cache:
directories:
- node_modules
- dist
- .cache
- bin
before_install:
- npm update
install:
- npm install
script:
- npm run webpack
- ./scripts/lighthouse.sh
- npm run lint
- npm run test
- npm run coveralls

19 changes: 19 additions & 0 deletions lighthouserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"ci": {
"assert": {
"assertions": {
"categories.pwa": "off",
"categories:performance": ["warm", { "minScore": 0.1 }],
"categories:accessibility": ["error", { "minScore": 0.25 }],
"categories:best-practices": ["error", { "minScore": 0.6 }],
"categories:seo": ["error", { "minScore": 0.5 }]
}
},
"collect": {
"url": "http://localhost:5000"
},
"upload": {
"target": "temporary-public-storage"
}
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"dependencies": {
"@babel/polyfill": "^7.4.3",
"@babel/runtime": "^7.5.5",
"@lhci/cli": "^0.3.4",
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"cors": "^2.8.4",
Expand Down
35 changes: 35 additions & 0 deletions scripts/funtions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

startserver() {
echo "starting server"
node bin/server.js &
pid1=$!
echo "PID is $pid1";

}

stopserver() {
echo "Killing all node processes"
kill $pid1;
echo "Exiting with code $RETURN_CODE"
exit $RETURN_CODE
}

# Wait for a service to be up Since I don't know how much time it will take
wait_for_service() {
echo "> Waiting for $1 to be ready... "
while true; do
nc -z "$2" "$3"
EXIT_CODE=$?
if [ $EXIT_CODE -eq 0 ]; then
echo "> Application $1 is up!"
break
fi
sleep 1
done
}

wait_for_app_services() {
echo ""
wait_for_service Server 127.0.0.1 5000
}
16 changes: 16 additions & 0 deletions scripts/lighthouse.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

RETURN_CODE=0

. ./scripts/funtions.sh
startserver
wait_for_app_services
echo ""
echo "> Running lighthouse"
npx lhci autorun
RETURN_CODE=$?

stopserver


exit $RETURN_CODE

0 comments on commit 2af9a63

Please sign in to comment.