-
Notifications
You must be signed in to change notification settings - Fork 18
63 lines (60 loc) · 1.81 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Test Schemas
on:
push:
branches: [ master ]
pull_request:
types: [ synchronize, opened ]
workflow_dispatch:
jobs:
test-xsd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r tests/requirements.txt
- name: Test with pytest
run: |
pytest tests
flatten-xsd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
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