Skip to content

Fix license name in CONTRIBUTING.md #3

Fix license name in CONTRIBUTING.md

Fix license name in CONTRIBUTING.md #3

Workflow file for this run

name: Smoke test
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
generate:
name: Generate PDFs (Python ${{ matrix.python-version }}, obfuscate ${{ matrix.obfuscate }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
obfuscate: [0, 4]
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Generate PDFs
run: |
python3 malicious-pdf.py https://example.com --obfuscate ${{ matrix.obfuscate }}
- name: Verify expected number of PDFs produced
run: |
EXPECTED_PDF=69
EXPECTED_SVG=1
ACTUAL_PDF=$(find output -maxdepth 1 -name '*.pdf' -type f | wc -l | tr -d ' ')
ACTUAL_SVG=$(find output -maxdepth 1 -name '*.svg' -type f | wc -l | tr -d ' ')
echo "Expected $EXPECTED_PDF .pdf + $EXPECTED_SVG .svg, found $ACTUAL_PDF + $ACTUAL_SVG"
if [ "$ACTUAL_PDF" -ne "$EXPECTED_PDF" ] || [ "$ACTUAL_SVG" -ne "$EXPECTED_SVG" ]; then
echo "::error::Output file count mismatch"
ls -la output/
exit 1
fi
- name: Verify all PDFs are non-empty and start with %PDF-
run: |
fail=0
for f in output/*.pdf; do
if [ ! -s "$f" ]; then
echo "::error::$f is empty"
fail=1
continue
fi
head -c 5 "$f" | grep -q '%PDF-' || {
echo "::error::$f does not start with %PDF- header"
fail=1
}
done
exit $fail