Skip to content

Promote weak form SINDy from a feature library to a sibling SINDy class. #1846

Promote weak form SINDy from a feature library to a sibling SINDy class.

Promote weak form SINDy from a feature library to a sibling SINDy class. #1846

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- uses: pre-commit/action@v3.0.1
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: build
run: pip install .
- name: test import
run: python -c "import pysindy"
docs:
name: Docs
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: "Set up Python"
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install doc dependencies
run: |
sudo apt-get update -y
sudo apt-get install pandoc
pip install -e .[docs,cvxpy,miosr,sbr]
- name: Build docs
run: |
cd docs
python -m sphinx -T -E -W -b html -d _build/doctrees . _build/html
- name: Save the built docs
uses: actions/upload-artifact@v4
with:
name: docs-html
path: docs/_build/html/
retention-days: 5
tests:
name: Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 4
matrix:
python-version: ["3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install --upgrade pip
pip install .[dev,miosr,cvxpy,sbr]
pip freeze > environment.txt
- name: Save the environment
uses: actions/upload-artifact@v4
with:
name: requirements ${{matrix.python-version}}
path: environment.txt
retention-days: 5
- name: Test with pytest
run: |
coverage run --source=pysindy -m pytest test -m "not slow" && coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
benchmarks:
name: Benchmarks (ASV)
needs: tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
permissions:
contents: write # gh-pages publishing
steps:
# checkout code
- uses: actions/checkout@v4
with:
fetch-depth: 0 # ASV history
# Get Python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Restore environment if it's cached
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
# Otherwise, restore environment
- name: Install dependencies
run: |
pip install --upgrade pip
pip install .[dev]
pip install asv
# Restore any cached ASV environments
- name: Cache ASV environments
uses: actions/cache@v4
with:
path: asv_bench/.asv/env
key: asv-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('asv_bench/asv.conf.json') }}
restore-keys: |
asv-${{ runner.os }}-py${{ matrix.python-version }}-
# Detect machine information for benchmarks
- name: Setup ASV machine
run: |
cd asv_bench
asv machine --yes
# Check regressions of any benchmarks
- name: Check regression
if: github.event_name == 'pull_request'
run: |
cd asv_bench
git fetch origin $GITHUB_BASE_REF:base $GITHUB_REF:pr
asv continuous base pr -e
# This whole second section should be a separate workflow, triggered by
# commit to main, not PRs
# Checkout gh-pages into a side folder (if it exists)
- uses: actions/checkout@v4
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
# Restore historical ASV results into workspace
- name: Restore ASV history
run: |
mkdir -p asv_bench/.asv/results
if [ -d gh-pages/.asv/results ]; then
rsync -a gh-pages/.asv/results/ asv_bench/.asv/results/
fi
# Generate website benchmark results for new commits
- name: Run benchmarks on main
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
cd asv_bench
asv run --skip-existing-successful
asv publish
# Stage site payload: html + updated results
- name: Prepare Pages payload
run: |
rm -rf pages && mkdir -p pages/.asv
rsync -a asv_bench/.asv/html/ pages/
rsync -a asv_bench/.asv/results/ pages/.asv/results/
# Deploy
- name: Deploy ASV dashboard to gh-pages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: asv_bench/.asv/html
force_orphan: false