Skip to content

Commit

Permalink
Update github CI workflow
Browse files Browse the repository at this point in the history
# Update doc dependencies
# Update toolchain and github actions workflow
# Update pyproject.toml dependencies (+optional)
# Update ruff.lint configuration
# Generate pytest coverage report
  • Loading branch information
luktug-ltd committed Jan 12, 2025
1 parent 7f5ebce commit e03f8e0
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 19 deletions.
60 changes: 48 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,18 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install libspatial
- name: Install libspatial, pyclipr dependencies
run: |
sudo apt-get update -y -qq
sudo apt-get install -qq -y libglu1-mesa libspatialindex6
sudo apt-get install -qq -y libglu1-mesa libspatialindex6 build-essential libeigen3-dev
- name: Install dev dependencies
run: |
python -m pip install --upgrade pip
pip install -U -e .[docs]
- name: Build docs
run: |
cd docs
make html SPHINXOPTS="-W --keep-going"
sphinx-build --builder html . out
test-builds:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -85,20 +84,51 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.pyversion }}
- name: Install libspatial
- name: Install libspatial and pyclipr dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update -y -qq
sudo apt-get install -qq -y libglu1-mesa libspatialindex6
sudo apt-get install -qq -y libglu1-mesa libspatialindex6 build-essential libeigen3-dev
- name: Install package and dev dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install .[tests]
pip install .[support]
rm -r pyslm
- name: Unit tests
- name: Unit tests with pytest
run: |
pytest -v tests
pytest tests/
test-coverage:
name: Test Coverage
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install libspatial and pyclipr dependencies
run: |
sudo apt-get update -y -qq
sudo apt-get install -qq -y libglu1-mesa libspatialindex6 build-essential libeigen3-dev
- name: Install package and dev dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install .[tests]
pip install .[support]
rm -r pyslm
- name: Run Pytest coverage
run: |
pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=pyslm tests/ | tee pytest-coverage.txt
- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml
test-examples-build:
name: Test examples ${{ matrix.pyversion }}
runs-on: ${{ matrix.os }}
Expand All @@ -116,10 +146,10 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install libspatial
- name: Install libspatial and pyclipr dependencies
run: |
sudo apt-get update -y -qq
sudo apt-get install -qq -y libglu1-mesa libspatialindex6
sudo apt-get install -qq -y libglu1-mesa libspatialindex6 build-essential libeigen3-dev
- name: Install dev dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -139,10 +169,16 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install Hatch
uses: pypa/hatch@install
- name: Install libspatial and pyclipr dependencies
run: |
sudo apt-get update -y -qq
sudo apt-get install -qq -y libglu1-mesa libspatialindex6 build-essential libeigen3-dev
- name: Install dev dependencies
run: |
python -m pip install --upgrade pip
pip install -U flit build twine
pip install -U flit build twine hatchling
- name: Create source distribution
run: |
python -m build -n -s
Expand Down
17 changes: 16 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,25 @@ docs = [
"networkx",
"numpy",
"pyclipr",
"mapbox-earcut",
"autodocsumm",
"sphinx-autodoc-typehints",
"m2r2",
"sphinx_automodapi",
"scikit-image",
"scipy",
"shapely",
"sphinx",
"docutils==0.20",
"mock",
"sphinx-paramlinks",
"pypandoc",
"sphinx_rtd_theme",
"furo",
"triangle",
"trimesh",
"vispy",
"PyQt5"
]
easy = [
"colorlog",
Expand All @@ -68,6 +78,11 @@ easy = [
"triangle",
"trimesh",
]
tests = [
"pytest",
"pytest-cov",
"coverage-badge"
]
support = [
"mapbox-earcut",
"manifold3d",
Expand Down Expand Up @@ -119,7 +134,7 @@ testpaths = [

[tool.ruff.lint]
select = ["F", "E", "W", "N", "B", "RUF"]
exclude = ["build/", "docs/", "examples/", "tests/", "__pycache__", ".github"]
exclude = ["setup.py", "build/*", "dist/*", "docs/*", "examples/*", "tests/*", "__pycache__", ".github"]
ignore = [
"E501", # Line too long
"N802", # Function name should be lowercase
Expand Down
2 changes: 1 addition & 1 deletion pyslm/hatching/hatching.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import abc
import time
from typing import assert_never, Any, List, Optional, Tuple, Union
from typing import Any, List, Optional, Tuple, Union
import logging

import numpy as np
Expand Down
7 changes: 2 additions & 5 deletions tests/core/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ class TestBasic:
NUM_ORIGINS = 10
NUM_SCALEFACTORS = 10

def test_version(self):
assert pyslm.__version__ == '0.7.0'

def test_vector_slicing_cube(self):

# load the mesh into a pyslm Part
Expand Down Expand Up @@ -111,7 +108,7 @@ def test_vector_slicing_complex_path(self):

# slice the part
part = pyslm.Part('cube')
part.setGeometry('../../models/frameGuide.stl')
part.setGeometry('./models/frameGuide.stl')

# slice the part
polys = part.getVectorSlice(0.0, returnCoordPaths=False)
Expand Down Expand Up @@ -149,7 +146,7 @@ def test_bitmap_slicing_complex(self):

# slice the part
part = pyslm.Part('frameguide')
part.setGeometry('../../models/frameGuide.stl')
part.setGeometry('./models/frameGuide.stl')

# slice the part
polys = part.getVectorSlice(0.0, returnCoordPaths=False)
Expand Down

1 comment on commit e03f8e0

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
/opt/hostedtoolcache/Python/3.12.8/x64/lib/python3.12/site-packages/pyslm
   core.py29710764%31, 39, 46, 49, 52, 55, 61–64, 68–84, 87–95, 99–105, 109–110, 115–122, 127–128, 134–135, 140, 147–148, 153–155, 158–163, 210, 218, 237, 245, 253, 261, 271, 291, 347–348, 358–359, 370–380, 389–399, 421–426, 440–443, 450, 483, 486, 498, 506, 531, 538–560, 613, 618
   visualise.py1821820%1–400
/opt/hostedtoolcache/Python/3.12.8/x64/lib/python3.12/site-packages/pyslm/analysis
   __init__.py220%1–2
   iterator.py3113110%1–682
   utils.py1061060%1–268
/opt/hostedtoolcache/Python/3.12.8/x64/lib/python3.12/site-packages/pyslm/geometry
   geometry.py31614853%27–29, 53–65, 68–72, 80, 84, 89, 93, 100, 104, 109, 113, 121, 125, 130, 134, 139, 143, 152, 156, 163, 167, 172, 176, 184, 188, 196, 200, 208, 212, 219–228, 261–266, 269, 274, 278, 283, 287, 292, 296, 301, 305, 310, 314, 319, 323, 349–355, 358, 363, 367–370, 378, 382, 390, 394, 402, 415, 418, 421, 424, 430, 444, 450, 453, 456, 459, 475, 479, 482, 485, 488, 522–526, 531, 537, 544, 548, 555, 559, 568, 572, 575, 578, 588, 594–607, 615, 619, 626–631, 638–643, 649–654
   utils.py1199619%17, 28–39, 50–51, 67–83, 97–104, 118–120, 132–134, 156–161, 166–170, 181–211, 223–240, 254–292
/opt/hostedtoolcache/Python/3.12.8/x64/lib/python3.12/site-packages/pyslm/hatching
   hatching.py46132530%31–139, 173, 176, 188, 195, 212, 224–231, 245–257, 270–275, 292–306, 323–339, 355–391, 402, 419–424, 434–440, 451–457, 468–471, 481–486, 494, 498, 503, 507, 515, 523, 526, 534, 541, 547, 557, 599–614, 619, 623, 630, 634, 642, 646, 651, 656–661, 669, 673, 680, 684, 691, 695, 703, 707, 714, 718, 726, 730, 735, 739, 748–888, 904–908, 911, 916, 920, 925, 929, 936, 940, 955–1007, 1036–1040, 1043, 1048, 1052, 1057, 1061, 1069, 1073, 1088–1151
   islandHatcher.py22317522%30–38, 41, 47, 52–55, 62, 67–70, 75, 79, 92–106, 116–117, 127–144, 156–158, 172–176, 179, 186, 191–194, 201, 205, 213, 217, 225–232, 247–293, 304–439, 451–477
   sorting.py17412130%13, 16, 26, 34, 37, 41, 49, 52, 56–58, 67–69, 72, 76–81, 89, 92, 96–103, 111, 114, 118–120, 132–133, 141, 145, 149–163, 176–185, 188, 195, 199, 205, 209, 214, 218, 225–358
   utils.py624823%19–29, 41–52, 64–75, 80, 90–93, 105–108, 118–131, 140, 152–160
/opt/hostedtoolcache/Python/3.12.8/x64/lib/python3.12/site-packages/pyslm/support
   __init__.py550%2–6
   geometry.py3123120%4–792
   gridBlockSupport.py9619610%4–1991
   render.py96960%1–191
   support.py4474470%5–1042
   utils.py1171170%1–346
TOTAL4204355915% 

Tests Skipped Failures Errors Time
9 0 💤 2 ❌ 0 🔥 2.307s ⏱️

Please sign in to comment.