Build Voxelization Toolkit Windows #13
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
name: Build Voxelization Toolkit Windows | |
on: | |
workflow_dispatch: | |
jobs: | |
build_voxec: | |
runs-on: windows-2019 | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ['3.9.11', '3.10.3', '3.11.8', '3.12.1', '3.13.0'] | |
arch: ['x64'] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Checkout IfcOpenShell | |
uses: actions/checkout@v3 | |
with: | |
repository: IfcOpenShell/IfcOpenShell | |
path: IfcOpenShell | |
token: ${{ secrets.BUILD_REPO_TOKEN }} | |
submodules: recursive | |
- name: Checkout Build Repository | |
uses: actions/checkout@v3 | |
with: | |
repository: IfcOpenShell/build-outputs | |
path: IfcOpenShell\_deps-vs2019-x64-installed | |
ref: windows-${{ matrix.arch }} | |
lfs: true | |
token: ${{ secrets.BUILD_REPO_TOKEN }} | |
- name: Install Dependencies | |
run: | | |
choco install -y sed 7zip.install awscli | |
- name: Install Python | |
run: | | |
$installer = "python-${{ matrix.python }}-amd64.exe" | |
$url = "https://www.python.org/ftp/python/${{ matrix.python }}/$installer" | |
Invoke-WebRequest -Uri $url -OutFile $installer | |
Start-Process -Wait -FilePath .\$installer -ArgumentList '/quiet InstallAllUsers=0 PrependPath=0 Include_test=0 TargetDir=C:\Python\${{ matrix.python }}' | |
Remove-Item .\$installer | |
- name: Unpack IfcOpenShell Dependencies | |
run: | | |
cd IfcOpenShell\_deps-vs2019-x64-installed | |
Get-ChildItem -Path . -Filter 'cache-*.zip' | ForEach-Object { | |
7z x $_.FullName | |
} | |
- name: Run IfcOpenShell Build Script | |
shell: cmd | |
run: | | |
setlocal EnableDelayedExpansion | |
SET PYTHON_VERSION=${{ matrix.python }} | |
for /f "tokens=1,2,3 delims=." %%a in ("%PYTHON_VERSION%") do ( | |
set PY_VER_MAJOR_MINOR=%%a%%b | |
) | |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | |
SET IFCOS_INSTALL_PYTHON=FALSE | |
cd IfcOpenShell\win | |
echo y | call build-deps.cmd vs2019-x64 Release | |
SET PYTHONHOME=C:\Python\${{ matrix.python }} | |
call run-cmake.bat vs2019-x64 -DENABLE_BUILD_OPTIMIZATIONS=On -DGLTF_SUPPORT=ON -DADD_COMMIT_SHA=ON -DVERSION_OVERRIDE=ON | |
call install-ifcopenshell.bat vs2019-x64 Release | |
- name: Compile voxec | |
run: | | |
mkdir build | |
cd build | |
$base=(Resolve-Path ../ifcopenshell/).Path | |
cmake .. ` | |
"-DCMAKE_BUILD_TYPE=Release" ` | |
"-DENABLE_PYTHON_WRAPPER=On" ` | |
"-DENABLE_TESTS=Off" ` | |
"-DUSE_BUILD_SCRIPT_OUTPUT=Off" ` | |
"-DBoost_USE_STATIC_LIBS=On" ` | |
"-DBoost_NO_BOOST_CMAKE=On" ` | |
"-DCMAKE_INSTALL_PREFIX=../install" ` | |
"-DIFC_INCLUDE_DIR=$base/_installed-vs2019-x64/include" ` | |
"-DIFC_LIBRARY_DIR=$base/_installed-vs2019-x64/lib" ` | |
"-DOCC_INCLUDE_DIR=$base/_deps-vs2019-x64-installed/opencascade-7.8.1/inc" ` | |
"-DOCC_LIBRARY_DIR=$base/_deps-vs2019-x64-installed/opencascade-7.8.1/win64/lib" ` | |
"-DPython_EXECUTABLE=C:\Python\${{ matrix.python }}\python.exe" ` | |
"-DBOOST_ROOT=$base/_deps/boost_1_86_0" ` | |
"-DBOOST_LIBRARYDIR=$base/_deps/boost_1_86_0/stage/vs2019-x64/lib" ` | |
"-DGMP_LIBRARY_DIR=$base/_deps-vs2019-x64-installed/mpir" ` | |
"-DMPFR_LIBRARY_DIR=$base/_deps-vs2019-x64-installed/mpfr" ` | |
"-DSWIG_EXECUTABLE=$base/_deps-vs2019-x64-installed/swigwin/swig.exe" | |
cmake --build . --target install --config Release | |
- name: Package .zip Archives | |
run: | | |
$VERSION = Get-Content VVERSION -Raw | |
$pyVersion = "${{ matrix.python }}" | |
$pyVersionMajor = ($pyVersion -split '\.')[0..1] -join '' | |
$OUTPUT_DIR = "$env:GITHUB_WORKSPACE\package" | |
New-Item -ItemType Directory -Force -Path $OUTPUT_DIR | |
cd $OUTPUT_DIR | |
cp -r C:\Python\${{ matrix.python }}\Lib\site-packages\voxec . | |
cp $env:GITHUB_WORKSPACE\pyproject.toml . | |
(Get-Content pyproject.toml).Replace('[VERSION]', $VERSION) | Set-Content pyproject.toml | |
C:\Python\${{ matrix.python }}\python.exe -m pip install build | |
C:\Python\${{ matrix.python }}\python.exe -m build -w | |
mv .\dist\voxec-${VERSION}-py3-none-any.whl .\dist\voxec-${VERSION}-py${pyVersionMajor}-none-win_amd64.whl | |
- name: Publish a Python distribution to PyPI | |
uses: ortega2247/pypi-upload-action@master | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
packages_dir: package\dist |