Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
cmake/* linguist-vendored
*.msh -whitespace
80 changes: 26 additions & 54 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,42 @@
name: Build
name: CI

on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Build:
name: ${{ matrix.name }} Python ${{ matrix.python-version }} (${{ matrix.config }})
test:
name: ${{ matrix.os }} (${{ matrix.python }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version: [3.7, 3.8]
config: [Debug, Release]
include:
- os: ubuntu-latest
name: Linux
- os: windows-latest
name: Windows
- os: macOS-latest
name: MacOS
env:
if: runner.os == 'Windows'
USE_CHOLMOD: 0
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.10", 3.11, 3.12]
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v7
with:
fetch-depth: 10
submodules: recursive

- name: Setup NMake (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: Stetup Conda
uses: s-weigand/setup-conda@v1
- name: Set up Python
uses: actions/setup-python@v7
with:
update-conda: true
python-version: ${{ matrix.python-version }}
conda-channels: anaconda, conda-forge

- name: Install Dependencies
run: |
conda install numpy libblas libcblas suitesparse plotly -y
python-version: ${{ matrix.python }}

- name: Envs (Windows)
if: runner.os == 'Windows'
run: |
echo "CMAKE_GENERATOR=NMake Makefiles" >> $GITHUB_ENV
echo "CXX=cl.exe" >> $GITHUB_ENV
echo "CC=cl.exe" >> $GITHUB_ENV
echo "USE_CHOLMOD=0" >> $GITHUB_ENV
conda init powershell
- name: Install package
run: python -m pip install ".[dev]"

- name: Build (Debug)
if: matrix.config == 'Debug'
run: |
python setup.py build --debug install
- name: Run ruff
run: python -m ruff check python tools tests

# windows has problem with memory and 2 passes...
- name: Build (Release)
if: matrix.config == 'Release' && runner.os != 'Windows'
run: |
python setup.py build install
- name: Run pytest
run: python -m pytest tests -q

# macos segfaults???
- name: Tests
if: matrix.name == 'Linux' || matrix.name == 'MacOS' || (matrix.config == 'Debug' && runner.os == 'Windows')
run: |
python test/test_bending.py
- name: Check installed package
run: python tools/check_installed_package.py
93 changes: 93 additions & 0 deletions .github/workflows/release-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Release Packages

on:
workflow_dispatch:

concurrency:
group: release-packages-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
source:
runs-on: ubuntu-latest
outputs:
filename: ${{ steps.archive.outputs.filename }}
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- uses: actions/setup-python@v7
with:
python-version: "3.13"
- name: Prepare source archive
run: |
python -m pip install build numpy
python -m build --sdist
python tools/check_distribution.py "dist/*.tar.gz"
- name: Locate source archive
id: archive
shell: python
run: |
import os
from pathlib import Path
archives = list(Path("dist").glob("*.tar.gz"))
if len(archives) != 1:
raise RuntimeError(f"Expected one source archive, found {archives}")
with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as output:
output.write(f"filename={archives[0].name}\n")
- uses: actions/upload-artifact@v7
with:
name: polyfempy-source
path: dist/*.tar.gz
if-no-files-found: error

wheels:
needs: source
runs-on: ${{ matrix.target.os }}
name: Wheel / ${{ matrix.target.name }} / CPython ${{ matrix.python }}
timeout-minutes: 360
strategy:
fail-fast: false
matrix:
python: ["311"]
target:
- { name: windows-x64, os: windows-2022, arch: AMD64 }
- { name: linux-x64, os: ubuntu-latest, arch: x86_64 }
- { name: macos-intel, os: macos-15-intel, arch: x86_64 }
- { name: macos-arm64, os: macos-15, arch: arm64 }
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.13"
- uses: actions/download-artifact@v8
with:
name: polyfempy-source
path: dist
- name: Use short Windows build paths
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force C:/pf-tmp | Out-Null
"TEMP=C:/pf-tmp" >> $env:GITHUB_ENV
"TMP=C:/pf-tmp" >> $env:GITHUB_ENV
"CPM_SOURCE_CACHE=C:/pf-cpm" >> $env:GITHUB_ENV
- name: Build and test installed wheels
uses: pypa/cibuildwheel@v4.3.5
with:
package-dir: dist/${{ needs.source.outputs.filename }}
config-file: cibuildwheel.toml
output-dir: wheelhouse
env:
CIBW_BUILD: cp${{ matrix.python }}-*
CIBW_ARCHS: ${{ matrix.target.arch }}
- name: Check wheel contents
run: python tools/check_distribution.py "wheelhouse/*.whl"
- uses: actions/upload-artifact@v7
with:
name: wheels-${{ matrix.target.name }}-cp${{ matrix.python }}
path: wheelhouse/*.whl
if-no-files-found: error
115 changes: 103 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,113 @@
# Build directories
build/
build_debug/
build.nosync/
bin/
bin_rel/
.vscode
lib/
out/
dist/
3rdparty*
/wheelhouse/
/conda-out/
CMakeFiles/
CPM_modules/
_deps/
msvc_*/
x64/
*.dir/
Release/
Debug/

# Python
__pycache__/
*.py[cod]
*$py.class
*.so
*.egg
*.egg-info/
.eggs/
.pytest_cache/
.ruff_cache/
.venv/
.coverage
htmlcov/

# Generated Python API artifacts
/python/polyfempy/generated_api/
/python-from-jse/generated/

# Local architecture/discussion notes
/doc/
/python/polyfempy/runtime/README.md

# Local agent/build scratch
.codex
.codex_tmp/
/Class-Generation-From-Json-main/
/build_log.txt
/FORWARD_REVIEW.md

# Simulation output directories. Meshes and reference data may be tracked elsewhere.
/results/
/runs/
/outputs/
/sim.json
/impact_stats.json

# Slurm batch logs written at the repo root.
/slurm_logs/

# IDE
.vscode/*
.idea/
*.sublime-workspace
copy_lib
*.sublime-project
*.code-workspace
__pycache__
*.obj
*.pyc
*.vtu
*.pvd
*.egg-info
*.so
temp-plot.html
data*
.vs/
*.swp
*.swo
*~

# Dependencies (repo-root dirs only — avoids ignoring names like data_loader.py)
/3rdparty/
/data/
*libTracyClient.*

# Compiled binaries (Windows)
*.dll
*.pyd
*.exe
*.pdb
*.ilk
*.exp
*.lib
*.a
# Note: nanobind.dll and TracyClient.dll in python/polyfempy/ are build artifacts

# Cache
.cache/
.env
env/
venv/
ENV/

# Temporary files
*.log
*.tmp
*.bak
temp-plot.html
copy_lib
build_verbose.txt

# OS metadata
.DS_Store
Thumbs.db

# Local experiments
/experiment/
*.pvd
*.obj
*.vtu

# Former backend checkout; backend sources are now fetched by CPM.
/polyfem/
10 changes: 10 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Use the submodule commits recorded by the parent repository.
[submodule "examples"]
path = examples
url = https://github.com/polyfem/python_data.git
[submodule "polyfem-data"]
path = polyfem-data
url = https://github.com/polyfem/polyfem-data.git
[submodule "python-from-jse"]
path = python-from-jse
url = https://github.com/polyfem/python-from-jse.git
Loading
Loading