Skip to content

Commit

Permalink
tweak and add running of tests (which currently fail)
Browse files Browse the repository at this point in the history
Update test-addon.yml

Update test-addon.yml

Update test-addon.yml

Update test-addon.yml

Update test-addon.yml

Update test-addon.yml

Update test-addon.yml

Update test-addon.yml

update

update download

update and add testing
  • Loading branch information
BradyAJohnston committed Jun 7, 2024
1 parent 99be925 commit 4f44ea7
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 147 deletions.
64 changes: 20 additions & 44 deletions .github/workflows/test-addon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Test in Blender

on:
push:
branches: ["main"]
branches: ["main", "4.2", "extensions-platform"]
pull_request:
branches: ["main", "4.1"]
branches: ["main", "4.2", "extensions-platform"]

jobs:
build:
Expand All @@ -13,57 +13,33 @@ jobs:
max-parallel: 4
fail-fast: false
matrix:
blender-version: ["4.1"]
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
# os: [macos-13]
blender-version: ["4.2"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11.7

- name: Test in Blender MacOS Intel
if: matrix.os == 'macos-13'
run: |
curl -L -o blender.dmg https://download.blender.org/release/Blender4.1/blender-4.1.0-macos-x64.dmg
hdiutil attach blender.dmg
cp -R /Volumes/Blender/Blender.app /Applications/
hdiutil detach /Volumes/Blender
/Applications/Blender.app/Contents/MacOS/Blender --version
/Applications/Blender.app/Contents/MacOS/Blender -b --python tests/install.py
/Applications/Blender.app/Contents/MacOS/Blender -b --python tests/run.py -- -v
- name: Test in Blender MacOS ARM
if: matrix.os == 'macos-14'
run: |
curl -L -o blender.dmg https://download.blender.org/release/Blender4.1/blender-4.1.0-macos-arm64.dmg
hdiutil attach blender.dmg
cp -R /Volumes/Blender/Blender.app /Applications/
hdiutil detach /Volumes/Blender
/Applications/Blender.app/Contents/MacOS/Blender --version
/Applications/Blender.app/Contents/MacOS/Blender -b --python tests/install.py
/Applications/Blender.app/Contents/MacOS/Blender -b --python tests/run.py -- -v
- name: Test in Blender Windows
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://download.blender.org/release/Blender4.1/blender-4.1.0-windows-x64.zip" -OutFile "blender.zip"
Expand-Archive -Path "blender.zip" -DestinationPath "blender"
.\blender\blender-4.1.0-windows-x64\blender.exe --version
.\blender\blender-4.1.0-windows-x64\blender.exe -b --python tests/install.py
.\blender\blender-4.1.0-windows-x64\blender.exe -b --python tests/run.py -- -v tests/
- name: Cache Blender
uses: actions/cache@v2
with:
path: ~/blender.tar.xz
key: ${{ runner.os }}-blender-${{ hashFiles('**/test-addon.yml') }}

- name: Test in Blender Linux
if: matrix.os == 'ubuntu-latest'
run: |
wget -nv https://download.blender.org/release/Blender4.1/blender-4.1.0-linux-x64.tar.xz
tar -xf blender-4.1.0-linux-x64.tar.xz
blender-4.1.0-linux-x64/blender --version
blender-4.1.0-linux-x64/blender -b --python tests/install.py
blender-4.1.0-linux-x64/blender -b --python tests/run.py -- -v tests/ --cov=molecularnodes --cov-report=xml:coverage.xml --ignore=molecularnodes/ui/panel.py
if [[ ! -f ./blender.tar.xz ]]; then
wget -nv https://cdn.builder.blender.org/download/daily/blender-4.2.0-beta+v42.7886ce7bd47a-linux.x86_64-release.tar.xz -O ./blender.tar.xz
fi
mkdir -p ./blender
ls -lrta
tar -xf ./blender.tar.xz -C ./blender --strip-components=1
ls -lrta
blender/blender --version
blender/blender -b --python tests/install.py
blender/blender -b --python tests/run.py -- -v tests/ --cov=molecularnodes --cov-report=xml:coverage.xml --ignore=molecularnodes/ui/panel.py
- name: Expose coverage as a CI download
uses: actions/upload-artifact@v1
if: matrix.os == 'ubuntu-latest'
Expand Down
95 changes: 60 additions & 35 deletions build.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import os
from typing import List
import sys
import zipfile
import shutil
import os
import subprocess
import glob
import tomlkit
# download the required .whl files for all platforms

packages = [
'mrcfile==1.4.3',
'starfile==0.5.6',
'MDAnalysis==2.7.0',
'biotite==0.40.0'
required_packages = [
"mrcfile==1.4.3",
"starfile==0.5.6",
"scipy",
"MDAnalysis==2.6.0",
"biotite==0.40.0",
]
platforms = [
"macosx_11_0_arm64",
"manylinux2014_28_x86_64",
"win_amd64",
# "macosx_10_9_x86_64"
supported_platforms = [
"macosx_12_0_arm64",
# "manylinux2014_28_x86_64",
# "win_amd64",
# "macosx_10_9_x86_64",
]


Expand All @@ -26,61 +29,83 @@ def run_python(args: str):
subprocess.run([python] + args.split(" "))


def download_whls(python_version='3.11'):
for package in packages:
for platform in platforms:
run_python(
f"-m pip download {package} --dest ./molecularnodes/wheels --only-binary=:all: --python-version={python_version} --platform={platform}"
)
def download_whls(
python_version="3.11", packages=required_packages, platforms=supported_platforms
):
for platform in platforms:
run_python(
f"-m pip download {' '.join(packages)} --dest ./molecularnodes/wheels --only-binary=:all: --python-version={python_version} --platform={platform}"
)


toml_path = "molecularnodes/blender_manifest.toml"


def update_toml_whls():

# List all .whl files in the wheels/ subdirectory
wheel_files = glob.glob('molecularnodes/wheels/*.whl')
wheel_files = glob.glob("molecularnodes/wheels/*.whl")

# Load the TOML file
with open(toml_path, 'r') as file:
with open(toml_path, "r") as file:
manifest = tomlkit.parse(file.read())

# Update the wheels list
manifest['wheels'] = wheel_files
manifest_str = tomlkit.dumps(manifest).replace(
'["', '[\n\t"').replace('", "', '",\n\t"').replace('"]', '",\n]').replace("molecularnodes/", "./").replace("\\\\", "/")
manifest["wheels"] = wheel_files
manifest_str = (
tomlkit.dumps(manifest)
.replace('["', '[\n\t"')
.replace('", "', '",\n\t"')
.replace('"]', '",\n]')
.replace("molecularnodes/", "./")
.replace("\\\\", "/")
)

# Write the updated TOML file
with open(toml_path, 'w') as file:
with open(toml_path, "w") as file:
file.write(manifest_str)


def zip_extension():
def zip_extension(platform: str | None = None) -> None:
# Load the TOML file
with open(toml_path, 'r') as file:
with open(toml_path, "r") as file:
manifest = tomlkit.parse(file.read())

# Get the version number
version = manifest['version']
version = manifest["version"]

# Define the zip file name
zip_file_name = f'molecularnodes_{version}.zip'
if platform:
# Define the zip file name
zip_file_name = f"molecularnodes_{version}_{platform}.zip"
else:
zip_file_name = f"molecularnodes_{version}.zip"

# Create the zip file
with zipfile.ZipFile(zip_file_name, 'w', zipfile.ZIP_DEFLATED) as zip_file:
with zipfile.ZipFile(zip_file_name, "w", zipfile.ZIP_DEFLATED) as zip_file:
# Walk the molecularnodes folder
for root, dirs, files in os.walk('molecularnodes'):
for root, dirs, files in os.walk("molecularnodes"):
for file in files:
# Get the file path
file_path = os.path.join(root, file)

# Add the file to the zip file
zip_file.write(file_path, arcname=os.path.relpath(
file_path, 'molecularnodes'))
zip_file.write(
file_path, arcname=os.path.relpath(file_path, "molecularnodes")
)


if __name__ == "__main__":
download_whls()
def remove_whls():
dir_path = ".molecularnodes/wheels"
if os.path.exists(dir_path):
shutil.rmtree(dir_path)


def build(platform: str | None = None) -> None:
download_whls(platforms=[platform])
update_toml_whls()
zip_extension()
zip_extension(platform=platform)
remove_whls()


if __name__ == "__main__":
for platform in supported_platforms:
build(platform)
120 changes: 52 additions & 68 deletions molecularnodes/blender_manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,78 +4,62 @@ schema_version = "1.0.0"
# Change the values according to your extension
id = "molecularnodes"
version = "4.2.0"
name = "molecularnodes"
tagline = "Import and animation of molecular data"
maintainer = "Brady Johnston <brady.johnston@me.com>"
name = "Molecular Nodes"
tagline = "A toolbox for molecular import and animation in Blender"
maintainer = "Brady Johnston<brady.johnston@me.com>"
type = "add-on"

# Optional: add-ons can list which resources they will require:
# * "files" (for access of any filesystem operations)
# * "network" (for internet access)
# * "clipboard" (to read and/or write the system clipboard)
# * "camera" (to capture photos and videos)
# * "microphone" (to capture audio)
permissions = ["files", "network"]

# Optional link to documentation, support, source files, etc
website = "https://bradyajohnston.github.io/MolecularNodes"

# Optional list defined by Blender and server, see:
# https://docs.blender.org/manual/en/dev/extensions/tags.html
tags = ["Node", "Animation"]

tags = [
"Geometry Nodes",
"Import-Export"
]
blender_version_min = "4.2.0"
# Optional: maximum supported Blender version
# blender_version_max = "5.1.0"
license = [
"SPDX:MIT"
]
copyright =[
"2022-2024 Brady Johnston",
]

# License conforming to https://spdx.org/licenses/ (use "SPDX: prefix)
# https://docs.blender.org/manual/en/dev/extensions/licenses.html
license = ["SPDX:GPL-2.0-or-later"]
# Optional: required by some licenses.
copyright = ["2022 - 2024 Brady Johnston"]

wheels = [
"./wheels/pandas-2.2.2-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/mda_xdrlib-0.2.0-py3-none-any.whl",
"./wheels/fasteners-0.19-py3-none-any.whl",
"./wheels/pillow-10.3.0-cp311-cp311-win_amd64.whl",
"./wheels/urllib3-2.2.1-py3-none-any.whl",
"./wheels/python_dateutil-2.9.0.post0-py2.py3-none-any.whl",
"./wheels/starfile-0.5.6-py3-none-any.whl",
"./wheels/joblib-1.4.2-py3-none-any.whl",
"./wheels/matplotlib-3.8.4-cp311-cp311-win_amd64.whl",
"./wheels/typing_extensions-4.11.0-py3-none-any.whl",
"./wheels/numpy-1.26.4-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/contourpy-1.2.1-cp311-cp311-win_amd64.whl",
"./wheels/tqdm-4.66.4-py3-none-any.whl",
"./wheels/scipy-1.13.0-cp311-cp311-win_amd64.whl",
"./wheels/biotite-0.40.0-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/mrcfile-1.5.0-py2.py3-none-any.whl",
"./wheels/requests-2.31.0-py3-none-any.whl",
"./wheels/pytz-2024.1-py2.py3-none-any.whl",
"./wheels/pandas-2.2.2-cp311-cp311-win_amd64.whl",
"./wheels/pyparsing-3.1.2-py3-none-any.whl",
"./wheels/biotite-0.40.0-cp311-cp311-win_amd64.whl",
"./wheels/msgpack-1.0.8-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/fonttools-4.51.0-cp311-cp311-win_amd64.whl",
"./wheels/kiwisolver-1.4.5-cp311-cp311-win_amd64.whl",
"./wheels/packaging-24.0-py3-none-any.whl",
"./wheels/mmtf_python-1.1.3-py2.py3-none-any.whl",
"./wheels/threadpoolctl-3.5.0-py3-none-any.whl",
"./wheels/charset_normalizer-3.3.2-cp311-cp311-win_amd64.whl",
"./wheels/msgpack-1.0.8-cp311-cp311-win_amd64.whl",
"./wheels/MDAnalysis-2.7.0-cp311-cp311-win_amd64.whl",
"./wheels/cycler-0.12.1-py3-none-any.whl",
"./wheels/GridDataFormats-1.0.2-py3-none-any.whl",
"./wheels/pyarrow-16.1.0-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/tzdata-2024.1-py2.py3-none-any.whl",
"./wheels/idna-3.7-py3-none-any.whl",
"./wheels/six-1.16.0-py2.py3-none-any.whl",
"./wheels/mrcfile-1.4.3-py2.py3-none-any.whl",
"./wheels/certifi-2024.2.2-py3-none-any.whl",
"./wheels/networkx-3.3-py3-none-any.whl",
"./wheels/matplotlib-3.9.0-cp311-cp311-win_amd64.whl",
"./wheels/numpy-1.26.4-cp311-cp311-win_amd64.whl",
"./wheels/pyarrow-16.1.0-cp311-cp311-win_amd64.whl",
"./wheels/charset_normalizer-3.3.2-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/pandas-2.2.2-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/fonttools-4.53.0-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/fasteners-0.19-py3-none-any.whl",
"./wheels/urllib3-2.2.1-py3-none-any.whl",
"./wheels/python_dateutil-2.9.0.post0-py2.py3-none-any.whl",
"./wheels/MDAnalysis-2.6.0-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/starfile-0.5.6-py3-none-any.whl",
"./wheels/joblib-1.4.2-py3-none-any.whl",
"./wheels/typing_extensions-4.12.1-py3-none-any.whl",
"./wheels/scipy-1.13.1-cp311-cp311-macosx_12_0_arm64.whl",
"./wheels/numpy-1.26.4-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/certifi-2024.6.2-py3-none-any.whl",
"./wheels/tqdm-4.66.4-py3-none-any.whl",
"./wheels/kiwisolver-1.4.5-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/biotite-0.40.0-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/pytz-2024.1-py2.py3-none-any.whl",
"./wheels/pyparsing-3.1.2-py3-none-any.whl",
"./wheels/msgpack-1.0.8-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/requests-2.32.3-py3-none-any.whl",
"./wheels/packaging-24.0-py3-none-any.whl",
"./wheels/mmtf_python-1.1.3-py2.py3-none-any.whl",
"./wheels/threadpoolctl-3.5.0-py3-none-any.whl",
"./wheels/cycler-0.12.1-py3-none-any.whl",
"./wheels/GridDataFormats-1.0.2-py3-none-any.whl",
"./wheels/pyarrow-16.1.0-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/tzdata-2024.1-py2.py3-none-any.whl",
"./wheels/biopython-1.83-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/idna-3.7-py3-none-any.whl",
"./wheels/six-1.16.0-py2.py3-none-any.whl",
"./wheels/mrcfile-1.4.3-py2.py3-none-any.whl",
"./wheels/networkx-3.3-py3-none-any.whl",
"./wheels/matplotlib-3.9.0-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/contourpy-1.2.1-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/pillow-10.3.0-cp311-cp311-macosx_11_0_arm64.whl",
"./wheels/charset_normalizer-3.3.2-cp311-cp311-macosx_11_0_arm64.whl",
]

[permissions]
network = "Downloading structural data from the PDB and AFPDB"
files = "Importing data files from disk and caching downloads"

0 comments on commit 4f44ea7

Please sign in to comment.