Skip to content

Commit

Permalink
Merge pull request #743 from metanorma/verapdf_workflow
Browse files Browse the repository at this point in the history
verapdfcheck.yml added for metanorma/mn2pdf#265
  • Loading branch information
Intelligent2013 authored Sep 12, 2024
2 parents f835e0b + 29f4b28 commit 3789a8c
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 24 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
53 changes: 53 additions & 0 deletions .github/workflows/verapdfcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: verapdfcheck

on: push

jobs:
check:
runs-on: ubuntu-latest

steps:
- name: Wait for main task to succeed
uses: fountainhead/action-wait-for-check@v1.2.0
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
commit: ${{github.event.pull_request.head.sha}}
name: published-ubuntu

- 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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ XSLT_GENERATED := xslt/iec.international-standard.xsl \
xslt/bipm.rapport.xsl \
xslt/jcgm.standard.xsl

MN2PDF_DOWNLOAD_PATH := https://github.com/metanorma/mn2pdf/releases/download/v1.97/mn2pdf-1.97.jar
MN2PDF_DOWNLOAD_PATH := https://github.com/metanorma/mn2pdf/releases/download/v2.00/mn2pdf-2.00.jar
# MN2PDF_DOWNLOAD_PATH := https://maven.pkg.github.com/metanorma/mn2pdf/com/metanorma/fop/mn2pdf/1.7/mn2pdf-1.7.jar
MN2PDF_EXECUTABLE := $(notdir $(MN2PDF_DOWNLOAD_PATH))

Expand Down
115 changes: 92 additions & 23 deletions xslt_src/common.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -19637,6 +19637,39 @@
</pdf:catalog>
<x:xmpmeta xmlns:x="adobe:ns:meta/">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/" xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property#" xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema#" rdf:about="">
<pdfaExtension:schemas>
<rdf:Bag>
<rdf:li rdf:parseType="Resource">
<pdfaSchema:namespaceURI>http://www.aiim.org/pdfua/ns/id/</pdfaSchema:namespaceURI>
<pdfaSchema:prefix>pdfuaid</pdfaSchema:prefix>
<pdfaSchema:schema>PDF/UA identification schema</pdfaSchema:schema>
<pdfaSchema:property>
<rdf:Seq>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:category>internal</pdfaProperty:category>
<pdfaProperty:description>PDF/UA version identifier</pdfaProperty:description>
<pdfaProperty:name>part</pdfaProperty:name>
<pdfaProperty:valueType>Integer</pdfaProperty:valueType>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:category>internal</pdfaProperty:category>
<pdfaProperty:description>PDF/UA amendment identifier</pdfaProperty:description>
<pdfaProperty:name>amd</pdfaProperty:name>
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:category>internal</pdfaProperty:category>
<pdfaProperty:description>PDF/UA corrigenda identifier</pdfaProperty:description>
<pdfaProperty:name>corr</pdfaProperty:name>
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
</rdf:li>
</rdf:Seq>
</pdfaSchema:property>
</rdf:li>
</rdf:Bag>
</pdfaExtension:schemas>
</rdf:Description>
<rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
<!-- Dublin Core properties go here -->
<dc:title>
Expand Down Expand Up @@ -19665,40 +19698,66 @@
</xsl:choose>
</xsl:for-each>
</xsl:variable>
<xsl:choose>
<xsl:when test="normalize-space($title) != ''">
<xsl:value-of select="$title"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>&#xA0;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<rdf:Alt>
<rdf:li xml:lang="x-default">
<xsl:choose>
<xsl:when test="normalize-space($title) != ''">
<xsl:value-of select="$title"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>&#xA0;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</rdf:li>
</rdf:Alt>
</dc:title>
<dc:creator>
<xsl:variable name="dc_creator">
<xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
<xsl:choose>
<xsl:when test="$namespace = 'ieee'">
<xsl:value-of select="ieee:ext/ieee:editorialgroup/ieee:committee"/>
<rdf:Seq>
<rdf:li>
<xsl:value-of select="ieee:ext/ieee:editorialgroup/ieee:committee"/>
</rdf:li>
</rdf:Seq>
</xsl:when>
<xsl:when test="$namespace = 'jcgm'">
<xsl:value-of select="normalize-space(*[local-name() = 'ext']/*[local-name() = 'editorialgroup']/*[local-name() = 'committee'])"/>
<rdf:Seq>
<rdf:li>
<xsl:value-of select="normalize-space(*[local-name() = 'ext']/*[local-name() = 'editorialgroup']/*[local-name() = 'committee'])"/>
</rdf:li>
</rdf:Seq>
</xsl:when>
<xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
<xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
<xsl:value-of select="*[local-name() = 'person']/*[local-name() = 'name']/*[local-name() = 'completename']"/>
<xsl:if test="position() != last()">; </xsl:if>
</xsl:for-each>
<rdf:Seq>
<xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
<rdf:li>
<xsl:value-of select="*[local-name() = 'person']/*[local-name() = 'name']/*[local-name() = 'completename']"/>
</rdf:li>
<!-- <xsl:if test="position() != last()">; </xsl:if> -->
</xsl:for-each>
</rdf:Seq>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
<xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
<xsl:if test="position() != last()">; </xsl:if>
</xsl:for-each>
<rdf:Seq>
<xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
<rdf:li>
<xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
</rdf:li>
<!-- <xsl:if test="position() != last()">; </xsl:if> -->
</xsl:for-each>
</rdf:Seq>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</dc:creator>
<dc:description>
</xsl:variable>
<xsl:if test="normalize-space($dc_creator) != ''">
<dc:creator>
<xsl:copy-of select="$dc_creator"/>
</dc:creator>
</xsl:if>

<xsl:variable name="dc_description">
<xsl:variable name="abstract">
<xsl:choose>
<xsl:when test="$namespace = 'jcgm'">
Expand All @@ -19709,8 +19768,18 @@
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="normalize-space($abstract)"/>
</dc:description>
<rdf:Alt>
<rdf:li xml:lang="x-default">
<xsl:value-of select="normalize-space($abstract)"/>
</rdf:li>
</rdf:Alt>
</xsl:variable>
<xsl:if test="normalize-space($dc_description)">
<dc:description>
<xsl:copy-of select="$dc_description"/>
</dc:description>
</xsl:if>

<pdf:Keywords>
<xsl:call-template name="insertKeywords">
<xsl:with-param name="meta">true</xsl:with-param>
Expand Down

0 comments on commit 3789a8c

Please sign in to comment.