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
27 changes: 17 additions & 10 deletions .github/workflows/build-and-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
node-version-file: ".node-version"
cache: "npm"

- name: Cache node_modules
Expand All @@ -33,9 +33,9 @@ jobs:
path: |
node_modules
~/.npm
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-node-${{ hashFiles('.node-version') }}-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-
${{ runner.os }}-node-${{ hashFiles('.node-version') }}-modules-

- name: Install dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true'
Expand All @@ -51,7 +51,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
node-version-file: ".node-version"
cache: "npm"

- name: Restore node_modules from cache
Expand All @@ -60,9 +60,9 @@ jobs:
path: |
node_modules
~/.npm
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-node-${{ hashFiles('.node-version') }}-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-
${{ runner.os }}-node-${{ hashFiles('.node-version') }}-modules-

- name: Check formatting and lint
run: npm run check
Expand All @@ -77,7 +77,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
node-version-file: ".node-version"
cache: "npm"

- name: Restore node_modules from cache
Expand All @@ -86,9 +86,9 @@ jobs:
path: |
node_modules
~/.npm
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-node-${{ hashFiles('.node-version') }}-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-
${{ runner.os }}-node-${{ hashFiles('.node-version') }}-modules-

- name: Build
run: npm run build
Expand Down Expand Up @@ -127,11 +127,13 @@ jobs:

ROOT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:3000/")
REQUEST_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:3000/request/0x1234567890abcdef1234567890abcdef12345678-0")
ADDRESS_ID=0x0000000000000000000000000000000000000001
ADDRESS_STATUS=$(curl -s -o /tmp/scan-address.html -w "%{http_code}" "http://localhost:3000/address/$ADDRESS_ID")
XROBOTS_HEADER=$(curl -sI "http://localhost:3000/" | tr -d '\r' | grep -i '^x-robots-tag:' || true)
ROBOTS_TXT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:3000/robots.txt")
ROBOTS_TXT_BODY=$(curl -s "http://localhost:3000/robots.txt" | tr -d '\r')

echo "Observed status codes: / -> $ROOT_STATUS, /request/<id> -> $REQUEST_STATUS, /robots.txt -> $ROBOTS_TXT_STATUS"
echo "Observed status codes: / -> $ROOT_STATUS, /request/<id> -> $REQUEST_STATUS, /address/<id> -> $ADDRESS_STATUS, /robots.txt -> $ROBOTS_TXT_STATUS"
echo "Observed header: $XROBOTS_HEADER"
echo "Observed /robots.txt body:"
echo "$ROBOTS_TXT_BODY"
Expand All @@ -143,6 +145,11 @@ jobs:
exit 1
fi

if [ "$ADDRESS_STATUS" -ne 200 ] || ! grep -Eq "Address (<!-- -->)?$ADDRESS_ID" /tmp/scan-address.html; then
echo "Smoke test failed: the address page did not render its URL parameter"
exit 1
fi

# The full policy must be present: dropping either token weakens de-indexing.
if ! echo "$XROBOTS_HEADER" | grep -qi "noindex"; then
echo "Smoke test failed: X-Robots-Tag is missing 'noindex' on /"
Expand Down
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.23.4
Loading
Loading