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
70 changes: 0 additions & 70 deletions .github/workflows/continuous.yml

This file was deleted.

107 changes: 107 additions & 0 deletions .github/workflows/generated-contact-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Generated Contact Backend

on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened, ready_for_review, edited]
push:
branches:
- main
workflow_dispatch:
inputs:
generated_source_tolerance:
description: Numeric tolerance for generated vs source JSON metric comparison
required: false
default: "1e-5"
type: string
max_threads:
description: Max backend threads per case
required: false
default: "1"
type: string

env:
GENERATED_SOURCE_TOLERANCE: ${{ github.event.inputs.generated_source_tolerance || '1e-5' }}
MAX_THREADS: ${{ github.event.inputs.max_threads || '1' }}

jobs:
generated-contact-backend:
runs-on: ubuntu-latest
if: >-
github.event_name != 'pull_request' ||
(github.event.pull_request.draft == false &&
(github.event.action != 'edited' || github.event.changes.base != null))
concurrency:
group: forward-solver-${{ github.ref }}
cancel-in-progress: true
name: Forward solver checks (Ubuntu, Python 3.11)
timeout-minutes: 360

steps:
- uses: actions/checkout@v7
with:
submodules: recursive

- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.11"

- name: Install build and test dependencies
run: |
python -m pip install --upgrade pip
python -m pip install "setuptools>=77" wheel build cmake nanobind numpy pytest

- name: Generate packaged API
run: python tools/generate_polyfem_api.py

- name: Build source archive and wheel
# The default build creates the wheel from the unpacked source archive.
run: python -m build --no-isolation

- name: Check distribution contents
run: python tools/check_distribution.py "dist/*.tar.gz" "dist/*.whl"

- name: Install wheel in a clean environment
run: |
python -m venv "$RUNNER_TEMP/wheel-test"
"$RUNNER_TEMP/wheel-test/bin/python" -m pip install dist/*.whl
"$RUNNER_TEMP/wheel-test/bin/python" tools/check_installed_package.py \
--readme README.md --reference polyfem-data/units/neohookean.json \
--example examples/quickstart/beam.py \
--example examples/quickstart/static_elasticity.py \
--example examples/quickstart/transient_elasticity.py

- name: Install wheel for the full example sweep
run: python -m pip install --force-reinstall --no-deps dist/*.whl

- name: Upload checked distributions
uses: actions/upload-artifact@v7
with:
name: polyfempy-ubuntu-py311
retention-days: 14
path: dist/*

- name: Check compiled backend
run: python -I -m polyfempy backend-info --require

- name: Run active generated contact backend sweep
run: |
python tools/run_generated_contact_backend_checks.py \
--output-root build/generated-contact-backend-check-release-candidate \
--generated-source-tolerance "$GENERATED_SOURCE_TOLERANCE" \
--max-threads "$MAX_THREADS" \
--require-tests-match

- name: Upload generated contact backend results
if: always()
uses: actions/upload-artifact@v7
with:
name: generated-contact-backend-results
if-no-files-found: warn
retention-days: 14
path: |
build/generated-contact-backend-check-release-candidate/summary.txt
build/generated-contact-backend-check-release-candidate/summary.json
build/generated-contact-backend-check-release-candidate/logs
tools/generated_contact_expected_failures.json
164 changes: 164 additions & 0 deletions .github/workflows/release-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
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 tools/generate_polyfem_api.py
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

conda:
needs: source
runs-on: ${{ matrix.target.os }}
name: Conda / ${{ matrix.target.name }} / Python ${{ matrix.python }}
timeout-minutes: 360
strategy:
fail-fast: false
matrix:
python: ["3.11"]
target:
- { name: win-64, os: windows-2022 }
- { name: linux-64, os: ubuntu-latest }
- { name: osx-64, os: macos-15-intel }
- { name: osx-arm64, os: macos-15 }
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v7
- uses: actions/download-artifact@v8
with:
name: polyfempy-source
path: dist
- uses: conda-incubator/setup-miniconda@v4
with:
miniforge-version: latest
activate-environment: package-build
python-version: "3.13"
channels: conda-forge
conda-remove-defaults: "true"
channel-priority: strict
- name: Install conda build tools
run: conda install --yes --override-channels --channel conda-forge conda-build
- name: Select the source archive
run: |
python - <<'PY'
import hashlib
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}")
archive = archives[0].resolve()
with open(os.environ["GITHUB_ENV"], "a", encoding="utf-8") as output:
output.write(f"POLYFEMPY_SDIST_URL={archive.as_uri()}\n")
output.write(f"POLYFEMPY_SDIST_SHA256={hashlib.sha256(archive.read_bytes()).hexdigest()}\n")
output.write(f"CPM_SOURCE_CACHE={Path(os.environ['RUNNER_TEMP']) / 'pf-cpm'}\n")
PY
- 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
"CONDA_BLD_PATH=C:/pf-cb" >> $env:GITHUB_ENV
"CPM_SOURCE_CACHE=C:/pf-cpm" >> $env:GITHUB_ENV
- name: Build and test the native conda package
run: >-
conda-build conda/recipe --python "${{ matrix.python }}"
--no-anaconda-upload --override-channels --channel conda-forge
--output-folder conda-out
- uses: actions/upload-artifact@v7
with:
name: conda-${{ matrix.target.name }}-py${{ matrix.python }}
path: |
conda-out/**/*.conda
conda-out/**/*.tar.bz2
if-no-files-found: error
Loading