+1
-1
@@ -10,4 +10,4 @@ def get_folder_name():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
name = get_folder_name()
|
name = get_folder_name()
|
||||||
print(f'Show this value : {name}')
|
print(name)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Setup a new Semantic Version
|
- name: Setup a new Semantic Version
|
||||||
id: new_semantic_setup
|
id: new_semantic_setup
|
||||||
|
if: ${{ github.event.action == 'opened' }}
|
||||||
uses: zwaldowski/semver-release-action@v2
|
uses: zwaldowski/semver-release-action@v2
|
||||||
with:
|
with:
|
||||||
bump: ${{ inputs.bump_version }}
|
bump: ${{ inputs.bump_version }}
|
||||||
|
|||||||
@@ -20,10 +20,6 @@ on:
|
|||||||
required: true
|
required: true
|
||||||
default: 'false'
|
default: 'false'
|
||||||
|
|
||||||
env:
|
|
||||||
APP_NAME: 'moderlab_type'
|
|
||||||
NAME_PACKAGE: 'moderlab_type.zip'
|
|
||||||
|
|
||||||
|
|
||||||
# Execute this command
|
# Execute this command
|
||||||
jobs:
|
jobs:
|
||||||
@@ -33,17 +29,15 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@main
|
- uses: actions/checkout@main
|
||||||
|
|
||||||
|
- name: Setup package variable
|
||||||
|
id: folder
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=folder::$(python '.github/package.py')"
|
||||||
|
echo "::set-output name=package::$(python '.github/package.py').zip"
|
||||||
|
|
||||||
# Update the bl info version, update the init file and push if needed
|
# Update the bl info version, update the init file and push if needed
|
||||||
- name: Change version number in the bl info addon data
|
- name: Change version number in the bl info addon data
|
||||||
run: python '.github/version.py' --tag=${{ inputs.num_version }} --name=${{ env.APP_NAME }}
|
run: python '.github/version.py' --tag=${{ inputs.num_version }} --name=${{ steps.folder.outputs.folder }}
|
||||||
|
|
||||||
# Get the local folder name
|
|
||||||
- name: Setup package name
|
|
||||||
run: |
|
|
||||||
echo "With python, get a folder name"
|
|
||||||
python '.github/package.py'
|
|
||||||
echo "set with output value"
|
|
||||||
echo "::set-output name=type::$(python .github/package.py)"
|
|
||||||
|
|
||||||
- name: Commit the previous update
|
- name: Commit the previous update
|
||||||
uses: actions-js/push@v1.3
|
uses: actions-js/push@v1.3
|
||||||
@@ -60,18 +54,18 @@ jobs:
|
|||||||
- name: Create zip archive release
|
- name: Create zip archive release
|
||||||
run: |
|
run: |
|
||||||
cd '${{ github.workspace }}'
|
cd '${{ github.workspace }}'
|
||||||
zip -r '${{ github.workspace }}/releases/${{ env.NAME_PACKAGE }}' ${{ env.APP_NAME }}
|
zip -r '${{ github.workspace }}/releases/${{ steps.folder.outputs.package }}' ${{ steps.folder.outputs.folder }}
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ${{ env.NAME_PACKAGE }}
|
name: ${{ steps.folder.outputs.folder }}
|
||||||
path: ${{ github.workspace }}/releases/${{ env.NAME_PACKAGE }}
|
path: ${{ github.workspace }}/releases/${{ steps.folder.outputs.package }}
|
||||||
|
|
||||||
- name: Update the github release
|
- name: Update the github release
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
uses: johnwbyrd/update-release@v1.0.0
|
uses: johnwbyrd/update-release@v1.0.0
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
files: '${{ github.workspace }}/releases/${{ env.NAME_PACKAGE }}'
|
files: '${{ github.workspace }}/releases/${{ steps.folder.outputs.package }}'
|
||||||
release: ${{ inputs.name_version }}
|
release: ${{ inputs.name_version }}
|
||||||
tag: ${{ inputs.name_version }}
|
tag: ${{ inputs.name_version }}
|
||||||
@@ -16,7 +16,6 @@ jobs:
|
|||||||
prepare-first-release:
|
prepare-first-release:
|
||||||
name: Make the pre-release
|
name: Make the pre-release
|
||||||
needs: init-release-data
|
needs: init-release-data
|
||||||
if: ${{ github.event.action == 'opened' }}
|
|
||||||
uses: Moderlab-Production/BlenderTemplate/.github/workflows/generate_release.yml@main
|
uses: Moderlab-Production/BlenderTemplate/.github/workflows/generate_release.yml@main
|
||||||
with:
|
with:
|
||||||
bump_version: ${{ needs.init-release-data.outputs.version_type }}
|
bump_version: ${{ needs.init-release-data.outputs.version_type }}
|
||||||
@@ -28,6 +27,7 @@ jobs:
|
|||||||
name: Generate archive package
|
name: Generate archive package
|
||||||
needs:
|
needs:
|
||||||
- init-release-data
|
- init-release-data
|
||||||
|
- prepare-first-release
|
||||||
- unit-test
|
- unit-test
|
||||||
uses: Moderlab-Production/BlenderTemplate/.github/workflows/package.yml@main
|
uses: Moderlab-Production/BlenderTemplate/.github/workflows/package.yml@main
|
||||||
with:
|
with:
|
||||||
@@ -42,20 +42,8 @@ jobs:
|
|||||||
- release-package
|
- release-package
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Debug the release
|
- name: Update/Publish the release
|
||||||
uses: tubone24/update_release@v1.3.1
|
uses: tubone24/update_release@v1.3.1
|
||||||
if: ${{ needs.init-release-data.outputs.version_draft == 'true' }}
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
TAG_NAME: ${{ needs.init-release-data.outputs.version_name }}
|
|
||||||
with:
|
|
||||||
release_name: ${{ needs.init-release-data.outputs.version_name }}
|
|
||||||
body: ''
|
|
||||||
prerelease: ${{ needs.init-release-data.outputs.version_draft }}
|
|
||||||
|
|
||||||
- name: Publish the release
|
|
||||||
uses: tubone24/update_release@v1.3.1
|
|
||||||
if: ${{ needs.init-release-data.outputs.version_draft == 'false' }}
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
TAG_NAME: ${{ needs.init-release-data.outputs.version_name }}
|
TAG_NAME: ${{ needs.init-release-data.outputs.version_name }}
|
||||||
|
|||||||
+4
-30
@@ -1,31 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
MOUNT_FOLDER="addon_moderlab"
|
||||||
# To disable the sdt with each command, add ' > /dev/null 2>&1' to redirect all info
|
|
||||||
# Set all variables
|
|
||||||
MOUNT_FOLDER="/addon-moderlab"
|
|
||||||
INSTALL_ADDON="$MOUNT_FOLDER/tests/utils/blender_addon.py"
|
|
||||||
|
|
||||||
export FOLDER_TEST=$MOUNT_FOLDER
|
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 -noaudio --disable-autoexec --python-exit-code 1 --python "$1" -- --verbose || exit 1
|
||||||
# From a previous archive generated, install the moderlab plugin
|
|
||||||
/opt/blender/blender --background --python "$INSTALL_ADDON" -- "$MOUNT_FOLDER" > /dev/null 2>&1
|
|
||||||
install_error=$?
|
|
||||||
|
|
||||||
if [ $install_error = 1 ]; then
|
|
||||||
echo Blender Test Error
|
|
||||||
echo Exit code is install_error
|
|
||||||
(exit 1)
|
|
||||||
else
|
|
||||||
# ----- ----- ----- -----
|
|
||||||
# Launch Blender Test
|
|
||||||
/opt/blender/blender --background -noaudio --disable-autoexec --addons moderlab_type --python-exit-code 1 --python "$1" -- --verbose
|
|
||||||
blender_error=$?
|
|
||||||
|
|
||||||
if [ $blender_error = 1 ]; then
|
|
||||||
echo Blender Test Error
|
|
||||||
echo Exit code is $blender_error
|
|
||||||
(exit 1)
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
import unittest
|
import unittest
|
||||||
import bpy
|
import bpy
|
||||||
|
import glob
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
class ActivateAddon(unittest.TestCase):
|
class ActivateAddon(unittest.TestCase):
|
||||||
@@ -8,9 +10,15 @@ class ActivateAddon(unittest.TestCase):
|
|||||||
def setUp(self) -> None:
|
def setUp(self) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_folder_name():
|
||||||
|
"""Return the folder name to get the addon name we want activated"""
|
||||||
|
addon = glob.glob("/addon_moderlab/*/__init__.py", recursive=True)
|
||||||
|
return os.path.basename(os.path.dirname(addon[0]))
|
||||||
|
|
||||||
def test_activate_addon(self):
|
def test_activate_addon(self):
|
||||||
"""Activate the blender addon 'moderlab_plugin'"""
|
"""Activate the blender addon 'moderlab_plugin'"""
|
||||||
addon = bpy.ops.preferences.addon_enable(module='moderlab_type')
|
addon = bpy.ops.preferences.addon_enable(module=self.get_folder_name())
|
||||||
self.assertEqual({'FINISHED'}, addon)
|
self.assertEqual({'FINISHED'}, addon)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ def b3d_launch_blender_test(client: docker = docker.from_env(), test: list = Non
|
|||||||
local_path = os.environ.get('GITHUB_WORKSPACE')
|
local_path = os.environ.get('GITHUB_WORKSPACE')
|
||||||
else:
|
else:
|
||||||
local_path = os.getcwd()
|
local_path = os.getcwd()
|
||||||
container_folder = '/addon-moderlab'
|
container_folder = '/addon_moderlab'
|
||||||
volume = [f'{local_path}:{container_folder}']
|
volume = [f'{local_path}:{container_folder}']
|
||||||
image_name = tag
|
image_name = tag
|
||||||
if test is None:
|
if test is None:
|
||||||
|
|||||||
@@ -5,16 +5,17 @@ import bpy
|
|||||||
dependency = {
|
dependency = {
|
||||||
# 'moderlab_plugin': ['moderlab_plugin.zip', 'Moderlab-Production/BlenderPlugin'],
|
# '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'],
|
# 'uv-packer': ['uv-packer.zip', 'Moderlab-Production/UvPacker'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def b3d_install_addon(addon_path: str):
|
def b3d_install_addon():
|
||||||
for key, value in dependency.items():
|
for key, value in dependency.items():
|
||||||
bpy.ops.preferences.addon_install(filepath=f'{addon_path}/{value[0]}')
|
bpy.ops.preferences.addon_install(filepath=f'/addon_moderlab/{value[0]}')
|
||||||
bpy.ops.preferences.addon_enable(module=key)
|
bpy.ops.preferences.addon_enable(module=key)
|
||||||
bpy.ops.wm.save_userpref()
|
bpy.ops.wm.save_userpref()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
b3d_install_addon(sys.argv[-1])
|
b3d_install_addon()
|
||||||
|
|||||||
Reference in New Issue
Block a user