Skip to content

Commit

Permalink
Merge pull request #180 from GazzolaLab/update-0.3.0
Browse files Browse the repository at this point in the history
Update 0.3.0
  • Loading branch information
skim0119 authored Aug 18, 2022
2 parents f5db6ce + 8b84837 commit 20be683
Show file tree
Hide file tree
Showing 127 changed files with 6,633 additions and 1,443 deletions.
3 changes: 2 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exclude_lines =
def __repr__
from
import
show_missing = true

[run]
branch = True
Expand All @@ -20,6 +20,7 @@ omit =
elastica/systems/analytical.py
# omit deprecation warning message
elastica/_elastica_numpy.py
elastica/_elastica_numba.py
# omit experimental modules
elastica/experimental/*
setup.py
41 changes: 41 additions & 0 deletions .github/workflows/ci-sphinx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI-sphinx

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
pull_request:
branches:
- 'main'
- 'update-*'
- 'doc_patch'
push:
branches: [ 'main', 'doc_patch' ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Setup Poetry
uses: Gr1N/setup-poetry@v7
with:
poetry-preview: false
- name: Export requirements file for sphinx
run: |
poetry export -E docs --without-hashes -f requirements.txt --output docs/requirements.txt
- name: Sphinx Build
# You may pin to the exact commit or the version.
# uses: ammaraskar/sphinx-action@8b4f60114d7fd1faeba1a712269168508d4750d2
uses: ammaraskar/[email protected]
with:
# The folder containing your sphinx docs.
docs-folder: docs/
# The command used to build your documentation.
build-command: make html #"-W --keep-going" # -n"
143 changes: 70 additions & 73 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,110 +1,107 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push request
# events for the master branch, and pull request events for all branches.
on:
push:
branches: [ master ]
pull_request:
branches: [ '**' ]
# Controls when the action will run.
on: [push, pull_request]
# Older settings:
# Triggers the workflow on push request events for the master branch,
# and pull request events for all branches.
#on:
# push:
# branches: [ master ]
# pull_request:
# branches: [ '**' ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }} #ubuntu-latest

runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
os: [ubuntu-latest, macos-latest] #, windows-latest] # Run macos tests if really required, since they charge 10 times more for macos
python-version: [3.6, 3.7, 3.8]

include:
- os: ubuntu-latest
path: ~/.cache/pip
- os: macos-latest
path: ~/Library/Caches/pip
# - os: windows-latest
# path: ~\AppData\Local\pip\Cache
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Ref: https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v2.2.2
with:
python-version: ${{ matrix.python-version }}

# You can test your matrix by printing the current Python version
- name: Display Python version
run: python -c "import sys; print(sys.version)"

# Cache the pip requirmenets for other tests. If requirements cached use them to speed up the build.
# Ref: https://github.com/actions/cache/blob/main/examples.md#python---pip
- name: Cache pip Linux
uses: actions/cache@v2
if: startsWith(runner.os, 'Linux')
# Install Poetry and dependencies
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Set up cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache pip MacOS
uses: actions/cache@v2
if: startsWith(runner.os, 'macOS')
with:
path: ~/Library/Caches/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache pip Windows
uses: actions/cache@v2
if: startsWith(runner.os, 'Windows')
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
echo update pip
python -m pip install --upgrade pip
echo update requirments
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
echo update test requirements
if [ -f tests/requirements.txt ]; then pip install -r tests/requirements.txt; fi
poetry config virtualenvs.in-project true
poetry install
# Runs a single command using the runners shell
- name: Welcome message
run: echo Hello, world! Welcome PyElastica Build, lets start testing!

# Formatting test with black and flake8
- name: Black and Flake8 formatting tests
# Run style checks (black and flake8)
- name: Run style checks
run: |
if [[ "${{ matrix.python-version }}" == "3.6" ]]; then
black --version
black --check elastica tests
flake8 --version
flake8 elastica tests
fi
# Set environment variables for coverage test. Coverage test is done using python 3.6
# For the coverage test we disable numba jit compilation, since it prevents generating coverage data.
- name: Set environment variables for coverage test
make check-codestyle
# Test PyElastica using pytest
- name: Run tests
run: |
if [[ "${{ matrix.python-version }}" == "3.6" ]]; then
echo "NUMBA_DISABLE_JIT=1" >> $GITHUB_ENV
fi
# Test Pyelastica using pytest
make test
report-coverage: # Report coverage from python 3.8 and mac-os. May change later
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.8"]
os: [macos-latest]
include:
- os: macos-latest
path: ~/Library/Caches/pip
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Set up cache
uses: actions/cache@v3
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
poetry config virtualenvs.in-project true
poetry install
- name: Run style checks
run: |
make check-codestyle
- name: Test PyElastica using pytest
if: startsWith(runner.os, 'macOS')
run: |
if [[ "${{ matrix.python-version }}" == "3.6" ]]; then
python3 -m pytest --cov=elastica --cov-report=xml
codecov
else
python3 -m pytest
fi
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
make test_coverage_xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
7 changes: 4 additions & 3 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ jobs:
uses: actions/[email protected]
with:
python-version: "3.x"
- name: Install Poetry
uses: snok/[email protected]
- name: Build
run: |
python setup.py sdist
ls dist
poetry build
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
password: ${{ secrets.PYPI_API_TOKEN }}
File renamed without changes.
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
default_language_version:
python: python3

default_stages: [commit, push]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
hooks:
- id: trailing-whitespace
- id: check-json
- id: check-yaml
- id: end-of-file-fixer
exclude: LICENSE

- repo: local
hooks:
- id: formatting
name: formatting
entry: make formatting
types: [python]
language: system
21 changes: 21 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# .readthedocs.yaml
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
tools: {python: "3.10"}
jobs:
pre_create_environment:
- asdf plugin add poetry
- asdf install poetry latest
- asdf global poetry latest
- poetry config virtualenvs.create false # Key
post_install:
- poetry install -E docs

# Build documentation in the docs/ directory with Sphinx
sphinx:
builder: html
configuration: docs/conf.py
#fail_on_warning: true
Loading

0 comments on commit 20be683

Please sign in to comment.