capture return code from lhci command and proceed
This commit is contained in:
parent
473a2dfc7e
commit
4ff54ef5c9
@ -1,3 +1,2 @@
|
||||
- ENHANCEMENT
|
||||
- remove `LHCI_REPO_NAME`, could be handled within the CI
|
||||
- fix `PATH` order to force use wrapper scripts as default
|
||||
- BUGFIX
|
||||
- capture return code from lhci command and proceed with post-processing
|
||||
|
@ -3,7 +3,7 @@ set -eo pipefail
|
||||
|
||||
CONFIG="${LHCI_BASE_DIR%/}/.lighthouserc.yml"
|
||||
|
||||
/usr/local/bin/lhci "$@"
|
||||
/usr/local/bin/lhci "$@" || ERROR=true
|
||||
|
||||
if [ -f "$CONFIG" ]; then
|
||||
|
||||
@ -15,18 +15,26 @@ if [ -f "$CONFIG" ]; then
|
||||
DIST="${LHCI_BASE_DIR%/}/${UPLOAD_OUTPUT_DIR%/}/dist"
|
||||
mkdir -p "${DIST}"
|
||||
|
||||
printf "\nPost-process report files...\n"
|
||||
for ITEM in $(jq -r '.[] | select( .isRepresentativeRun == true ) | @base64' < "${MANIFEST}"); do
|
||||
JSON=$(echo "${ITEM}" | base64 -d)
|
||||
FILE_DATE=$(date '+%Y%m%d%H%M')
|
||||
if [ -f "$CONFIG" ]; then
|
||||
printf "\nPost-process report files...\n"
|
||||
for ITEM in $(jq -r '.[] | select( .isRepresentativeRun == true ) | @base64' < "${MANIFEST}"); do
|
||||
JSON=$(echo "${ITEM}" | base64 -d)
|
||||
FILE_DATE=$(date '+%Y%m%d%H%M')
|
||||
|
||||
FILENAME=$(echo "${JSON}" | jq -r '.htmlPath')
|
||||
HASH=$(sha1sum "$FILENAME")
|
||||
FILENAME_NEW="${HASH:0:8}-$FILE_DATE"
|
||||
URL=$(echo "${JSON}" | jq -r '.url')
|
||||
FILENAME=$(echo "${JSON}" | jq -r '.htmlPath')
|
||||
HASH=$(sha1sum "$FILENAME")
|
||||
FILENAME_NEW="${HASH:0:8}-$FILE_DATE"
|
||||
URL=$(echo "${JSON}" | jq -r '.url')
|
||||
|
||||
cp "${FILENAME}" "${DIST}/${FILENAME_NEW}.html"
|
||||
echo "Report for ${URL} will be uploaded to ${LHCI_SERVER_URL%/}/$(basename "${FILENAME_NEW}").html"
|
||||
done
|
||||
cp "${FILENAME}" "${DIST}/${FILENAME_NEW}.html"
|
||||
echo "Report for ${URL} will be uploaded to ${LHCI_SERVER_URL%/}/$(basename "${FILENAME_NEW}").html"
|
||||
done
|
||||
else
|
||||
printf "\nPost-processing skipped. Manifest not found!\n"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$ERROR" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user