Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes markup issues #391

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
xml-validation.yml: Adds general XML validation
funkyfuture committed Sep 14, 2024
commit b29d9f070f10a12a99adbb73e1714059a15e1d40
27 changes: 27 additions & 0 deletions .github/workflows/xml-validation.yml
Original file line number Diff line number Diff line change
@@ -36,3 +36,30 @@ jobs:
- uses: actions/checkout@v3
- run: sudo apt-get install -y moreutils parallel
- run: find APIS -name "*.xml" | parallel --gnu --will-cite -X -j8 -u "java -jar Validation/jing.jar Validation/EpiDoc/8.13/tei-epidoc.rng {}"
parse-xml:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: pip install lxml
- uses: jannekem/run-python-script-action@v1
with:
script: |
from pathlib import Path
from lxml.etree import parse, XMLSyntaxError

encountered_errors = []
root_path = Path.cwd()

for file in root_path.rglob("*.xml"):
try:
parse(str(file))
except XMLSyntaxError as e:
encountered_errors.append(f"{file.relative_to(root_path)}: {e.msg}")

if encountered_errors:
print("\nInvalid XML encodings were found:")
print("---------------------------------")
print("\n".join(encountered_errors) + "\n")
raise SystemExit(1)