Skip to content

Add empty root formatting context instead of using root box #154

Add empty root formatting context instead of using root box

Add empty root formatting context instead of using root box #154

Workflow file for this run

name: WeasyPrint's PDF/UA tests
on: [push]
env:
PDF_FOLDER: 'pdfs'
VERA_FOLDER: 'vera'
jobs:
pdf-ua:
name: Test PDF/UA samples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip and setuptools
run: python -m pip install --upgrade pip setuptools
- name: Install requirements
run: python -m pip install .
- name: Create output folders
run: |
mkdir ${{env.PDF_FOLDER}}
mkdir ${{env.VERA_FOLDER}}
- name: Clone samples repository
run: git clone https://github.com/CourtBouillon/weasyprint-samples.git
- name: Generate samples
run: |
python -m weasyprint --pdf-variant pdf/ua-1 weasyprint-samples/book/book.html -s weasyprint-samples/book/book-classical.css ${{env.PDF_FOLDER}}/book-classical.pdf
python -m weasyprint --pdf-variant pdf/ua-1 weasyprint-samples/book/book.html -s weasyprint-samples/book/book.css ${{env.PDF_FOLDER}}/book-fancy.pdf
python -m weasyprint --pdf-variant pdf/ua-1 weasyprint-samples/letter/letter.html ${{env.PDF_FOLDER}}/letter.pdf
python -m weasyprint --pdf-variant pdf/ua-1 weasyprint-samples/report/report.html ${{env.PDF_FOLDER}}/report.pdf
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Generate VeraPDF reports
uses: addnab/docker-run-action@v3
with:
image: verapdf/cli:latest
# We need to define the uid and gid explicitly, else we can’t write from inside the docker.
# It’d be better to get them automatically rather than using hardcoded ids.
# See https://github.com/orgs/community/discussions/44243
options: -u 1001:118 -v ${{ github.workspace }}:/workspace
run: |
/opt/verapdf/verapdf -f ua1 --format html /workspace/${{env.PDF_FOLDER}}/book-classical.pdf > /workspace/${{env.VERA_FOLDER}}/book-classical-verapdf.html
/opt/verapdf/verapdf -f ua1 --format html /workspace/${{env.PDF_FOLDER}}/book-fancy.pdf > /workspace/${{env.VERA_FOLDER}}/book-fancy-verapdf.html
/opt/verapdf/verapdf -f ua1 --format html /workspace/${{env.PDF_FOLDER}}/letter.pdf > /workspace/${{env.VERA_FOLDER}}/letter-verapdf.html
/opt/verapdf/verapdf -f ua1 --format html /workspace/${{env.PDF_FOLDER}}/report.pdf > /workspace/${{env.VERA_FOLDER}}/report-verapdf.html
/opt/verapdf/verapdf -f ua1 --format html /workspace/${{env.PDF_FOLDER}}/ > /workspace/${{env.VERA_FOLDER}}/summary.html
- name: Archive generated PDFs
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: vera-results
path: |
${{env.VERA_FOLDER}}
${{env.PDF_FOLDER}}
retention-days: 1