-
Notifications
You must be signed in to change notification settings - Fork 1
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
28 changed files
with
168 additions
and
63 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
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,5 @@ | ||
.gitignore | ||
docker-compose.yml | ||
Dockerfile | ||
diffs | ||
data/**/generated.* |
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,2 @@ | ||
diffs | ||
data/**/generated.* |
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,14 @@ | ||
FROM alpine:3.14 | ||
|
||
WORKDIR /root | ||
ENV PDF_SERVICE_URL=http://pdf:8080 | ||
VOLUME /root/diffs | ||
|
||
RUN apk add --no-cache \ | ||
bash \ | ||
curl \ | ||
imagemagick | ||
|
||
ADD . . | ||
|
||
CMD [ "/bin/bash", "./scripts/run.sh" ] |
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,18 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [ "$PDF_SERVICE_URL" = "" ]; then | ||
echo "\$PDF_SERVICE_URL has to be set." | ||
fi | ||
|
||
cd "$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )" | ||
|
||
curl \ | ||
--fail \ | ||
--silent \ | ||
-F [email protected] \ | ||
"$PDF_SERVICE_URL/generate" \ | ||
> generated.pdf | ||
|
||
../../scripts/create_reference_or_diff.sh |
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,18 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [ "$PDF_SERVICE_URL" = "" ]; then | ||
echo "\$PDF_SERVICE_URL has to be set." | ||
fi | ||
|
||
cd "$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )" | ||
|
||
curl \ | ||
--fail \ | ||
--silent \ | ||
-F [email protected] \ | ||
"$PDF_SERVICE_URL/generate" \ | ||
> generated.pdf | ||
|
||
../../scripts/create_reference_or_diff.sh |
File renamed without changes
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [ "$PDF_SERVICE_URL" = "" ]; then | ||
echo "\$PDF_SERVICE_URL has to be set." | ||
fi | ||
|
||
cd "$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )" | ||
|
||
curl \ | ||
--fail \ | ||
--silent \ | ||
-F [email protected] \ | ||
-F test.png=@assets/test.png \ | ||
"$PDF_SERVICE_URL/generate" \ | ||
> generated.pdf | ||
|
||
../../scripts/create_reference_or_diff.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,8 @@ | ||
version: "3.8" | ||
services: | ||
pdf: | ||
image: "mormahr/pdf-service:${TAG}" | ||
test: | ||
build: . | ||
links: | ||
- "pdf:pdf" |
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 @@ | ||
scripts/regenerate.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 @@ | ||
scripts/run.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,8 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
cd "$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit; pwd -P )" || exit | ||
|
||
rm -f ../data/**/diff.png | ||
rm -f ../data/**/generated.* |
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,5 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
convert -density 200 -depth 8 -quality 100 generated.pdf -background white -flatten -strip PNG24:$1 |
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,29 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [ ! -f reference.png ]; then | ||
# Reference file doesn't exist yet -> create | ||
echo "Generating for $(basename "$PWD")" | ||
../../scripts/convert.sh reference.png | ||
else | ||
../../scripts/convert.sh generated.png | ||
|
||
# Remove old diffs | ||
mkdir -p ../../diffs/ | ||
rm -f "../../diffs/$(basename "$PWD").*" | ||
|
||
# Create diff image | ||
# Ignore comparison errors here because we do a byte comparison later | ||
compare reference.png generated.png -compose Src "../../diffs/$(basename "$PWD").png" || true | ||
|
||
# Generate animated GIF to illustrate differences | ||
convert -delay 50 reference.png generated.png -loop 0 "../../diffs/$(basename "$PWD").gif" | ||
|
||
# Byte comparison of reference and current image | ||
if ! cmp reference.png generated.png > /dev/null 2>&1 | ||
then | ||
echo "Reference and generated image differ for $(basename "$PWD")" | ||
exit 1 | ||
fi | ||
fi |
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,9 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
cd "$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit; pwd -P )" || exit | ||
|
||
./clean.sh | ||
rm -f ../data/**/reference.png | ||
./run.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,20 @@ | ||
#!/bin/bash | ||
|
||
if [ "$PDF_SERVICE_URL" = "" ]; then | ||
echo "\$PDF_SERVICE_URL has to be set." | ||
fi | ||
|
||
# Wait for pdf service to become available. (1s retry, 30s timeout) | ||
timeout 30 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' $PDF_SERVICE_URL/health)" != "200" ]]; do sleep 1; done' || false | ||
|
||
cd "$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit; pwd -P )" || exit | ||
|
||
for f in ../data/* | ||
do | ||
# Guard against empty directory | ||
[ -e "$f" ] || continue | ||
echo "Running $(basename "$f")" | ||
|
||
# Propagate errors because -e isn't set | ||
"$f/run.sh" || exit 1 | ||
done |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.