Skip to content

Commit

Permalink
xml-validation.yml: Adds general XML validation
Browse files Browse the repository at this point in the history
  • Loading branch information
funkyfuture committed Sep 14, 2024
1 parent c3dc33a commit b29d9f0
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/xml-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit b29d9f0

Please sign in to comment.