Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Base image built from Dockerfile.base (Chrome Stable + Node LTS)
FROM node:18
FROM node:20

LABEL "com.github.actions.name"="PA Website Validator Audit"
LABEL "com.github.actions.description"="Run tests on a webpage via Italia PA Website Validator"
Expand Down Expand Up @@ -33,9 +33,7 @@ RUN apt-get update && apt-get install gnupg wget -y && \
# RUN npm install -g pa-website-validator

# Download master or tag from github
# RUN git clone --branch develop https://github.com/mamico/pa-website-validator && \
# RUN git clone --branch main https://github.com/italia/pa-website-validator && \
RUN git clone --branch v2.11.4 https://github.com/italia/pa-website-validator && \
RUN git clone --branch v1.1.12 https://github.com/italia/pa-website-validator-ng pa-website-validator && \
cd pa-website-validator && \
npm ci && \
npm -g i .
Expand All @@ -57,3 +55,4 @@ USER headless

ADD entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
# ENTRYPOINT ["sleep", "3600"]
13 changes: 11 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,17 @@ curl -o - https://reallyfreegeoip.org/json/

# Clarify in logs which URL we're auditing.
printf "* Beginning audit of %s ...\n\n" "$REPORT_URL"
pa-website-validator --type "$INPUT_TYPE" --destination "${OUTPUT_PATH}" --report report --website "${REPORT_URL}" --scope "$INPUT_SCOPE" --accuracy "${INPUT_ACCURACY:-suggested}"
# node pa-website-validator/dist/index.js --type "$INPUT_TYPE" --destination "${OUTPUT_PATH}" --report report --website "${REPORT_URL}" --scope "$INPUT_SCOPE"
# pa-website-validator --type "$INPUT_TYPE" --destination "${OUTPUT_PATH}" --report report --website "${REPORT_URL}" --scope "$INPUT_SCOPE" --accuracy "${INPUT_ACCURACY:-suggested}"

node /pa-website-validator/dist --max-old-space-size=8192 --type "$INPUT_TYPE" --destination "${OUTPUT_PATH}" --report report --website "${REPORT_URL}" --scope "$INPUT_SCOPE" --accuracy "${INPUT_ACCURACY:-suggested}" --view false

# Workaround for https://github.com/italia/pa-website-validator-ng/issues/7
tmp=$(mktemp)
jq '.requestedUrl = "'${INPUT_URL}'"' "${OUTPUT_PATH}/report.json" > "$tmp" && mv "$tmp" ${OUTPUT_PATH}/report.json
tmp=$(mktemp)
jq '.finalUrl = "'${INPUT_URL}'"' "${OUTPUT_PATH}/report.json" > "$tmp" && mv "$tmp" ${OUTPUT_PATH}/report.json
tmp=$(mktemp)
jq '.fetchTime = "'$(date +%Y-%m-%dT%H:%M:%S.000Z)'"' "${OUTPUT_PATH}/report.json" > "$tmp" && mv "$tmp" ${OUTPUT_PATH}/report.json

# Parse individual scores from JSON output.
# Unorthodox jq syntax because of dashes -- https://github.com/stedolan/jq/issues/38
Expand Down
Loading