The GitHub workflows could never run here: they ask for runs-on: ubuntu-latest, which no runner on hub.postle.net offers, so all 8 runs so far were cancelled. Moved to .forgejo/workflows and pointed at the `ifc` runner, which serves the pinned ifc-ci image. The setup steps are gone because the image already contains ifcopenshell, ifctester, idssplit and pytest, so a run no longer spends most of its time in setup-python and `pip install ifcopenshell`. Both bodies are otherwise unchanged apart from skipping libraries/, which holds vendored component sources rather than deliverable models. Verified in the ifc-ci container against this model before pushing: both checks pass, and both were shown to fail when they should -- a corrupted GlobalId exits non-zero, and an IDS rule applying to all 32 windows reports [FAIL] (0/32) and exits 1. That second check matters because ifctester's CLI never sets an exit code, so the grep for [FAIL] is what makes the check capable of failing at all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T93BEAfP4jvcYo7oMo5AL1
102 lines
3.1 KiB
YAML
102 lines
3.1 KiB
YAML
# IDS compliance: every rule in every IDS/**/*.ids, against every model.
|
|
#
|
|
# Port of .github/workflows/ids-lint.yml. The script body is unchanged apart
|
|
# from skipping libraries/; only the setup steps and `runs-on:` differ, because
|
|
# ifc-ci already contains ifctester and idssplit.
|
|
#
|
|
# idssplit splits each IDS file into one file per rule before testing, so a
|
|
# failure names the specific rule rather than only the specification.
|
|
#
|
|
# Runs on the user-scoped `ifc` runner (user ci-ifc) on hub.postle.net, whose
|
|
# root-owned config.yaml has an empty `valid_volumes` -- no host path can be
|
|
# mounted, which is what makes it safe for an outside contributor's PR.
|
|
|
|
name: IDS Compliance Check
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
ids-lint:
|
|
runs-on: ifc
|
|
container:
|
|
image: hub.postle.net/bruno/ifc-ci:latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Run IDS validations
|
|
# Deliberately greps output instead of trusting the exit status:
|
|
# ifctester's CLI has no sys.exit anywhere, so a model that violates
|
|
# every rule still exits 0. A naive `run: ifctester ...` would be a
|
|
# permanently green check that can never fail.
|
|
run: |
|
|
set -e
|
|
shopt -s globstar nullglob
|
|
|
|
if [ ! -d IDS ]; then
|
|
echo "No IDS/ folder found"
|
|
exit 0
|
|
fi
|
|
|
|
ids_sources=(IDS/**/*.ids)
|
|
|
|
if [ ${#ids_sources[@]} -eq 0 ]; then
|
|
echo "No IDS files found in IDS/ folder"
|
|
exit 0
|
|
fi
|
|
|
|
# libraries/ holds vendored component sources, not deliverable models.
|
|
ifc_files=()
|
|
for f in **/*.ifc; do
|
|
[[ "$f" == libraries/* ]] && continue
|
|
ifc_files+=("$f")
|
|
done
|
|
|
|
if [ ${#ifc_files[@]} -eq 0 ]; then
|
|
echo "No IFC files found"
|
|
exit 0
|
|
fi
|
|
|
|
mkdir -p split_ids
|
|
|
|
echo "Splitting IDS files..."
|
|
for ids in "${ids_sources[@]}"; do
|
|
idssplit "$ids" split_ids/
|
|
done
|
|
|
|
split_ids_files=(split_ids/*.ids)
|
|
if [ ${#split_ids_files[@]} -eq 0 ]; then
|
|
echo "No rules found after splitting IDS files"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Running ifctester validations..."
|
|
failed=0
|
|
|
|
for rule_ids in "${split_ids_files[@]}"; do
|
|
for ifc in "${ifc_files[@]}"; do
|
|
echo "::group::Test: $rule_ids with $ifc"
|
|
echo "Testing: $rule_ids with $ifc"
|
|
output=$(python3 -m ifctester --no-color "$rule_ids" "$ifc" || true)
|
|
echo "$output"
|
|
echo "::endgroup::"
|
|
|
|
if echo "$output" | grep -q '\[FAIL\]'; then
|
|
echo "FAIL: $rule_ids with $ifc"
|
|
failed=1
|
|
else
|
|
echo "PASS: $rule_ids with $ifc"
|
|
fi
|
|
done
|
|
done
|
|
|
|
if [ "$failed" -ne 0 ]; then
|
|
echo "One or more validations failed"
|
|
exit 1
|
|
else
|
|
echo "All validations passed"
|
|
fi
|