Skip to content
Merged
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
64 changes: 0 additions & 64 deletions .github/workflows/pypi.yaml

This file was deleted.

115 changes: 115 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Create Release

on:
workflow_dispatch:
inputs:
release_notes:
description: 'Release notes'
type: string
required: false
default: ''
upload_to_pypi:
description: 'Upload the release to PyPI'
type: boolean
required: false
default: true

permissions:
actions: write
contents: write

jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.VERSION }}

steps:
- name: Checkout project
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install Poetry
uses: abatilo/actions-poetry@v4
with:
poetry-version: "1.8.5"

- name: Setup a local virtual environment
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local

- name: Define a cache for the virtual environment based on the dependencies lock file
uses: actions/cache@v4
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}

- name: Build
run: |
poetry install
poetry build

- name: Get package version to create a new tag and release
id: get-version
run: echo "VERSION=$(poetry version --short)" >> $GITHUB_OUTPUT

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: csaps-packages
path: dist/*
overwrite: true

publish:
name: Publish
needs: [ build ]
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/project/csaps
permissions:
id-token: write
env:
TAG_NAME: v${{ needs.build.outputs.version }}

steps:
- uses: actions/download-artifact@v4
with:
name: csaps-packages
path: dist

- name: Check tag ${{ TAG_NAME }}
uses: mukunku/[email protected]
id: check-tag
with:
tag: ${{ TAG_NAME }}

- name: Create tag ${{ TAG_NAME }}
if: ${{ steps.check-tag.outputs.exists == 'false' }}
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ TAG_NAME }}',
sha: context.sha
})

- name: Create release ${{ TAG_NAME }}
uses: softprops/action-gh-release@v2
with:
name: ${{ TAG_NAME }}
tag_name: ${{ TAG_NAME }}
files: dist/*
body: inputs.release_notes

- name: Upload to PyPI
if: ${{ inputs.upload_to_pypi }}
uses: pypa/gh-action-pypi-publish@release/v1
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ Use pip for installing:
pip install -U csaps
```

or Poetry:

```
poetry add csaps
```

The module depends only on NumPy and SciPy. Python 3.9 or above is supported.

## Simple Examples
Expand Down Expand Up @@ -96,9 +102,10 @@ More examples of usage and the full documentation can be found at https://csaps.
We use pytest for testing.

```
cd /path/to/csaps/project/directory
pip install -e .[tests]
pytest
git clone https://github.com/espdev/csaps.git
cd csaps
poetry install
poetry run poe test
```

## Algorithm and Implementation
Expand Down