Enhance Linux build process: Add nvidia-cuda-toolkit installation and… #21
Workflow file for this run
This file contains hidden or 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: Create Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Trigger on version tags like v1.0.0 | |
| permissions: | |
| contents: write | |
| jobs: | |
| create-release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| steps: | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref }} | |
| release_name: Ando Barrier ${{ github.ref_name }} | |
| draft: true | |
| prerelease: false | |
| body: | | |
| ## Ando Barrier Physics Simulator - ${{ github.ref_name }} | |
| ### Installation | |
| Download the appropriate package for your platform and install: | |
| 1. Download the `.zip` file for your OS | |
| 2. In Blender: Edit → Preferences → Add-ons → Install | |
| 3. Select the downloaded file | |
| 4. Enable "Ando Barrier Physics" | |
| ### Platform Support | |
| - **Linux**: x86_64, Python 3.11+ | |
| - **macOS**: Universal (Intel + Apple Silicon), Python 3.11+ | |
| - **Windows**: x64, Python 3.11+ | |
| ### What's New | |
| See CHANGELOG.md for detailed changes. | |
| --- | |
| **Note**: This is an automated draft release. Please verify all platform builds before publishing. | |
| build-and-upload: | |
| name: Build ${{ matrix.os }} | |
| needs: create-release | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ['3.11'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install dependencies (Ubuntu) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake build-essential libeigen3-dev python3-dev nvidia-cuda-toolkit | |
| pip install numpy | |
| pip install "pybind11[global]" | |
| - name: Install dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install cmake eigen pybind11 | |
| pip install numpy | |
| - name: Install dependencies (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' | |
| pip install numpy | |
| pip install "pybind11[global]" | |
| Invoke-WebRequest -Uri "https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.zip" -OutFile "eigen.zip" | |
| Expand-Archive -Path eigen.zip -DestinationPath C:\ | |
| echo "EIGEN3_INCLUDE_DIR=C:\eigen-3.4.0" >> $env:GITHUB_ENV | |
| - name: Build (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| mkdir -p build | |
| cd build | |
| PY_EXEC=$(python -c 'import sys; print(sys.executable)') | |
| cmake -DCMAKE_BUILD_TYPE=Release -DPython3_EXECUTABLE="$PY_EXEC" -DCMAKE_PREFIX_PATH=$(python -m pybind11 --cmakedir) .. | |
| cmake --build . --config Release | |
| cmake --install . --config Release | |
| - name: Build (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| if (-Not (Test-Path build)) { New-Item -ItemType Directory -Path build } | |
| cd build | |
| $pybind11_dir = python -m pybind11 --cmakedir | |
| $python_exec = python -c "import sys; print(sys.executable)" | |
| cmake -DCMAKE_BUILD_TYPE=Release -DEigen3_DIR=$env:EIGEN3_INCLUDE_DIR -DCMAKE_PREFIX_PATH="$pybind11_dir" -DPython3_EXECUTABLE="$python_exec" .. | |
| cmake --build . --config Release | |
| cmake --install . --config Release | |
| - name: Build PPF backend | |
| if: runner.os == 'Linux' | |
| shell: bash | |
| run: | | |
| cargo --version | |
| cd extern/ppf-contact-solver | |
| cargo build --release --bin ppf-contact-solver | |
| - name: Package addon | |
| id: package | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| VERSION=${{ github.ref_name }} | |
| rm -rf addon_package | |
| mkdir -p addon_package | |
| python -c "import pathlib, shutil; src=pathlib.Path('blender_addon'); dest=pathlib.Path('addon_package/ando_barrier'); shutil.rmtree(dest, ignore_errors=True); dest.parent.mkdir(parents=True, exist_ok=True); shutil.copytree(src, dest, ignore=shutil.ignore_patterns('__pycache__','*.pyc','.DS_Store'), dirs_exist_ok=True)" | |
| if [ ! -f addon_package/ando_barrier/ando_barrier_core.py ]; then | |
| echo "ando_barrier_core.py missing from packaged add-on" >&2 | |
| exit 1 | |
| fi | |
| shopt -s nullglob | |
| CORE_MODULES=(addon_package/ando_barrier/ando_barrier_core*.so addon_package/ando_barrier/ando_barrier_core*.pyd addon_package/ando_barrier/ando_barrier_core*.dylib) | |
| shopt -u nullglob | |
| if [ ${#CORE_MODULES[@]} -eq 0 ]; then | |
| echo "Compiled core module was not found in addon_package/ando_barrier/. Aborting package step." >&2 | |
| ls -al addon_package/ando_barrier | |
| exit 1 | |
| fi | |
| if [ "${{ runner.os }}" = "Linux" ]; then | |
| PPF_SOLVER_NAME="ppf-contact-solver" | |
| PPF_SOLVER_PATH="extern/ppf-contact-solver/target/release/${PPF_SOLVER_NAME}" | |
| if [ ! -f "$PPF_SOLVER_PATH" ]; then | |
| echo "PPF solver binary missing at $PPF_SOLVER_PATH" >&2 | |
| exit 1 | |
| fi | |
| python -c "import pathlib, shutil; src=pathlib.Path('extern/ppf-contact-solver'); dest=pathlib.Path('addon_package/ando_barrier/extern/ppf-contact-solver'); shutil.rmtree(dest, ignore_errors=True); dest.parent.mkdir(parents=True, exist_ok=True); shutil.copytree(src, dest, ignore=shutil.ignore_patterns('target','.git','__pycache__','*.pyc','.DS_Store'), dirs_exist_ok=True)" | |
| mkdir -p addon_package/ando_barrier/extern/ppf-contact-solver/target/release | |
| cp "$PPF_SOLVER_PATH" "addon_package/ando_barrier/extern/ppf-contact-solver/target/release/${PPF_SOLVER_NAME}" | |
| else | |
| echo "Skipping PPF solver packaging on ${{ runner.os }} (CUDA toolchain unavailable)." | |
| fi | |
| # Archive packaged add-on | |
| if [ "${{ runner.os }}" = "Windows" ]; then | |
| PACKAGE_NAME="ando_barrier_${VERSION}_windows_x64.zip" | |
| cd addon_package | |
| 7z a -tzip ../${PACKAGE_NAME} ando_barrier/ | |
| else | |
| if [ "${{ runner.os }}" = "Linux" ]; then | |
| PACKAGE_NAME="ando_barrier_${VERSION}_linux_x64.zip" | |
| else | |
| PACKAGE_NAME="ando_barrier_${VERSION}_macos_universal.zip" | |
| fi | |
| cd addon_package | |
| zip -r ../${PACKAGE_NAME} ando_barrier/ | |
| fi | |
| cd .. | |
| echo "package_name=${PACKAGE_NAME}" >> $GITHUB_OUTPUT | |
| - name: Upload Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ needs.create-release.outputs.upload_url }} | |
| asset_path: ./${{ steps.package.outputs.package_name }} | |
| asset_name: ${{ steps.package.outputs.package_name }} | |
| asset_content_type: application/zip |