Skip to content

Merge pull request #58 from cwhanse/espg #51

Merge pull request #58 from cwhanse/espg

Merge pull request #58 from cwhanse/espg #51

# .github/workflows/validate_xml_with_xsd_and_schematron.yml
name: Validate PVCollada XML examples
on:
push:
paths:
- Examples/**
- schema/**
- .github/workflows/validate_xml_with_xsd_and_schematron.py
- .github/workflows/validate_xml_with_xsd_and_schematron.yml
pull_request:
paths:
- Examples/**
- schema/**
- .github/workflows/validate_xml_with_xsd_and_schematron.py
- .github/workflows/validate_xml_with_xsd_and_schematron.yml
workflow_dispatch:
jobs:
discover:
name: Discover *.pvc2 example files
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.build.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: build
shell: bash
run: |
python3 - <<'PY' > matrix.json
import json, pathlib
root = pathlib.Path("Examples")
files = []
if root.exists():
for p in sorted(root.rglob("*")):
if p.is_file() and p.suffix.lower() == ".pvc2":
files.append(str(p))
print(json.dumps({"xml_doc": files}))
PY
echo "matrix=$(cat matrix.json)" >> "$GITHUB_OUTPUT"
validate-schema:
name: Validate XML
needs: discover
runs-on: ubuntu-latest
# Skip job cleanly if no files matched (prevents a matrix on an empty list)
if: ${{ fromJSON(needs.discover.outputs.matrix).xml_doc && join(fromJSON(needs.discover.outputs.matrix).xml_doc) != '' }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.discover.outputs.matrix) }}
steps:
- name: Install Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install lxml Python dependency
run: pip3 install lxml==5.3.1
- name: Checkout schemas, validation script, and XML doc
uses: actions/checkout@v4
with:
sparse-checkout: |
schema/pvcollada_schema_2.0.xsd
schema/pvcollada_structure_2.0.sch
schema/pvcollada_references_2.0.sch
schema/pvcollada_business_2.0.sch
schema/extensions/pvsyst/pvcollada_2.0_pvsyst_schema_1.0.xsd
schema/extensions/pvsyst/pvcollada_2.0_pvsyst_structure_1.0.sch
schema/extensions/pvsyst/pvcollada_2.0_pvsyst_references_1.0.sch
schema/collada_schema_1_5.xsd
.github/workflows/validate_xml_with_xsd_and_schematron.py
${{ matrix.xml_doc }}
sparse-checkout-cone-mode: false
- name: Validate against PVCollada XSD Schema
working-directory: schema
run: |
python3 "$GITHUB_WORKSPACE"/.github/workflows/validate_xml_with_xsd_and_schematron.py \
"$GITHUB_WORKSPACE"/"${{ matrix.xml_doc }}" \
--xsd pvcollada_schema_2.0.xsd
- name: Validate against PVCollada Structure Schematron
working-directory: schema
run: |
python3 "$GITHUB_WORKSPACE"/.github/workflows/validate_xml_with_xsd_and_schematron.py \
"$GITHUB_WORKSPACE"/"${{ matrix.xml_doc }}" \
--schematron pvcollada_structure_2.0.sch
- name: Validate against PVCollada References Schematron
working-directory: schema
run: |
python3 "$GITHUB_WORKSPACE"/.github/workflows/validate_xml_with_xsd_and_schematron.py \
"$GITHUB_WORKSPACE"/"${{ matrix.xml_doc }}" \
--schematron pvcollada_references_2.0.sch
- name: Validate against PVCollada Business Rules Schematron
working-directory: schema
run: |
python3 "$GITHUB_WORKSPACE"/.github/workflows/validate_xml_with_xsd_and_schematron.py \
"$GITHUB_WORKSPACE"/"${{ matrix.xml_doc }}" \
--schematron pvcollada_business_2.0.sch
- name: Validate against PVsyst extensions XSD Schema
working-directory: schema
run: |
python3 "$GITHUB_WORKSPACE"/.github/workflows/validate_xml_with_xsd_and_schematron.py \
"$GITHUB_WORKSPACE"/"${{ matrix.xml_doc }}" \
--xsd extensions/pvsyst/pvcollada_2.0_pvsyst_schema_1.0.xsd
- name: Validate against PVCollada extensions Structure Schematron
working-directory: schema
run: |
python3 "$GITHUB_WORKSPACE"/.github/workflows/validate_xml_with_xsd_and_schematron.py \
"$GITHUB_WORKSPACE"/"${{ matrix.xml_doc }}" \
--schematron extensions/pvsyst/pvcollada_2.0_pvsyst_structure_1.0.sch
- name: Validate against PVCollada extensions References Schematron
working-directory: schema
run: |
python3 "$GITHUB_WORKSPACE"/.github/workflows/validate_xml_with_xsd_and_schematron.py \
"$GITHUB_WORKSPACE"/"${{ matrix.xml_doc }}" \
--schematron extensions/pvsyst/pvcollada_2.0_pvsyst_references_1.0.sch