-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI: verify docs resources #235
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash +x | ||
|
||
set -e | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh maybe not, you disable this later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, there's more than one thing running here, so the exit code needs to be set after clean-up, and reflect the outcome of the test process. |
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
cd "${SCRIPT_DIR}" | ||
|
||
[ -d node_modules ] && [ -f dist/server/index.js ] || make deps build > /dev/null | ||
set +e | ||
npm run ssr > /dev/null & | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Or even There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see, you added a script for this. |
||
server=$! | ||
|
||
selector='.links | .[] | select(.state | contains("BROKEN"))' | ||
template='.state, " link [", .status, "] in page ", .parent, ", for target: ", .url, "\n"' | ||
outcome='.passed | "Links and assets verified: ", .' | ||
curl -fs \ | ||
--retry 15 \ | ||
--retry-delay 2 \ | ||
--retry-max-time 30 \ | ||
--retry-connrefused \ | ||
http://localhost:8080/ > /dev/null && \ | ||
linkinator http://localhost:8080 \ | ||
--verbosity warning \ | ||
--config ./linkinator.config.json \ | ||
| jq -jre "( ${selector} | ${template} ), ( ${outcome} )" | ||
result=$? | ||
echo | ||
kill $server | ||
exit $result |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"format": "json", | ||
"recurse": true, | ||
"verbosity": "info", | ||
"timeout": 10000 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,13 @@ | |
"main": "dist/server/index.js", | ||
"scripts": { | ||
"start": "node .", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"test": "exec ./check-links.sh", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the |
||
"build": "webpack", | ||
"package:serverless": "sls package", | ||
"clean": "rm -rf .serverless dist", | ||
"dev": "NODE_ENV=development node-hot --fork | bunyan", | ||
"dev:ssr": "NODE_ENV=development SSR_ONLY=true node-hot --fork | bunyan" | ||
"dev:ssr": "NODE_ENV=development SSR_ONLY=true node-hot --fork | bunyan", | ||
"ssr": "NODE_ENV=production SSR_ONLY=true exec node ." | ||
}, | ||
"author": "Daniel A.C. Martin <[email protected]> (http://daniel-martin.co.uk/)", | ||
"license": "MIT", | ||
|
@@ -30,6 +31,7 @@ | |
"@types/react-router-dom": "^5.1.5", | ||
"@types/webpack-env": "^1.15.2", | ||
"bunyan": "^1.8.12", | ||
"linkinator": "^2.13.6", | ||
"node-hot-loader": "^1.19.0", | ||
"react": "^16.9.55", | ||
"react-dom": "^16.9.55", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need the
+x
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it better to do
#! /bin/env bash
these days?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! Not really a short answer, but I think it boils down to using
/bin/env
is more portable but slightly less secure. I don't think either is a strong enough consideration to influence this context though.