Skip to content

Commit

Permalink
verapdfcheck.yml added for metanorma/mn2pdf#265
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 committed Sep 3, 2024
1 parent 75ed94d commit 3b6b1e4
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ concurrency:

jobs:
build:
name: ubuntu_build
runs-on: ubuntu-latest
outputs:
common_changed: ${{ steps.common-changed.outputs.only_changed }}
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/verapdfcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: verapdfcheck

on: push

jobs:
check:
runs-on: ubuntu-latest

steps:
- name: Wait for main task to succeed
uses: fountainhead/[email protected]
id: wait-for-build
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: ubuntu_build
ref: ${{ github.event.pull_request.head.sha || github.sha }}
timeoutSeconds: 7200

- name: Download workflow artifact
uses: dawidd6/action-download-artifact@v6
with:
workflow: ubuntu.yml
workflow_conclusion: success

- name: Run Docker image veraPDF
run: |
docker pull verapdf/rest:latest
docker run -d -p 8080:8080 -p 8081:8081 -v ./:/home/folder verapdf/rest:latest
- name: Wait for a Docker container to be up and running
run: |
timeout 20s sh -c 'until curl http://localhost:8080/api/ | grep -q verapdf-rest; do echo "Waiting until container to be healthy..."; sleep 1; done'
- name: Check PDFs using veraPDF
run: |
find ./ -type f -name "*.pdf" -exec curl -F "file=@{}" localhost:8080/api/validate/3a -H "Accept:application/xml" -o "{}.verapdf.report.xml" \;
- name: List files
run: |
find ./ -type f -name "*.verapdf.report.xml"
- name: Check veraPDF XML reports on errors
run: |
err_files_name=err.files.txt
[ -e $err_files_name ] && rm $err_files_name
for f in $(find ./ -type f -name '*.verapdf.report.xml'); do grep -l 'status=\"failed\"' $f >> $err_files_name && cat $f; done
if [ -s $err_files_name ]; then
echo "veraPDF found PDF errors:"
cat $err_files_name
exit 1
fi

0 comments on commit 3b6b1e4

Please sign in to comment.