Add pyproject.toml (#40) #280
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python CI | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '0 0 * * 0' # weekly | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false # Allow one of the matrix builds to fail without failing others | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
# The job | |
name: Python ${{ matrix.python-version }} | |
# The steps in the job. Each step either RUNS code, or USES an action | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- name: Run tests and linting | |
run: | | |
sudo apt-get install pandoc -y | |
pip install pip jupyter matplotlib pytest black wheel setuptools twine flake8 --quiet --upgrade | |
pip install . # Install the package | |
black . --check -l 120 --exclude="_version.py" | |
flake8 streprogen --select=F811,F841,F401,E711,E712,E731 | |
pytest streprogen --doctest-modules --color=yes # Run tests | |
pytest docs/examples --verbose --doctest-modules --color=yes # Run test_notebooks.py | |
pip install -r docs/requirements.txt | |
sphinx-build docs docs/_build -v | |
# ======================= BUILD WHEELS AND UPLOAD TO PYPI ================================== | |
- name: Build package ${{ matrix.python-version }} | |
run: | | |
python -m pip install build; | |
python -m build; | |
- name: Publish Python distribution to PyPI | |
if: github.ref == 'refs/heads/master' | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
skip_existing: true | |
user: __token__ | |
password: ${{ secrets.pypi_password }} | |