ci(aio): verify that the Lighthouse PWA score remains above a threshold

This commit is contained in:
Georgios Kalpakas
2017-04-01 02:24:25 +03:00
committed by Pete Bacon Darwin
parent a73050de48
commit 49d97e1216
8 changed files with 366 additions and 19 deletions

View File

@ -6,14 +6,17 @@ set +x -eu -o pipefail
INPUT_DIR=dist/
OUTPUT_FILE=/tmp/snapshot.tar.gz
AIO_BUILDS_HOST=https://ngbuilds.io
UPLOAD_URL=$AIO_BUILDS_HOST/create-build/$TRAVIS_PULL_REQUEST/$TRAVIS_PULL_REQUEST_SHA
AIO_BUILDS_DOMAIN=ngbuilds.io
UPLOAD_URL=https://$AIO_BUILDS_DOMAIN/create-build/$TRAVIS_PULL_REQUEST/$TRAVIS_PULL_REQUEST_SHA
DEPLOYED_URL=https://pr$TRAVIS_PULL_REQUEST-$TRAVIS_PULL_REQUEST_SHA.$AIO_BUILDS_DOMAIN
cd "`dirname $0`/.."
yarn run build
# Build the app
yarn build
tar --create --gzip --directory "$INPUT_DIR" --file "$OUTPUT_FILE" .
# Deploy to staging
exec 3>&1
httpCode=$(
curl --include --location --request POST --silent --write-out "\nHTTP_CODE: %{http_code}\n" \
@ -30,4 +33,7 @@ if [ $httpCode -lt 200 ] || ([ $httpCode -ge 400 ] && [ $httpCode -ne 409 ]); th
exit 1
fi
# Run PWA-score tests
yarn test-pwa-score -- "$DEPLOYED_URL" "$MIN_PWA_SCORE_PREVIEW"
cd -