diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000..7f06066c --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,40 @@ +# This workflow will install dependencies, create coverage tests and run Pytest Coverage Comment +# For more information see: https://github.com/MishaKav/pytest-coverage-comment/ +name: pytest-coverage-comment +on: + pull_request: + branches: + - '*' + +# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs +# `contents` is for permission to the contents of the repository. +# `pull-requests` is for permission to pull request +permissions: + contents: write + checks: write + pull-requests: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up PDM + uses: pdm-project/setup-pdm@v4 + + - name: Install dependencies + run: | + pdm install + + - name: Build coverage file + run: | + pdm run pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=app tests/ | tee pytest-coverage.txt + + - name: Pytest coverage comment + uses: MishaKav/pytest-coverage-comment@main + with: + pytest-coverage-path: ./pytest-coverage.txt + junitxml-path: ./pytest.xml