diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 03f4a41..1210934 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ on: jobs: Build: - if: "!contains(github.event.pull_request.labels.*.name, 'docs-only')" + if: ${{ !contains(github.event.pull_request.labels.*.name, 'docs-only') }} runs-on: ${{ matrix.os }} strategy: matrix: @@ -18,9 +18,73 @@ jobs: python: ["3.10"] steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up conda + uses: conda-incubator/setup-miniconda@v3 + with: + python-version: ${{ matrix.python }} + channels: conda-forge + activate-environment: "compas_123-dev" + + - name: Configure conda channels + shell: bash -el {0} + run: | + conda config --add channels defaults + conda config --set channel_priority strict + - uses: compas-dev/compas-actions.build@v4 with: invoke_lint: true use_conda: true check_import: true python: ${{ matrix.python }} + + build_wheels: + name: cibuildwheel on ${{ matrix.platform }} + needs: [Build] # Only run if Build job succeeds + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + platform: manylinux + - os: macos-latest + platform: mac + - os: windows-latest + platform: windows + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install cibuildwheel + run: pipx install cibuildwheel==2.23.1 + + - name: Build wheels + run: cibuildwheel --output-dir wheelhouse . + + - uses: actions/upload-artifact@v4 + with: + name: wheels-${{ matrix.platform }} + path: wheelhouse/*.whl + + build_sdist: + name: Test source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Build SDist + run: pipx run build --sdist + + - uses: actions/upload-artifact@v4 + with: + name: sdist + path: dist/*.tar.gz \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index bfeda85..3aa6c65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- GA for cibuildwheel, bring back the tessagon test. + ### Removed diff --git a/pyproject.toml b/pyproject.toml index 0dda225..2f33945 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,7 +75,7 @@ CMAKE_POLICY_DEFAULT_CMP0135 = "NEW" [tool.cibuildwheel] build-verbosity = 3 -test-requires = ["numpy", "compas", "pytest", "build"] +test-requires = ["numpy", "compas", "pytest", "build", "tessagon"] test-command = "pip install numpy compas && pip list && pytest {project}/tests" build-frontend = "pip" manylinux-x86_64-image = "manylinux2014" diff --git a/tests/test_mapping.py b/tests/test_mapping.py index abc6eff..51dc612 100644 --- a/tests/test_mapping.py +++ b/tests/test_mapping.py @@ -1,52 +1,52 @@ -# import compas -# from compas_libigl.mapping import map_mesh -# from compas.datastructures import Mesh - - -# def test_map_mesh(): -# # Create target mesh (using a mesh we know exists) -# mesh = Mesh.from_off(compas.get("tubemesh.off")) -# mesh.quads_to_triangles() # Ensure we have a triangle mesh -# v, f = mesh.to_vertices_and_faces() - -# # Create simple pattern mesh manually (grid pattern) -# # Use a smaller UV range to ensure pattern falls within target's parameterization -# u_num, v_num = 5, 5 -# # Use a smaller central region of the UV space -# u_range = [0.2, 0.8] # Avoid edges of UV space -# v_range = [0.2, 0.8] # Avoid edges of UV space - -# # Generate grid vertices -# pv = [] -# for j in range(v_num + 1): -# v_param = v_range[0] + j * (v_range[1] - v_range[0]) / v_num -# for i in range(u_num + 1): -# u_param = u_range[0] + i * (u_range[1] - u_range[0]) / u_num -# pv.append([u_param, v_param, 0]) - -# # Create faces (triangulated quads) -# pf = [] -# for j in range(v_num): -# for i in range(u_num): -# # Calculate vertex indices for this quad -# v0 = j * (u_num + 1) + i -# v1 = j * (u_num + 1) + i + 1 -# v2 = (j + 1) * (u_num + 1) + i + 1 -# v3 = (j + 1) * (u_num + 1) + i - -# # Split quad into two triangles -# pf.append([v0, v1, v2]) -# pf.append([v0, v2, v3]) - -# # Map pattern onto target mesh -# mv, mf, mn, mb, mg = map_mesh((v, f), (pv, pf)) -# mesh_mapped = Mesh.from_vertices_and_faces(mv, mf) - -# # Verify the result is a valid mesh -# assert mesh_mapped is not None -# assert mesh_mapped.number_of_vertices() > 0 -# assert mesh_mapped.number_of_faces() > 0 -# assert isinstance(mesh_mapped, Mesh) - -# # Check that at least some faces were mapped -# assert mesh_mapped.number_of_faces() > 0 +import compas +from compas_libigl.mapping import map_mesh +from compas.datastructures import Mesh + + +def test_map_mesh(): + # Create target mesh (using a mesh we know exists) + mesh = Mesh.from_off(compas.get("tubemesh.off")) + mesh.quads_to_triangles() # Ensure we have a triangle mesh + v, f = mesh.to_vertices_and_faces() + + # Create simple pattern mesh manually (grid pattern) + # Use a smaller UV range to ensure pattern falls within target's parameterization + u_num, v_num = 5, 5 + # Use a smaller central region of the UV space + u_range = [0.2, 0.8] # Avoid edges of UV space + v_range = [0.2, 0.8] # Avoid edges of UV space + + # Generate grid vertices + pv = [] + for j in range(v_num + 1): + v_param = v_range[0] + j * (v_range[1] - v_range[0]) / v_num + for i in range(u_num + 1): + u_param = u_range[0] + i * (u_range[1] - u_range[0]) / u_num + pv.append([u_param, v_param, 0]) + + # Create faces (triangulated quads) + pf = [] + for j in range(v_num): + for i in range(u_num): + # Calculate vertex indices for this quad + v0 = j * (u_num + 1) + i + v1 = j * (u_num + 1) + i + 1 + v2 = (j + 1) * (u_num + 1) + i + 1 + v3 = (j + 1) * (u_num + 1) + i + + # Split quad into two triangles + pf.append([v0, v1, v2]) + pf.append([v0, v2, v3]) + + # Map pattern onto target mesh + mv, mf, mn, mb, mg = map_mesh((v, f), (pv, pf)) + mesh_mapped = Mesh.from_vertices_and_faces(mv, mf) + + # Verify the result is a valid mesh + assert mesh_mapped is not None + assert mesh_mapped.number_of_vertices() > 0 + assert mesh_mapped.number_of_faces() > 0 + assert isinstance(mesh_mapped, Mesh) + + # Check that at least some faces were mapped + assert mesh_mapped.number_of_faces() > 0