ci-ifcwrap-standalone: deduplicate wrapper building code

This commit is contained in:
Andrej730
2026-09-03 16:24:41 +05:00
parent 2613fb53ba
commit 5114ae26ea
2 changed files with 61 additions and 68 deletions
@@ -0,0 +1,53 @@
name: Build and install standalone IfcPython
description: Configure, build and smoke-test src/ifcwrap against an already-installed IfcOpenShell for a given Python version.
inputs:
python-version:
description: Python version to build the wrapper for (e.g. "3.11")
required: true
ifcopenshell-prefix:
description: CMAKE_PREFIX_PATH entry pointing at the installed IfcOpenShell
required: true
runs:
using: composite
steps:
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ inputs.python-version }}
- name: Install Python import dependencies
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install numpy typing_extensions
- name: Configure standalone IfcPython
shell: bash
run: |
PYTHON_EXECUTABLE="$(python -c 'import sys; print(sys.executable)')"
PYTHON_INCLUDE_DIR="$(python -c 'import sysconfig; print(sysconfig.get_path("include"))')"
cmake -S src/ifcwrap -B "build-ifcwrap-${{ inputs.python-version }}" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${{ inputs.ifcopenshell-prefix }};/usr" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DPython_EXECUTABLE:FILEPATH="${PYTHON_EXECUTABLE}" \
-DPython_INCLUDE_DIR:PATH="${PYTHON_INCLUDE_DIR}" \
-DPYTHON_EXECUTABLE:FILEPATH="${PYTHON_EXECUTABLE}" \
-DPYTHON_INCLUDE_DIR:PATH="${PYTHON_INCLUDE_DIR}"
- name: Build and install standalone IfcPython
shell: bash
run: |
cmake --build "build-ifcwrap-${{ inputs.python-version }}" --target install -j "$(nproc)"
- name: Import installed IfcPython
shell: bash
run: |
PYTHONPATH="${RUNNER_TEMP}/ifcopenshell-python" python - <<'PY'
import ifcopenshell
print("IfcOpenShell import ok:", ifcopenshell.version)
PY
+8 -68
View File
@@ -94,74 +94,14 @@ jobs:
run: | run: |
cmake --build build-ifcopenshell --target install -j "$(nproc)" cmake --build build-ifcopenshell --target install -j "$(nproc)"
- name: Set up Python 3.11 - name: Build and install standalone IfcPython for Python 3.11
uses: actions/setup-python@v7 uses: ./.github/actions/build-ifcwrap-python
with: with:
python-version: 3.11 python-version: "3.11"
ifcopenshell-prefix: ${{ env.IFCOPENSHELL_PREFIX }}
- name: Install Python import dependencies - name: Build and install standalone IfcPython for Python 3.12
run: | uses: ./.github/actions/build-ifcwrap-python
python -m pip install --upgrade pip
python -m pip install numpy typing_extensions
- name: Configure standalone IfcPython
run: |
PYTHON_EXECUTABLE="$(python -c 'import sys; print(sys.executable)')"
PYTHON_INCLUDE_DIR="$(python -c 'import sysconfig; print(sysconfig.get_path("include"))')"
cmake -S src/ifcwrap -B "build-ifcwrap-311" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${IFCOPENSHELL_PREFIX};/usr" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DPython_EXECUTABLE:FILEPATH="${PYTHON_EXECUTABLE}" \
-DPython_INCLUDE_DIR:PATH="${PYTHON_INCLUDE_DIR}" \
-DPYTHON_EXECUTABLE:FILEPATH="${PYTHON_EXECUTABLE}" \
-DPYTHON_INCLUDE_DIR:PATH="${PYTHON_INCLUDE_DIR}"
- name: Build and install standalone IfcPython
run: |
cmake --build "build-ifcwrap-311" --target install -j "$(nproc)"
- name: Import installed IfcPython
run: |
PYTHONPATH="${RUNNER_TEMP}/ifcopenshell-python" python - <<'PY'
import ifcopenshell
print("IfcOpenShell import ok:", ifcopenshell.version)
PY
- name: Set up Python 3.12
uses: actions/setup-python@v7
with: with:
python-version: 3.12 python-version: "3.12"
ifcopenshell-prefix: ${{ env.IFCOPENSHELL_PREFIX }}
- name: Install Python import dependencies
run: |
python -m pip install --upgrade pip
python -m pip install numpy typing_extensions
- name: Configure standalone IfcPython
run: |
PYTHON_EXECUTABLE="$(python -c 'import sys; print(sys.executable)')"
PYTHON_INCLUDE_DIR="$(python -c 'import sysconfig; print(sysconfig.get_path("include"))')"
cmake -S src/ifcwrap -B "build-ifcwrap-312" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${IFCOPENSHELL_PREFIX};/usr" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DPython_EXECUTABLE:FILEPATH="${PYTHON_EXECUTABLE}" \
-DPython_INCLUDE_DIR:PATH="${PYTHON_INCLUDE_DIR}" \
-DPYTHON_EXECUTABLE:FILEPATH="${PYTHON_EXECUTABLE}" \
-DPYTHON_INCLUDE_DIR:PATH="${PYTHON_INCLUDE_DIR}"
- name: Build and install standalone IfcPython
run: |
cmake --build "build-ifcwrap-312" --target install -j "$(nproc)"
- name: Import installed IfcPython
run: |
PYTHONPATH="${RUNNER_TEMP}/ifcopenshell-python" python - <<'PY'
import ifcopenshell
print("IfcOpenShell import ok:", ifcopenshell.version)
PY