Added Dockerfile that runs the tests & VS code action
This will be how tests are executed locally
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -1,3 +1,4 @@
|
|||||||
*.psk filter=lfs diff=lfs merge=lfs -text
|
*.psk filter=lfs diff=lfs merge=lfs -text
|
||||||
*.psa filter=lfs diff=lfs merge=lfs -text
|
*.psa filter=lfs diff=lfs merge=lfs -text
|
||||||
*.pskx filter=lfs diff=lfs merge=lfs -text
|
*.pskx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.blend filter=lfs diff=lfs merge=lfs -text
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -104,4 +104,5 @@ venv.bak/
|
|||||||
.mypy_cache/
|
.mypy_cache/
|
||||||
|
|
||||||
# PyCharm
|
# PyCharm
|
||||||
.idea
|
.idea
|
||||||
|
*.blend1
|
||||||
|
|||||||
12
.vscode/tasks.json
vendored
Normal file
12
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "io_scene_psk_psa: test",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "docker run -it --volume ${PWD}/io_scene_psk_psa:/addons/io_scene_psk_psa --volume ${PWD}/tests:/tests $(docker build -q .)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
33
Dockerfile
Normal file
33
Dockerfile
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
FROM ubuntu:22.04
|
||||||
|
|
||||||
|
ARG BLENDER_VERSION=4.4
|
||||||
|
|
||||||
|
RUN apt-get update -y && \
|
||||||
|
apt-get install -y libxxf86vm-dev libxfixes3 libxi-dev libxkbcommon-x11-0 libgl1 libglx-mesa0 python3 python3-pip \
|
||||||
|
libxrender1 libsm6
|
||||||
|
|
||||||
|
RUN pip install --upgrade pip
|
||||||
|
RUN pip install pytest-blender
|
||||||
|
RUN pip install blender-downloader
|
||||||
|
|
||||||
|
# Set BLENDER_EXECUTABLE and BLENDER_PYTHON as environment variables
|
||||||
|
RUN BLENDER_EXECUTABLE=$(blender-downloader $BLENDER_VERSION --extract --remove-compressed --print-blender-executable) && \
|
||||||
|
BLENDER_PYTHON=$(pytest-blender --blender-executable "${BLENDER_EXECUTABLE}") && \
|
||||||
|
echo "Blender executable: $BLENDER_EXECUTABLE" && \
|
||||||
|
echo "Blender Python: $BLENDER_PYTHON" && \
|
||||||
|
echo "export BLENDER_EXECUTABLE=${BLENDER_EXECUTABLE}" >> /etc/environment && \
|
||||||
|
echo "export BLENDER_PYTHON=${BLENDER_PYTHON}" >> /etc/environment && \
|
||||||
|
echo $BLENDER_EXECUTABLE > /blender_executable_path
|
||||||
|
|
||||||
|
# Source the environment variables and install Python dependencies
|
||||||
|
RUN . /etc/environment && \
|
||||||
|
$BLENDER_PYTHON -m ensurepip && \
|
||||||
|
$BLENDER_PYTHON -m pip install pytest
|
||||||
|
|
||||||
|
# Persist BLENDER_EXECUTABLE as an environment variable
|
||||||
|
RUN echo $(cat /blender_executable_path) > /tmp/blender_executable_path_env && \
|
||||||
|
export BLENDER_EXECUTABLE=$(cat /tmp/blender_executable_path_env)
|
||||||
|
ENV BLENDER_EXECUTABLE /tmp/blender_executable_path_env
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/bin/bash", "-c" ]
|
||||||
|
CMD ["export BLENDER_EXECUTABLE=$(cat /blender_executable_path) && echo $BLENDER_EXECUTABLE && pytest -svv tests --blender-executable $BLENDER_EXECUTABLE --blender-addons-dirs addons"]
|
||||||
Reference in New Issue
Block a user