#!/bin/sh

set -e

if [ "$BUILD" = "lint" ]; then
    flake8 examples src tests
    isort -c -df -rc examples src tests
    black --check --diff examples src tests
    mypy src
elif [ "$BUILD" = "sdist" ]; then
    python3 setup.py sdist
    if [ -n "$TRAVIS_TAG" ]; then
        python3 -m twine upload --skip-existing dist/*
    fi
else
    coverage run setup.py test
    curl -s https://codecov.io/bash | bash
fi
