-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
92 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,4 +31,5 @@ LABEL maintainer="[email protected]" | |
|
||
COPY conf/nginx.conf /etc/nginx/conf.d/default.conf | ||
|
||
# /usr/share/nginx/html is also hardcoded in test/run-test.sh | ||
COPY --from=0 /root/src/public/ /usr/share/nginx/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM decred/dcrweb:latest | ||
|
||
WORKDIR /root | ||
|
||
RUN apt-get update && apt-get install -y curl | ||
|
||
COPY package.json run-test.sh ./ | ||
|
||
ENV NVM_DIR /usr/local/nvm | ||
ENV NODE_VERSION v8 | ||
|
||
RUN mkdir -p $NVM_DIR && \ | ||
curl -s -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash | ||
|
||
# install node and npm | ||
RUN . $NVM_DIR/nvm.sh \ | ||
&& npm install | ||
|
||
CMD ["bash", "-lc", "./run-test.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "dcrweb-test", | ||
"version": "1.0.0", | ||
"description": "dcrweb testbed", | ||
"main": "index.js", | ||
"bin": {}, | ||
"author": "Peter Banik <[email protected]>", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"html-validator-cli": "^6.0.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
|
||
# validate generated html content | ||
|
||
CONTENT_DIR=/usr/share/nginx/html | ||
|
||
if [ "$1" != "" ]; then | ||
CONTENT_DIR=$1 | ||
fi | ||
|
||
echo | ||
echo "Validating pages " | ||
|
||
FILES=$(find $CONTENT_DIR -name \*.html | grep -v google) | ||
PATH=node_modules/.bin:$PATH | ||
|
||
exit_code=0 | ||
error_files="" | ||
|
||
for file in $FILES; do | ||
echo -n . | ||
html-validator \ | ||
--quiet \ | ||
--errors-only \ | ||
--validator='http://validator:8888' \ | ||
--file=$file && continue | ||
error_files="$error_files $file" | ||
exit_code=1 | ||
done | ||
|
||
echo | ||
echo "Validation completed" | ||
|
||
if [ $exit_code != "0" ]; then | ||
echo "Errors found:" | ||
echo $error_files | sed "s|$CONTENT_DIR/|\t|g" | sed 's/ /\n/g' | ||
else | ||
echo "No errors found." | ||
fi | ||
|
||
exit $exit_code |