Skip to content

Update validate workflow #57

Update validate workflow

Update validate workflow #57

Workflow file for this run

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.10/site-packages
wget https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-310-v0.7.0-fc50bdd-linux64.zip
unzip ifcopenshell-python-310-v0.7.0-fc50bdd-linux64.zip -d ~/.local/lib/python3.10/site-packages
wget -O ~/.local/lib/python3.10/site-packages/ifcopenshell/entity_instance.py https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/7567971a32eb39e0a413240cc49010dbede7a89c/src/ifcopenshell-python/ifcopenshell/entity_instance.py
wget -O ~/.local/lib/python3.10/site-packages/ifcopenshell/express/rule_executor.py https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/7567971a32eb39e0a413240cc49010dbede7a89c/src/ifcopenshell-python/ifcopenshell/express/rule_executor.py
sed -i s/f.schema_identifier/f.schema/ ~/.local/lib/python3.10/site-packages/ifcopenshell/express/rule_executor.py
wget -O $(python -c 'import ifcopenshell.express.rule_compiler; print(ifcopenshell.express.rule_compiler.__file__)') https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/eee844e2045e97d72f2266f620d6c7e43d7a353f/src/ifcopenshell-python/ifcopenshell/express/rule_compiler.py
git clone --depth 1 https://github.com/IfcOpenShell/step-file-parser
pip install --user -r ./step-file-parser/requirements.in
- 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