brown-street/.forgejo/workflows/ifc-lint.yml

46 lines
1.6 KiB
YAML
Raw Permalink Normal View History

# Schema/rule validation for every IFC model in the repo.
#
# Port of .github/workflows/ifc-lint.yml. Only the setup steps and `runs-on:`
# changed: `ifc-ci` already contains ifcopenshell, so there is no setup-python
# and no pip install -- on GitHub those were most of the runtime.
#
# Runs on the user-scoped `ifc` runner (user ci-ifc) on hub.postle.net, whose
# root-owned config.yaml has an empty `valid_volumes`. A job here can mount no
# host path at all, which is what makes it safe to run an outside contributor's
# pull request.
name: IFC Validation
on:
push:
pull_request:
jobs:
lint-ifc:
runs-on: ifc
container:
image: hub.postle.net/bruno/ifc-ci:latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run IFC lint checks
# shell: bash is REQUIRED, not decoration. The runner executes `run:`
# blocks with /bin/sh (dash) unless told otherwise, so the GitHub
# original's `shopt -s globstar` dies with "shopt: not found" and
# exit 127 before the first file is checked. `[[ ]]` and arrays need
# bash too.
shell: bash
# Gates on its own exit status: ifcopenshell.validate calls sys.exit()
# on failure, so `set -e` fails the job.
run: |
set -e
shopt -s globstar nullglob
for file in **/*.ifc; do
# libraries/ holds vendored component sources, not deliverable models.
[[ "$file" == libraries/* ]] && continue
echo "Validating $file..."
python3 -m ifcopenshell.validate --rules "$file"
done