Skip to content

Unpin numpy

Unpin numpy #1004

Workflow file for this run

name: scmdata CI-CD
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
jobs:
linting-and-docs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dev dependencies
run: |
pip install --upgrade pip wheel
pip install -e .[dev]
# TODO: add `pylint src`
- name: Formatting and linters
run: |
black --check src tests setup.py docs/source/notebooks
isort --check-only --quiet src tests setup.py
pydocstyle src
bandit -c .bandit.yml -r src/scmdata
flake8 src tests setup.py
- name: Build docs
# treat warnings as errors (-W)...
# ...but not when being nitpicky (-n)
run: |
sphinx-build -M html docs/source docs/build -Evn
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: [3.8, 3.9, '3.10', 3.11]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install test dependencies
run: |
pip install --upgrade --user pip wheel
pip install -e .[tests,plotting,optional]
pip freeze
- name: Test with pytest (${{ runner.os }})
if: ${{ !startsWith(runner.os, 'Windows') }}
env:
MIN_COVERAGE: 90
run: |
pytest tests -r a --cov=scmdata --cov-report=xml --cov-fail-under=${MIN_COVERAGE}
if ! coverage report --fail-under=${MIN_COVERAGE} --show-missing
then
echo
echo "Error: Test coverage has to be at least ${MIN_COVERAGE}"
exit 1
fi
- name: Test with pytest (${{ runner.os }})
if: startsWith(runner.os, 'Windows')
env:
MIN_COVERAGE: 90
run: |
pytest tests -r a --cov=scmdata --cov-report=term-missing --cov-fail-under=$env:MIN_COVERAGE
- name: Upload coverage to Codecov
if: startsWith(runner.os, 'Linux') && matrix.python-version == 3.11
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
build-pandas-versions:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
pandas-version: [1.1]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install test dependencies
run: |
pip install --upgrade pip wheel
pip install -e .[tests,plotting,optional]
pip install pandas==${{ matrix.pandas-version }} numpy==1.20.0
- name: Test with pytest
env:
MIN_COVERAGE: 90
run: |
pytest tests -r a --cov=scmdata --cov-report=xml --cov-fail-under=${MIN_COVERAGE}
if ! coverage report --fail-under=${MIN_COVERAGE} --show-missing
then
echo
echo "Error: Test coverage has to be at least ${MIN_COVERAGE}"
exit 1
fi
build-xarray-versions:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.9 ]
xarray-version: [ 0.16.2, 0.17.0, 0.18.2 ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install test dependencies
run: |
pip install --upgrade pip wheel
pip install -e .[tests,plotting,optional]
pip install xarray==${{ matrix.xarray-version }}
- name: Test with pytest
env:
MIN_COVERAGE: 90
run: |
pytest tests -r a --cov=scmdata --cov-report=xml --cov-fail-under=${MIN_COVERAGE}
if ! coverage report --fail-under=${MIN_COVERAGE} --show-missing
then
echo
echo "Error: Test coverage has to be at least ${MIN_COVERAGE}"
exit 1
fi
build-no-plotting:
# seaborn imports scipy which can make it available without being explicit.
# This test makes sure that everything works even if the plotting
# dependencies aren't installed.
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install test dependencies
run: |
pip install --upgrade pip wheel
pip install -e .[tests,optional]
- name: Test with pytest
env:
# drop coverage as not including plotting
MIN_COVERAGE: 1
run: |
pytest tests -r a --cov=scmdata --cov-report=xml --cov-fail-under=${MIN_COVERAGE}
if ! coverage report --fail-under=${MIN_COVERAGE} --show-missing
then
echo
echo "Error: Test coverage has to be at least ${MIN_COVERAGE}"
exit 1
fi
test-notebooks:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, 3.11]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install notebook dependencies
run: |
pip install --upgrade pip wheel
pip install -e .[notebooks,docs]
- name: Check that the notebook runs without any errors
run: |
jupytext --set-formats ipynb,py:percent --execute docs/source/notebooks/*.py
test-install:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', 3.11]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: |
pip install --upgrade pip wheel
pip install .
- name: Test installation
run: |
python scripts/test_install.py
create-dist:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip wheel
pip install -e .[dev]
- name: Create package
run: |
python setup.py sdist bdist_wheel --universal
twine check dist/*
- name: Check package files
run: |
for f in README.rst LICENSE CHANGELOG.rst
do
if ! tar -tvf dist/scmdata*.tar.gz | grep "$f"
then
echo
echo "${f} not correctly packaged"
exit 1
fi
done
- uses: actions/upload-artifact@v3
if: startsWith(github.ref, 'refs/tags/v')
with:
name: dist
path: dist
deploy-pypi:
if: startsWith(github.ref, 'refs/tags/v')
needs: [linting-and-docs,build,build-pandas-versions,build-no-plotting,test-notebooks,test-install,create-dist]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
steps:
- uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}