diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a2d4952b7..39bd37e98 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,6 +6,26 @@ on: - published jobs: + release-coverage: + name: Updated ANTA release coverage badge + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Install dependencies + run: pip install genbadge[coverage] tox tox-gh-actions + - name: "Run pytest via tox for ${{ matrix.python }}" + run: tox + - name: Generate coverage badge + run: genbadge coverage -i .coverage.xml -o badge/latest-release-coverage.svg + - name: Publish coverage badge to gh-pages branch + uses: JamesIves/github-pages-deploy-action@v4 + with: + # branch: coverage-badge + folder: badge release-doc: name: "Publish documentation for release ${{github.ref_name}}" runs-on: ubuntu-latest diff --git a/docs/README.md b/docs/README.md index 8736f83be..687f30fe3 100755 --- a/docs/README.md +++ b/docs/README.md @@ -1,6 +1,7 @@ [![License](https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg)](https://github.com/arista-netdevops-community/anta/blob/main/LICENSE) [![Linting and Testing Anta](https://github.com/arista-netdevops-community/anta/actions/workflows/code-testing.yml/badge.svg)](https://github.com/arista-netdevops-community/anta/actions/workflows/code-testing.yml) [![github release](https://img.shields.io/github/release/arista-netdevops-community/anta.svg)](https://github.com/arista-netdevops-community/anta/releases/) +![coverage](https://github.com/arista-netdevops-community/anta/blob/gh-pages/latest-release-coverage.svg) # Arista Network Test Automation (ANTA) Framework diff --git a/pyproject.toml b/pyproject.toml index d4f06181b..526586db1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -210,6 +210,9 @@ ignore_errors = true [tool.coverage.html] directory = "coverage_html_report" +[tool.coverage.xml] +output = ".coverage.xml" + ################################ # Tox ################################ @@ -228,8 +231,8 @@ envlist = python = 3.8: py38 3.9: py39 - 3.10: erase, py310, report - 3.11: py311 + 3.10: py310 + 3.11: erase, py311, report [testenv] description = Run pytest with {basepython} @@ -242,8 +245,7 @@ description = Check the code style commands = black --check --diff --color . isort --check --diff --color . - flake8 --max-line-length=165 --config=/dev/null anta - flake8 --max-line-length=165 --config=/dev/null tests + flake8 --max-line-length=165 --config=/dev/null anta tests pylint anta [testenv:type] @@ -263,6 +265,7 @@ deps = coverage[toml] commands = coverage --version coverage report --rcfile=pyproject.toml + coverage xml --rcfile=pyproject.toml # add the following to make the report fail under some percentage # commands = coverage report --fail-under=80 depends = py311