From caf7175326f8206a551197436b2e09eeba60adbf Mon Sep 17 00:00:00 2001 From: Florian Knoop Date: Mon, 30 Sep 2024 14:44:16 +0200 Subject: [PATCH] ci | add github action for pytest * help by claude * add test dependencies --- .github/workflows/pytest.yml | 31 +++++++++++++++++++++++++++++++ README.md | 2 +- setup.cfg | 5 +++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pytest.yml diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 0000000..09f89fe --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,31 @@ +name: pytest + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.8', '3.9', '3.10', '3.11'] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install .[test] + - name: Test with pytest + run: | + pytest tests/ --doctest-modules --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov=. --cov-report=xml --cov-report=html + - name: Upload pytest results + uses: actions/upload-artifact@v3 + with: + name: pytest-results-${{ matrix.python-version }} + path: junit/test-results-${{ matrix.python-version }}.xml + if: ${{ always() }} + diff --git a/README.md b/README.md index c635ebb..84b4f3b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ tools.tdep === -![python](https://img.shields.io/badge/python-3.7--3.11-lightgrey.svg?style=flat-square) +![python](https://img.shields.io/badge/python-3.8--3.11-lightgrey.svg?style=flat-square) [![license](https://img.shields.io/github/license/flokno/tools.tdep?color=red&style=flat-square)](https://opensource.org/licenses/ISC) [![code style](https://img.shields.io/badge/code%20style-black-202020.svg?style=flat-square)](https://github.com/ambv/black) ![build status](https://app.travis-ci.com/flokno/tools.tdep.svg?branch=main) diff --git a/setup.cfg b/setup.cfg index 7386590..c873c64 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,6 +30,11 @@ install_requires = toml >= 0.10.1 spglib >= 1.0 +[options.extras_require] +tests = + pytest + pytest-cov + [options.packages.find] include = tdeptools