Skip to content

Commit f2a0de2

Browse files
committed
Draft implementation of full test automation using GitHub actions
1 parent 8dc5358 commit f2a0de2

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

.github/workflows/blender-test.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Blender Test (4.2, 4.3, 4.4)
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test-addon:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
blender_version: ["4.2.0", "4.3.0", "4.4.0"]
16+
17+
env:
18+
BLENDER_VERSION: ${{ matrix.blender_version }}
19+
BLENDER_DIR: "${{ github.workspace }}/blender"
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Cache Blender
26+
id: cache-blender
27+
uses: actions/cache@v4
28+
with:
29+
path: ${{ env.BLENDER_DIR }}
30+
key: blender-${{ matrix.blender_version }}
31+
32+
- name: Download Blender if not cached
33+
if: steps.cache-blender.outputs.cache-hit != 'true'
34+
run: |
35+
BLENDER_MAJOR_MINOR=$(echo "${{ env.BLENDER_VERSION }}" | cut -d. -f1,2)
36+
DOWNLOAD_URL="https://download.blender.org/release/Blender${BLENDER_MAJOR_MINOR}/blender-${{ env.BLENDER_VERSION }}-linux-x64.tar.xz"
37+
38+
mkdir -p "${{ env.BLENDER_DIR }}"
39+
wget -qO- "${DOWNLOAD_URL}" | tar -xJ --strip-components=1 -C "${{ env.BLENDER_DIR }}"
40+
41+
- name: Install pytest in Blender's Python
42+
run: |
43+
PYTHON_BIN=$(find "${{ env.BLENDER_DIR }}" -type f -name "python3*" | head -n 1)
44+
echo "Using Python binary: ${PYTHON_BIN}"
45+
46+
"${{ env.BLENDER_DIR }}/blender" --background --python-expr \
47+
"import subprocess as sp; \
48+
sp.run([r'${PYTHON_BIN}', '-m', 'ensurepip'], check=True); \
49+
sp.run([r'${PYTHON_BIN}', '-m', 'pip', 'install', '--upgrade', 'pip'], check=True); \
50+
sp.run([r'${PYTHON_BIN}', '-m', 'pip', 'install', 'pytest'], check=True)"
51+
52+
- name: Build Blender extension
53+
run: |
54+
${{ env.BLENDER_DIR }}/blender --command extension build --source-dir="${{ github.workspace }}/src/multiple_camera_render" --output-dir="${{ github.workspace }}/dist"
55+
echo "Blender extension built successfully."
56+
EXTENSION_ZIP=$(find "${{ github.workspace }}/dist" -type f -name "*.zip" | head -n 1)
57+
echo "Extension zip file: ${EXTENSION_ZIP}"
58+
59+
- name: Install Blender extension
60+
run: |
61+
"${{ env.BLENDER_DIR }}/blender" --background --command extension install "${EXTENSION_ZIP}"

0 commit comments

Comments
 (0)