Skip to content

update the geometry node input with new material (#206) #624

update the geometry node input with new material (#206)

update the geometry node input with new material (#206) #624

# Test the batoms plugin using test
name: Test batoms blender plugin
on:
push:
branches:
- main
- workflow
pull_request:
branches:
- main
- workflow
workflow_dispatch:
env:
TEST_IMAGE_NAME: ghcr.io/beautiful-atoms/blender-env
jobs:
unittests:
defaults:
run:
shell: bash
runs-on: ubuntu-latest
strategy:
matrix:
# Manually change these to match the blender image versions
blender-version: ["3.6"]
container:
# env is not
image: ghcr.io/beautiful-atoms/blender-env:blender${{ matrix.blender-version }}
# Will need pytest installation
options: --user root
steps:
- uses: actions/checkout@v2
- name: Copy addons to blender
run: |
mkdir -p $BLENDER_PATH/scripts/addons_contrib
cp -r batoms $BLENDER_PATH/scripts/addons_contrib/
- name: Enable blender addons
# Enable the blender blender addon and save user pref
run: |
blender -b --python-exit-code 1 --python-expr "import bpy; import addon_utils; addon_utils.enable('batoms', default_set=True); bpy.ops.wm.save_userpref(); print('success')"
- name: Enable blender default preferences and startup files
run: |
blender -b --python-exit-code 1 --python-expr "import bpy; bpy.ops.batoms.use_batoms_preference(); bpy.ops.batoms.use_batoms_startup(); print('success')"
- name: Test blender path
# Test the sys.path contains the `addons_contrib` path
run: |
blender -b --python-exit-code 1 --python-expr "import sys; assert(any(['scripts/addons_contrib' in p for p in sys.path]))"
- name: Test import
run: |
blender -b --python-exit-code 1 --python-expr "from batoms import Batoms; b = Batoms('O', ['O'], [[0, 0, 0]])"
- name: Install test dependencies
run: |
$BLENDERPY -m pip install pytest==6.2.5 flake8 pytest-blender
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --exclude=batoms/gui/,batoms/ops/,batoms/modal,batoms/__init__.py,batoms/custom_property.py,batoms/install/,batoms/preferences.py,ops*py,gui*.py,ui*.py,modal*py,bpy*.py --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --exclude=batoms/gui/,batoms/ops/,batoms/modal,batoms/__init__.py,batoms/custom_property.py,batoms/install/,batoms/preferences.py,ops*py,gui*.py,ui*.py,modal*py,bpy*.py --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run explicit test on default preference loading
run: |
cd tests
blender -b -P test_default_preference.py
- name: Run blender unittests
run: |
cd tests
pytest -svv --ignore=test_default_preference.py \
--ignore=test_batomspy_shebang.py \
--ignore=test_install_script.py
shebang-test:
runs-on: ubuntu-latest
strategy:
matrix:
blender-version: ["3.6"]
container:
image: ghcr.io/beautiful-atoms/beautiful-atoms:blender${{ matrix.blender-version }}
options: --user root
steps:
- uses: actions/checkout@v2
- name: Copy addons to blender
run: |
mkdir -p $BLENDER_PATH/scripts/addons_contrib
cp -r batoms $BLENDER_PATH/scripts/addons_contrib/
- name: Enable blender addons
# Enable the blender blender addon and save user pref
run: |
blender -b --python-exit-code 1 --python-expr "import bpy; import addon_utils; addon_utils.enable('batoms', default_set=True); bpy.ops.wm.save_userpref(); print('success')"
- name: Install test dependencies
run: |
python -m pip install pytest
- name: Run explicit test on shebang
run: |
pytest -svv tests/test_batomspy_shebang.py