Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
Validate example IFC files via GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
thbeu committed Mar 30, 2024
1 parent fedaf6d commit 9fe39c5
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/validate.yml
@@ -0,0 +1,43 @@
name: Validate

on: [push, pull_request, workflow_dispatch]

jobs:
greeting:
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 python packages
run: |
git clone --depth 1 https://github.com/IfcOpenShell/step-file-parser
pip install --disable-pip-version-check --user lark-parser
- 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 ./Examples -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

0 comments on commit 9fe39c5

Please sign in to comment.