This repository has been archived by the owner on Mar 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate example IFC files via GitHub Actions
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |