From 6b25379a999c63d1c49b4a97572b54767ec1a2c2 Mon Sep 17 00:00:00 2001 From: Ole Kliemann Date: Tue, 15 Oct 2024 18:43:21 +0000 Subject: [PATCH] Add github workflow for coverage --- .github/workflows/pytest-coverage.yml | 46 +++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/pytest-coverage.yml diff --git a/.github/workflows/pytest-coverage.yml b/.github/workflows/pytest-coverage.yml new file mode 100644 index 0000000..ad60647 --- /dev/null +++ b/.github/workflows/pytest-coverage.yml @@ -0,0 +1,46 @@ +name: Pytest Coverage Report + +on: + push: + branches: [ main ] # Run on pushes to the main branch + pull_request: + branches: [ main ] # Run on pull requests to the main branch + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.12' # Specify your Python version here + + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + poetry-version: 1.8.3 # Specify the Poetry version you need + + - name: Install dependencies + run: | + poetry install + + - name: Run tests with coverage + run: | + poetry run pytest --cov=drresult # Adjust the path if necessary + + - name: Generate coverage report + run: | + poetry run coverage xml + poetry run coverage html + + - name: Upload coverage report + uses: actions/upload-artifact@v3 + with: + name: coverage-report + path: | + htmlcov + coverage.xml