diff --git a/.github/workflows/python-pkg-cd.yml b/.github/workflows/python-pkg-cd.yml new file mode 100644 index 0000000..bf0f682 --- /dev/null +++ b/.github/workflows/python-pkg-cd.yml @@ -0,0 +1,31 @@ +name: Upload python package to PyPI + +on: + release: + types: [published] + +jobs: + deploy: + name: Build and deploy the package to TestPyPI + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: "3.9" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install --upgrade build + pip install --upgrade twine + - name: Build package + run: | + python -m build --outdir dist/ + twine check dist/* + - name: Publish package + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} + verbose: true diff --git a/.github/workflows/python-pkg-ci.yml b/.github/workflows/python-pkg-ci.yml new file mode 100644 index 0000000..7d07b21 --- /dev/null +++ b/.github/workflows/python-pkg-ci.yml @@ -0,0 +1,32 @@ +name: Install and test the package + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build-n-test: + name: Install and test the package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: "3.9" + - name: Install the package locally + run: | + python -m pip install --upgrade pip + pip install . + - name: Install dependencies for testing + run: | + pip install pytest-cov + pip install black + - name: Test with pytest + run: | + pytest --cov + - name: Check code format + run: | + black --check . diff --git a/pyproject.toml b/pyproject.toml index 86909ae..e4e9fb5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,28 @@ [build-system] requires = ["setuptools>=43", "wheel"] -build-backend = "setuptools.build_meta" \ No newline at end of file +build-backend = "setuptools.build_meta" + +[tool.pytest.ini_options] +addopts = "--doctest-modules --doctest-glob='README.rst'" + +[tool.tox] +legacy_tox_ini = """ +[tox] +envlist = py3{10,9,8,7}-pp_{l,h}, py3{6}-pp_{l,h}-ir_{l,h} +skip_missing_interpreters = true + +[testenv] +deps = + pytest + pp_l: pyparsing==2.3.0 + pp_h: pyparsing + ir_l: importlib-resources==1.0 + ir_h: importlib-resources +commands = pytest +""" + +[tool.coverage.run] +omit = ["tests/*", "src/pyvalem/__init__.py", "doc/*"] + +[tool.coverage.html] +directory = "htmlcov" \ No newline at end of file diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 62e9d73..0000000 --- a/pytest.ini +++ /dev/null @@ -1,2 +0,0 @@ -[pytest] -addopts = --doctest-modules --doctest-glob="README.rst" diff --git a/setup.py b/setup.py index 80dc12f..abf92ff 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ "pyparsing>=2.3", 'importlib-resources>=1.0; python_version < "3.7.0"', ], - extras_require={"dev": ["black", "coverage", "pytest", "tox", "ipython"]}, + extras_require={"dev": ["black", "pytest-cov", "tox", "ipython"]}, # package_data will include all the resolved globs into both the wheel and sdist package_data={"pyvalem": ["*.txt"]}, # no need for MANIFEST.in, which should be reserved only for build-time files diff --git a/tox.ini b/tox.ini deleted file mode 100644 index cce5e18..0000000 --- a/tox.ini +++ /dev/null @@ -1,13 +0,0 @@ -[tox] -envlist = py3{10,9,8,7}-pp_{l,h}, py3{6}-pp_{l,h}-ir_{l,h} -skip_missing_interpreters = true - -[testenv] -deps = - pytest - pp_l: pyparsing==2.3.0 - pp_h: pyparsing==3.0.6 - ir_l: importlib-resources==1.0 - ir_h: importlib-resources==5.4.0 -commands = - pytest \ No newline at end of file