diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml new file mode 100644 index 0000000..ab49c2e --- /dev/null +++ b/.github/workflows/build_and_publish.yml @@ -0,0 +1,23 @@ +name: Build package + +on: + release: + types: [published] + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install pypa/build + run: python -m pip install build --user + - name: Build binary wheel and source tarball + run: python -m build --sdist --wheel --outdir dist/ + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/quality_checks.yml b/.github/workflows/quality_checks.yml new file mode 100644 index 0000000..7b89a2e --- /dev/null +++ b/.github/workflows/quality_checks.yml @@ -0,0 +1,49 @@ +name: Run tests and other quality checks + +on: [pull_request] + +jobs: + run_tests: + runs-on: ubuntu-latest + strategy: + matrix: + python-versions: [3.9] + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies and the package + run: | + python -m pip install --upgrade pip + pip install .[test] + - name: Run unit tests + run: pytest --cov=omnisolver --cov-report=xml + - name: Report coverage + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos + fail_ci_if_error: true + + run_quality_cheks: + runs-on: ubuntu-latest + steps: + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - uses: actions/checkout@v2 + - name: Run quality checks + uses: ricardochaves/python-lint@v1.4.0 + with: + python-root-list: "omnisolver" + use-pylint: false + use-pycodestyle: false + use-flake8: true + use-mypy: true + use-black: true + use-isort: true + extra-flake8-options: --max-line-length=100 + extra-mypy-options: --ignore-missing-imports --namespace-packages + extra-isort-options: --check-only --profile black diff --git a/pyproject.toml b/pyproject.toml index d266d42..44c93b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,5 @@ [tool.black] line-length = 100 -target-version = ['py36', 'py37', 'py38', 'py39'] include = '\.pyi?$' exclude = ''' /( diff --git a/setup.cfg b/setup.cfg index eccab06..457c13f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,7 @@ classifiers = [options] packages = find_namespace: -python_requires = >= 3.9 +python_requires = >= 3.7 install_requires = dimod >= 0.9.10 numpy >= 1.19.4 @@ -25,7 +25,7 @@ install_requires = pandas >= 1.1.4 [options.extras_require] -test = pytest>=6.1.2; pytest-mock>=3.3.1 +test = pytest>=6.1.2; pytest-mock>=3.3.1; pytest-cov>=2.12.1 [options.entry_points] console_scripts = @@ -35,3 +35,6 @@ omnisolver = [options.packages.find] exclude = tests + +[coverage:run] +relative_files = True