|
| 1 | +# SPDX-FileCopyrightText: 2025 Ivan Perevala <[email protected]> |
| 2 | +# |
| 3 | +# SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | + |
| 5 | +name: Blender 4.3.0 |
| 6 | +description: | |
| 7 | + This workflow tests the Blender extension for multiple camera rendering. |
| 8 | +
|
| 9 | +on: |
| 10 | + push: |
| 11 | + branches: [main] |
| 12 | + pull_request: |
| 13 | + branches: [main] |
| 14 | + |
| 15 | +jobs: |
| 16 | + test-addon: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + env: |
| 20 | + BLENDER_VERSION: "4.3.0" |
| 21 | + BLENDER_DIR: "${{ github.workspace }}/blender" |
| 22 | + |
| 23 | + steps: |
| 24 | + - name: Checkout repository |
| 25 | + uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - name: Cache Blender |
| 28 | + id: cache-blender |
| 29 | + uses: actions/cache@v4 |
| 30 | + with: |
| 31 | + path: ${{ env.BLENDER_DIR }} |
| 32 | + key: blender-${{ env.BLENDER_VERSION }} |
| 33 | + |
| 34 | + - name: Download Blender if not cached |
| 35 | + if: steps.cache-blender.outputs.cache-hit != 'true' |
| 36 | + run: | |
| 37 | + BLENDER_MAJOR_MINOR=$(echo "${{ env.BLENDER_VERSION }}" | cut -d. -f1,2) |
| 38 | + DOWNLOAD_URL="https://download.blender.org/release/Blender${BLENDER_MAJOR_MINOR}/blender-${{ env.BLENDER_VERSION }}-linux-x64.tar.xz" |
| 39 | +
|
| 40 | + mkdir -p "${{ env.BLENDER_DIR }}" |
| 41 | + wget -qO- "${DOWNLOAD_URL}" | tar -xJ --strip-components=1 -C "${{ env.BLENDER_DIR }}" |
| 42 | +
|
| 43 | + - name: Download wheels to build Blender extension |
| 44 | + run: | |
| 45 | + PYTHON_BIN=$(find "${{ env.BLENDER_DIR }}" -type f -name "python3*" | head -n 1) |
| 46 | + "${PYTHON_BIN}" -m pip download -r requirements-dev.txt --dest "src/multiple_camera_render/wheels" |
| 47 | +
|
| 48 | + - name: Build and install Blender extension |
| 49 | + run: | |
| 50 | + mkdir -p "${{ github.workspace }}/dist" |
| 51 | +
|
| 52 | + ${{ env.BLENDER_DIR }}/blender --command extension build --source-dir="${{ github.workspace }}/src/multiple_camera_render" --output-dir="${{ github.workspace }}/dist" |
| 53 | + echo "Blender extension built successfully." |
| 54 | + EXTENSION_ZIP=$(find "${{ github.workspace }}/dist" -type f -name "*.zip" | head -n 1) |
| 55 | + echo "Extension zip file: ${EXTENSION_ZIP}" |
| 56 | + "${{ env.BLENDER_DIR }}/blender" --command extension install-file --repo user_default --enable "${EXTENSION_ZIP}" |
| 57 | + |
| 58 | + - name: Install dependencies |
| 59 | + run: | |
| 60 | + python -m pip install --upgrade pip |
| 61 | + pip install pytest |
| 62 | +
|
| 63 | + - name: Run tests |
| 64 | + run: | |
| 65 | + pytest -s -v --blender="${{ env.BLENDER_DIR }}/blender" --background-only |
0 commit comments