fix: dont fail if reports were written
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2021-05-21 15:14:44 +02:00
parent 72830cce0b
commit cc78d173b7
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61

View File

@ -10,7 +10,7 @@ if [ -f "$CONFIG" ] && echo "$OUT" | grep -q "Done running Lighthouse"; then
UPLOAD_TARGET=$(yq e '.ci.upload.target // ""' "${CONFIG}") UPLOAD_TARGET=$(yq e '.ci.upload.target // ""' "${CONFIG}")
UPLOAD_OUTPUT_DIR=$(yq e '.ci.upload.outputDir // ""' "${CONFIG}") UPLOAD_OUTPUT_DIR=$(yq e '.ci.upload.outputDir // ""' "${CONFIG}")
if [ "${UPLOAD_TARGET}" = "filesystem" ] && [ -n "${UPLOAD_OUTPUT_DIR}" ] ; then if [ "${UPLOAD_TARGET}" = "filesystem" ] && [ -n "${UPLOAD_OUTPUT_DIR}" ]; then
MANIFEST=${UPLOAD_OUTPUT_DIR%/}/manifest.json MANIFEST=${UPLOAD_OUTPUT_DIR%/}/manifest.json
DIST="${LHCI_BASE_DIR%/}/${UPLOAD_OUTPUT_DIR%/}/dist" DIST="${LHCI_BASE_DIR%/}/${UPLOAD_OUTPUT_DIR%/}/dist"
mkdir -p "${DIST}" mkdir -p "${DIST}"
@ -19,7 +19,7 @@ if [ -f "$CONFIG" ] && echo "$OUT" | grep -q "Done running Lighthouse"; then
cp /templates/summary.md "${DIST}/summary.md" cp /templates/summary.md "${DIST}/summary.md"
printf "\nPost-process report files...\n" printf "\nPost-process report files...\n"
for ITEM in $(jq -r '.[] | select( .isRepresentativeRun == true ) | @base64' < "${MANIFEST}"); do for ITEM in $(jq -r '.[] | select( .isRepresentativeRun == true ) | @base64' <"${MANIFEST}"); do
JSON=$(echo "${ITEM}" | base64 -d) JSON=$(echo "${ITEM}" | base64 -d)
FILE_DATE=$(date '+%Y%m%d%H%M') FILE_DATE=$(date '+%Y%m%d%H%M')
@ -38,7 +38,7 @@ if [ -f "$CONFIG" ] && echo "$OUT" | grep -q "Done running Lighthouse"; then
cp "${FILENAME}" "${DIST}/${FILENAME_NEW}.html" cp "${FILENAME}" "${DIST}/${FILENAME_NEW}.html"
echo "Report for ${URL} will be uploaded to ${DOWNLOAD}" echo "Report for ${URL} will be uploaded to ${DOWNLOAD}"
echo "| [Link]("${DOWNLOAD}") | \`${URL}\` | $(echo "scale=0;($PERF*100)/1" | bc) % | $(echo "scale=0;($ACCESS*100)/1" | bc) % | $(echo "scale=0;($PRACTICE*100)/1" | bc) % | $(echo "scale=0;($SEO*100)/1" | bc) % | $(echo "scale=0;($PWA*100)/1" | bc) % |" >> "${DIST}/summary.md" echo "| [Link](${DOWNLOAD}) | \`${URL}\` | $(echo "scale=0;($PERF*100)/1" | bc) % | $(echo "scale=0;($ACCESS*100)/1" | bc) % | $(echo "scale=0;($PRACTICE*100)/1" | bc) % | $(echo "scale=0;($SEO*100)/1" | bc) % | $(echo "scale=0;($PWA*100)/1" | bc) % |" >>"${DIST}/summary.md"
done done
else else
printf "\nPost-processing skipped. Manifest not found!\n" printf "\nPost-processing skipped. Manifest not found!\n"
@ -46,6 +46,6 @@ if [ -f "$CONFIG" ] && echo "$OUT" | grep -q "Done running Lighthouse"; then
fi fi
fi fi
if [ -n "$ERROR" ]; then if [ -n "$ERROR" ] && ! (echo "$OUT" | grep -q "Done writing reports to disk"); then
exit 1 exit 1
fi fi