Skip to content

Commit

Permalink
CI + bugfixes. (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinzakka authored Jun 22, 2022
1 parent dc4b4b5 commit 24b0e7f
Show file tree
Hide file tree
Showing 5 changed files with 4,706 additions and 3 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: build

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel pytest
pip install -e .
- name: Test with pytest
run: |
pytest
10 changes: 7 additions & 3 deletions obj2mjcf/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ def from_string(lines: Sequence[str]) -> "Material":
for line in lines[1:]:
for attr in _MTL_FIELDS:
if line.startswith(attr):
attrs[attr] = " ".join(line.split(" ")[1:])
elems = line.split(" ")[1:]
elems = [elem for elem in elems if elem != ""]
attrs[attr] = " ".join(elems)
break
return Material(**attrs)

Expand Down Expand Up @@ -205,7 +207,8 @@ def decompose_convex(filename: Path, work_dir: Path, vhacd_args: VhacdArgs) -> b
# Remove the original obj file and the V-HACD output files.
for name in _VHACD_OUTPUTS + [obj_file.name]:
file_to_delete = Path(tmpdirname) / name
file_to_delete.unlink(missing_ok=True)
if file_to_delete.exists():
file_to_delete.unlink()

os.chdir(prev_dir)

Expand Down Expand Up @@ -479,7 +482,8 @@ def process_obj(filename: Path, args: Args) -> None:
except Exception as e:
cprint(f"Error compiling model: {e}", "red")
finally:
tmp_path.unlink(missing_ok=True)
if tmp_path.exists():
tmp_path.unlink()

# Dump.
if args.save_mjcf:
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"dcargs>=0.0.21",
"numpy",
"termcolor",
"lxml",
]

classifiers = [
Expand Down
Loading

0 comments on commit 24b0e7f

Please sign in to comment.