-
Notifications
You must be signed in to change notification settings - Fork 6
56 lines (53 loc) · 1.86 KB
/
validate.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
name: Model validation
on: [push, pull_request, workflow_dispatch]
permissions:
contents: read
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 5
- name: Setup python environment
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --user pyparsing lark-parser==0.12.0 networkx requests sqlalchemy sqlalchemy-utils pytest
mkdir -p ~/.local/lib/python3.11/site-packages
wget -q https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-311-v0.7.0-f7c03db-linux64.zip
unzip ifcopenshell-python-311-v0.7.0-f7c03db-linux64.zip -d ~/.local/lib/python3.11/site-packages
git clone --depth 1 https://github.com/IfcOpenShell/step-file-parser
pip install --user -r ./step-file-parser/requirements.in
- name: Check for UTF-8 BOM
run: "! find ./models -name '*.ifc' -print0 | xargs -0 grep -l $'^\\xEF\\xBB\\xBF' | grep ."
- name: Validate IFC example files
run: |
valid_count=0
invalid_count=0
set +e
while IFS= read -r file; do
printf "Validating $file ..."
python ./step-file-parser/main.py "$file" > validate.log 2>&1
exit_code=$?
if [ $exit_code -eq 0 ]; then
((valid_count++))
printf " valid\n"
else
((invalid_count++))
printf " invalid\n"
fi
done < <(find ./models -type f -name '*.ifc')
echo "Number of valid files: $valid_count"
echo "Number of invalid files: $invalid_count"
set -e
if [ $invalid_count -gt 0 ]; then
exit 1
fi
- name: Model validation
run: |
./validate.sh