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