Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2023] A few fixes, software tests, and other modernizations #10

Merged
merged 11 commits into from
Apr 9, 2023
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
56 changes: 56 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Allow job to be triggered manually.
workflow_dispatch:

# Cancel in-progress jobs when pushing to the same branch.
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}

jobs:

tests:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ]

name: Python ${{ matrix.python-version }} on OS ${{ matrix.os }}
steps:

- name: Acquire sources
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: 'pip'
cache-dependency-path: |
requirements-docs.txt
requirements-release.txt
requirements-test.txt
setup.py

- name: Run tests
run: make test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
/tmp
/dist
/doc/_build
.coverage*
coverage.xml
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ phenodata changelog

development
===========
- Fix ``nearest-station`` with ``--format=json``
- Fix filtering by ``int64``-type identifiers, see GH-7
- Fix SQL filtering with DuckDB
- Tests: Add software tests
- Improve documentation
- CI: Add GHA configuration to invoke software tests
- CI/Tests: Fix installation on Python 3.7 to 3.9
- Dependencies: Switch from ``appdirs`` to ``platformdirs``

2020-12-29 0.11.0
=================
Expand Down
56 changes: 40 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,43 +1,67 @@
# =============
# Configuration
# =============

$(eval venv := .venv)
$(eval pip := $(venv)/bin/pip)
$(eval python := $(venv)/bin/python)
$(eval pytest := $(venv)/bin/pytest)
$(eval bumpversion := $(venv)/bin/bumpversion)
$(eval twine := $(venv)/bin/twine)


# ============
# Main targets
# ============

# Run software tests.
.PHONY: test
test: install-package install-tests
$(pytest)

# Release this piece of software
# Synopsis:
# make release bump=minor (major,minor,patch)
release: bumpversion push sdist pypi-upload
release: bumpversion push build pypi-upload

# Build the documentation
docs-html: install-doctools
$(eval venvpath := ".venv_project")
touch doc/index.rst
export SPHINXBUILD="`pwd`/$(venvpath)/bin/sphinx-build"; cd doc; make html
export SPHINXBUILD="`pwd`/$(venv)/bin/sphinx-build"; cd doc; make html


# ===============
# Utility targets
# ===============
bumpversion: install-releasetools
$(eval venvpath := ".venv_project")
@$(venvpath)/bin/bumpversion $(bump)
@$(bumpversion) $(bump)

push:
git push && git push --tags

sdist:
$(eval venvpath := ".venv_project")
@$(venvpath)/bin/python setup.py sdist
build:
@$(python) -m build

pypi-upload: install-releasetools
$(eval venvpath := ".venv_project")
@$(venvpath)/bin/twine upload --skip-existing dist/*.tar.gz
@$(twine) upload --skip-existing dist/*.tar.gz


# =================
# Installer targets
# =================

install-package:
@test -e $(python) || python3 -m venv $(venv)
$(pip) install --prefer-binary --editable=.[test,develop,release,sql]

install-doctools:
$(eval venvpath := ".venv_project")
@test -e $(venvpath)/bin/python || `command -v virtualenv` --python=`command -v python` $(venvpath)
@$(venvpath)/bin/pip install --quiet --requirement requirements-docs.txt --upgrade
@test -e $(python) || python3 -m venv $(venv)
$(pip) install --requirement requirements-docs.txt --upgrade

install-releasetools:
$(eval venvpath := ".venv_project")
@test -e $(venvpath)/bin/python || `command -v virtualenv` --python=`command -v python` $(venvpath)
@$(venvpath)/bin/pip install --quiet --requirement requirements-release.txt --upgrade
@test -e $(python) || python3 -m venv $(venv)
$(pip) install --requirement requirements-release.txt --upgrade

install-tests:
@test -e $(python) || python3 -m venv $(venv)
$(pip) install --requirement requirements-tests.txt --upgrade
Loading