Skip to content

Commit

Permalink
update GHA (#704)
Browse files Browse the repository at this point in the history
* update GHA

* update docs buildling

* update GHA

* Update tests.yml

* specify build folder

* Update pyproject.toml

* Update tests.yml

* Update tests.yml

* update snapshots for error

* fix tests density

* update tests

* update tests

* update tests

* skip problematic test
  • Loading branch information
BradyAJohnston authored Jan 7, 2025
1 parent 5c05b5a commit c036948
Show file tree
Hide file tree
Showing 16 changed files with 90 additions and 157 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: macos-14
strategy:
matrix:
version: [4.2, 4.3]
version: [4.2.5, 4.3.2]
env:
ADDON_NAME: molecularnodes
steps:
Expand All @@ -22,7 +22,7 @@ jobs:
with:
file: '${{ env.ADDON_NAME }}/blender_manifest.toml'
field: 'version'
- uses: BradyAJohnston/setup-blender@v2
- uses: BradyAJohnston/setup-blender@v2.1
with:
version: ${{ matrix.version }}
- name: Build extension
Expand Down
24 changes: 6 additions & 18 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,24 @@ jobs:
build-docs:
runs-on: macos-14
permissions: write-all
env:
version: 4.2
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11.7"
cache: pip

- uses: quarto-dev/quarto-actions/setup@v2
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v4
- name: Setup Blender
uses: BradyAJohnston/setup-[email protected]
with:
version: "latest"
version: 4.2.5
- name: Install Packages
run: |
uv venv --python=3.11
uv pip install -r pyproject.toml --all-extras
uv pip install -e .
blender -b -P tests/python.py -- -m pip install -e ".[docs]"
- name: Generate Docs
run: |
uv run docs/generate.py
blender -b -P docs/generate.py
- name: Render Docs
run: quarto render docs

# push to netlify -------------------------------------------------------

# set release name ----


- name: Configure pull release name
if: ${{github.event_name == 'pull_request'}}
run: |
Expand Down
40 changes: 0 additions & 40 deletions .github/workflows/test-addon.yml

This file was deleted.

81 changes: 36 additions & 45 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,40 @@
name: test-addon
name: test-in-blender

on:
push:
branches: ["main"]
pull_request:
branches: ["main", "4.1"]

push:
branches: ["main"]
pull_request:
branches: ["main", "4.2", "4.3"]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 4
fail-fast: false
matrix:
blender-version: ["4.1.0"]
python-version: ['3.11.7']
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
# - run: pip install bpy==${{ matrix.blender-version }}
- name: Install
run: |
pip install poetry
poetry install --with=dev
- name: Install pyopenvdb
if: matrix.os == 'ubuntu-latest'
run: |
cd $(poetry run python -c "import os; import bpy; print(os.path.dirname(bpy.__file__)+'/../../../../../')")
svn export https://svn.blender.org/svnroot/bf-blender/trunk/lib/linux_x86_64_glibc_228/python/lib/python3.10/site-packages/pyopenvdb.so@r63589
pip install patchelf
patchelf --set-rpath '$ORIGIN/bpy/lib' pyopenvdb.so
- name: Run Tests
run: poetry run python -m pytest --verbose --cov=molecularnodes --cov-report=xml:coverage.xml --ignore=molecularnodes/ui/panel.py -k "not star"
build:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 4
fail-fast: false
matrix:
version: ["4.2.5", "4.3.2", "daily"]
os: [ubuntu-latest, macos-14, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: BradyAJohnston/[email protected]
with:
version: ${{ matrix.version }}
- name: Install in Blender
run: |
blender -b -P tests/python.py -- -m pip install ".[test]"
- name: Run Tests
run: |
blender -b -P tests/run.py -- -vv tests --cov --cov-report=xml
- name: Expose coverage as a CI download
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest' && matrix.version == '4.2.5'
with:
name: coverage.xml
path: coverage.xml

- name: Expose coverage as a CI download # Related to test_addon_blender_advanced.py
uses: actions/upload-artifact@v1
with:
name: coverage.xml
path: coverage.xml
# setup ssh to check on file system state
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
- name: Upload coverage reports to Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3

6 changes: 3 additions & 3 deletions molecularnodes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import bpy
from bpy.app.handlers import frame_change_post, load_post, save_post
from bpy.app.handlers import frame_change_pre, load_post, save_post
from bpy.props import PointerProperty, CollectionProperty
from .handlers import update_trajectories
from . import entities, operators, props, session, ui
Expand Down Expand Up @@ -58,7 +58,7 @@ def register():

save_post.append(session._pickle)
load_post.append(session._load)
frame_change_post.append(update_trajectories)
frame_change_pre.append(update_trajectories)

bpy.types.Scene.MNSession = session.MNSession()
bpy.types.Object.mn = PointerProperty(type=props.MolecularNodesObjectProperties)
Expand All @@ -82,7 +82,7 @@ def unregister():

save_post.remove(session._pickle)
load_post.remove(session._load)
frame_change_post.remove(update_trajectories)
frame_change_pre.remove(update_trajectories)
del bpy.types.Scene.MNSession
del bpy.types.Scene.mn
del bpy.types.Object.mn
Expand Down
2 changes: 1 addition & 1 deletion molecularnodes/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _selection_update_trajectories(self, context: bpy.types.Context) -> None:
# this is the 'perisisent' function which can be appended onto the
# `bpy.app.handlers.frame_change_*` functions. Either before or after the frame changes
# this function will then be called - ensuring all of the trajectories are up to date. We
# use the `frame_change_post` handler as we want the frame to change first, then we update
# use the `frame_change_pre` handler as we want the frame to change first, then we update
# the universe based on the current frame value
@persistent
def update_trajectories(scene):
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ dev = ["pytest", "pytest-cov", "syrupy", "scipy", "fake-bpy-module"]
test = ["pytest", "pytest-cov", "syrupy", "scipy"]
docs = ["quartodoc", "tomlkit", "nodepad"]

[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=61.0"]

[tool.setuptools]
include-package-data = true
packages = ["molecularnodes"]

[tool.setuptools.package-data]
molecularnodes = ["assets/*", "assets/template/*"]
12 changes: 6 additions & 6 deletions tests/__snapshots__/test_attributes.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
62 70 64 71]
# ---
# name: test_attribute[1BNA-bcif].12
AttributeError("The selected attribute 'sec_struct' does not exist on the mesh.")
NamedAttributeError("The selected attribute 'sec_struct' does not exist on the mesh.")
# ---
# name: test_attribute[1BNA-bcif].13
[[1.0 0.1 0.1 0.0]
Expand Down Expand Up @@ -1200,7 +1200,7 @@
62 70 64 71]
# ---
# name: test_attribute[1BNA-cif].12
AttributeError("The selected attribute 'sec_struct' does not exist on the mesh.")
NamedAttributeError("The selected attribute 'sec_struct' does not exist on the mesh.")
# ---
# name: test_attribute[1BNA-cif].13
[[1.0 0.1 0.1 0.0]
Expand Down Expand Up @@ -3501,7 +3501,7 @@
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
# ---
# name: test_attribute[1BNA-pdb].9
AttributeError("The selected attribute 'entity_id' does not exist on the mesh.")
NamedAttributeError("The selected attribute 'entity_id' does not exist on the mesh.")
# ---
# name: test_attribute[4ozs-bcif]
[ 43.9 55.8 58.0 64.3 63.1 59.2 64.7 76.6 59.6 60.8 53.5 53.0
Expand Down Expand Up @@ -8133,7 +8133,7 @@
0]
# ---
# name: test_attribute[4ozs-pdb].9
AttributeError("The selected attribute 'entity_id' does not exist on the mesh.")
NamedAttributeError("The selected attribute 'entity_id' does not exist on the mesh.")
# ---
# name: test_attribute[8H1B-bcif]
[40.0 36.8 34.6 33.8 36.2 35.6 37.1 35.8 32.8 31.1 28.8 28.3 32.6 34.6
Expand Down Expand Up @@ -12729,7 +12729,7 @@
0]
# ---
# name: test_attribute[8H1B-pdb].9
AttributeError("The selected attribute 'entity_id' does not exist on the mesh.")
NamedAttributeError("The selected attribute 'entity_id' does not exist on the mesh.")
# ---
# name: test_attribute[8U8W-bcif]
[ 87.8 94.3 88.8 81.5 85.2 101.7 92.6 92.7 94.1 94.9 75.5 63.1
Expand Down Expand Up @@ -17361,5 +17361,5 @@
0]
# ---
# name: test_attribute[8U8W-pdb].9
AttributeError("The selected attribute 'entity_id' does not exist on the mesh.")
NamedAttributeError("The selected attribute 'entity_id' does not exist on the mesh.")
# ---
12 changes: 6 additions & 6 deletions tests/__snapshots__/test_load.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
62 70 64 71]
# ---
# name: test_style_1[False-1BNA-ball_and_stick].12
AttributeError("The selected attribute 'sec_struct' does not exist on the mesh.")
NamedAttributeError("The selected attribute 'sec_struct' does not exist on the mesh.")
# ---
# name: test_style_1[False-1BNA-ball_and_stick].13
[[1.0 0.1 0.1 0.0]
Expand Down Expand Up @@ -1443,7 +1443,7 @@
55 55 55 55]
# ---
# name: test_style_1[False-1BNA-cartoon].12
AttributeError("The selected attribute 'sec_struct' does not exist on the mesh.")
NamedAttributeError("The selected attribute 'sec_struct' does not exist on the mesh.")
# ---
# name: test_style_1[False-1BNA-cartoon].13
[[0.4 0.4 0.8 1.0]
Expand Down Expand Up @@ -1646,7 +1646,7 @@
62 70 64 71]
# ---
# name: test_style_1[False-1BNA-preset_1].12
AttributeError("The selected attribute 'sec_struct' does not exist on the mesh.")
NamedAttributeError("The selected attribute 'sec_struct' does not exist on the mesh.")
# ---
# name: test_style_1[False-1BNA-preset_1].13
[[1.0 0.1 0.1 0.0]
Expand Down Expand Up @@ -2814,7 +2814,7 @@
62 70 64 71]
# ---
# name: test_style_1[False-1BNA-ribbon].12
AttributeError("The selected attribute 'sec_struct' does not exist on the mesh.")
NamedAttributeError("The selected attribute 'sec_struct' does not exist on the mesh.")
# ---
# name: test_style_1[False-1BNA-ribbon].13
[[1.0 0.1 0.1 0.0]
Expand Down Expand Up @@ -3982,7 +3982,7 @@
62 70 64 71]
# ---
# name: test_style_1[False-1BNA-spheres].12
AttributeError("The selected attribute 'sec_struct' does not exist on the mesh.")
NamedAttributeError("The selected attribute 'sec_struct' does not exist on the mesh.")
# ---
# name: test_style_1[False-1BNA-spheres].13
[[1.0 0.1 0.1 0.0]
Expand Down Expand Up @@ -5150,7 +5150,7 @@
62 70 64 71]
# ---
# name: test_style_1[False-1BNA-surface].12
AttributeError("The selected attribute 'sec_struct' does not exist on the mesh.")
NamedAttributeError("The selected attribute 'sec_struct' does not exist on the mesh.")
# ---
# name: test_style_1[False-1BNA-surface].13
[[1.0 0.1 0.1 0.0]
Expand Down
16 changes: 8 additions & 8 deletions tests/__snapshots__/test_nodes.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -24028,7 +24028,7 @@
# ---
# name: test_selection_working[entity_id-8H1B]
tuple(
20538,
20658,
3,
)
# ---
Expand All @@ -24037,20 +24037,20 @@
[ 0.2 -0.0 0.3]
[ 0.1 -0.0 0.3]
...
[ 0.2 -0.2 0.2]
[ 0.2 -0.3 0.2]
[ 0.3 -0.3 0.3]]
[-0.1 0.0 0.0]
[-0.1 0.0 0.0]
[-0.1 0.0 0.0]]
# ---
# name: test_selection_working[entity_id-8H1B].2
tuple(
2600,
1880,
3,
)
# ---
# name: test_selection_working[entity_id-8H1B].3
[[ 0.1 -0.1 0.5]
[ 0.1 -0.1 0.5]
[ 0.1 -0.1 0.5]
[[ 0.0 -0.1 0.5]
[ 0.0 -0.1 0.5]
[ 0.0 -0.1 0.5]
...
[-0.3 -0.2 -0.1]
[-0.2 -0.2 -0.1]
Expand Down
6 changes: 5 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ def run_around_tests():
print(f"{list(bpy.data.objects)=}")

yield

print(f"Post Test setup:")
print(f"{bpy.app.handlers.frame_change_pre=}")
print(f"{mn.session.get_session().entities.keys()=}")
print(f"{list(bpy.data.objects)=}")
print(f"{list(o.uuid for o in bpy.data.objects)=}")
bpy.ops.wm.read_homefile(app_template="")
mn.session.get_session().clear()
# Code that will run after your test, for example:
Expand Down
Binary file removed tests/data/starfile/montage.tiff
Binary file not shown.
Loading

0 comments on commit c036948

Please sign in to comment.