Merge pull request #26 from Moderlab-Production/develop
Update docker setup
This commit is contained in:
Binary file not shown.
@@ -1,5 +1,3 @@
|
||||
#!/bin/bash
|
||||
MOUNT_FOLDER="addon_moderlab"
|
||||
export FOLDER_TEST=$MOUNT_FOLDER
|
||||
/opt/blender/blender --background --python-exit-code 1 --python "/addon_moderlab/tests/utils/blender_addon.py" > /dev/null 2>&1 || exit 1
|
||||
/opt/blender/blender --background --python-exit-code 1 --python "$FOLDER_TEST/tests/utils/blender_addon.py" || exit 1 > /dev/null 2>&1
|
||||
/opt/blender/blender --background -noaudio --disable-autoexec --python-exit-code 1 --python "$1" -- --verbose || exit 1
|
||||
@@ -43,6 +43,5 @@ if __name__ == '__main__':
|
||||
launch_unit_test(test=test_list, tag=docker_tag)
|
||||
|
||||
# Clear archive file and container
|
||||
clear_container_test(tag=docker_tag)
|
||||
for archive in archives:
|
||||
os.remove(Path(os.getcwd(), archive))
|
||||
|
||||
@@ -7,9 +7,6 @@ import os
|
||||
class ActivateAddon(unittest.TestCase):
|
||||
"""Activate the Blender addon"""
|
||||
|
||||
def setUp(self) -> None:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def get_folder_name():
|
||||
"""Return the folder name to get the addon name we want activated"""
|
||||
|
||||
@@ -31,12 +31,12 @@ def b3d_launch_blender_test(client: docker = docker.from_env(), test: list = Non
|
||||
try:
|
||||
for test in unit_test:
|
||||
print(f'Start this test : {test}')
|
||||
command = [f"/bin/bash",
|
||||
command = [f"/bin/sh",
|
||||
f"{PurePosixPath(container_folder, 'tests', 'launch_test.sh')}",
|
||||
f"{PurePosixPath(container_folder, 'tests', 'unit_test', test)}"]
|
||||
|
||||
docker_test = client.containers.run(image_name, command=command, volumes=volume, privileged=True,
|
||||
detach=True)
|
||||
environment=[f'FOLDER_TEST={container_folder}'], detach=True, name=test)
|
||||
exit_docker = docker_test.wait()
|
||||
if exit_docker['StatusCode'] != 0:
|
||||
print(f'Container error "{exit_docker["StatusCode"]}".\n\t'
|
||||
|
||||
@@ -1,21 +1,37 @@
|
||||
import sys
|
||||
import bpy
|
||||
import os
|
||||
import pathlib
|
||||
|
||||
# Paste this variable in the blender.py
|
||||
dependency = {
|
||||
# 'moderlab_plugin': ['moderlab_plugin.zip', 'Moderlab-Production/BlenderPlugin'],
|
||||
'moderlab_type': ['moderlab_type.zip', 'Moderlab-Production/BlenderObjectType'],
|
||||
# 'moderlab_type': ['moderlab_type.zip', 'Moderlab-Production/BlenderObjectType'],
|
||||
# 'moderlab_pie': ['moderlab_pie.zip', 'Moderlab-Production/BlenderPieMenu'],
|
||||
# 'uv-packer': ['uv-packer.zip', 'Moderlab-Production/UvPacker'],
|
||||
}
|
||||
|
||||
|
||||
def b3d_install_addon():
|
||||
env_name = 'FOLDER_TEST'
|
||||
try:
|
||||
if not os.environ.get(env_name):
|
||||
raise KeyError
|
||||
env_path = pathlib.Path(os.environ[env_name])
|
||||
if not env_path.exists():
|
||||
raise FileNotFoundError
|
||||
|
||||
for key, value in dependency.items():
|
||||
bpy.ops.preferences.addon_install(filepath=f'/addon_moderlab/{value[0]}')
|
||||
bpy.ops.preferences.addon_install(filepath=f'{env_path}/{value[0]}')
|
||||
bpy.ops.preferences.addon_enable(module=key)
|
||||
bpy.ops.wm.save_userpref()
|
||||
|
||||
except KeyError:
|
||||
print(f'Env. "{env_name}" doesn\'t exist')
|
||||
exit(1)
|
||||
except FileNotFoundError:
|
||||
print('Wrong path to execute this Unit Test')
|
||||
exit(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
b3d_install_addon()
|
||||
|
||||
Reference in New Issue
Block a user