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

Add combined XSD via automatic commit #369

Merged
merged 15 commits into from
Feb 15, 2023
Merged
44 changes: 41 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name: Test Schemas
on: [pull_request]

jobs:
build:
test-xsd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
Expand All @@ -18,3 +18,41 @@ jobs:
- name: Test with pytest
run: |
pytest tests
flatten-xsd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install lxml
- name: Install software
shell: bash
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt update
sudo -E apt-get install -y libxml2-utils
- name: Flatten XSD
run: |
cd schemas
python ../scripts/xsdflatten.py HPXML.xsd ../merged_schema/HPXMLMerged.xsd
- name: Commit XSD
run: |
branch_name="${{ github.head_ref }}"
git pull origin $branch_name
git add merged_schema/HPXMLMerged.xsd
git status
if [[ $(git diff --cached --exit-code) ]]; then
git config --global user.email "github-action@users.noreply.github.com"
git config --global user.name "GitHub Action"
git commit -m "Latest HPXMLMerged.xsd"
echo "Pushing to branch: $branch_name"
git push -u origin $branch_name
fi
- name: Validate XSD
run: |
export XSDPATH=merged_schema/HPXMLMerged.xsd
xmllint --schema $XSDPATH examples/audit.xml --noout
Loading