|
| 1 | +# |
| 2 | +# The reviewdog workflow steps use reporter: github-pr-review, |
| 3 | +# which submits mypy and pylint warnings using review comment |
| 4 | +# on the pull request. It needs write permissions for the pull request |
| 5 | +# to post the comments and can only be used in the context of a pull request. |
| 6 | +# |
| 7 | +name: mypy, pylint and coverage PR review comments |
| 8 | + |
| 9 | +on: |
| 10 | + workflow_run: |
| 11 | + workflows: ["Unit tests"] |
| 12 | + types: [completed] |
| 13 | + |
| 14 | +concurrency: # On new workflow, cancel old workflows from the same PR, branch or tag: |
| 15 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 16 | + cancel-in-progress: true |
| 17 | + |
| 18 | +permissions: |
| 19 | + contents: read |
| 20 | + pull-requests: write |
| 21 | + |
| 22 | +jobs: |
| 23 | + mypy-pylint-coverage-PR-comments: |
| 24 | + runs-on: ubuntu-22.04 |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + ref: ${{ github.event.pull_request.head.ref }} |
| 29 | + repository: ${{ github.event.pull_request.head.repo.full_name }} |
| 30 | + |
| 31 | + - uses: actions/setup-python@v5 |
| 32 | + with: |
| 33 | + python-version: 3.11 |
| 34 | + |
| 35 | + - name: Install uv and activate the environment |
| 36 | + uses: astral-sh/setup-uv@v6 |
| 37 | + with: |
| 38 | + activate-environment: true |
| 39 | + |
| 40 | + - run: uv pip install pylint tox types-setuptools -r pyproject.toml --extra mypy |
| 41 | + |
| 42 | + - uses: tsuyoshicho/action-mypy@v4 |
| 43 | + name: Run mypy with reviewdog to submit GitHub checks for warnings |
| 44 | + with: |
| 45 | + install_types: false |
| 46 | + reporter: github-pr-review |
| 47 | + level: warning |
| 48 | + |
| 49 | + - uses: dciborow/[email protected] |
| 50 | + name: Run pylint with reviewdog to submit GitHub checks for warnings |
| 51 | + with: |
| 52 | + reporter: github-pr-review |
| 53 | + glob_pattern: "xcp tests" |
| 54 | + |
| 55 | + - name: Run tox to run pytest in the defined tox environments |
| 56 | + run: tox -e py311-covcp |
| 57 | + continue-on-error: true |
| 58 | + env: |
| 59 | + DIFF_COVERAGE_MIN: 0 # reviewdog-action-code-coverage shows coverage |
| 60 | + |
| 61 | + - uses: aki77/reviewdog-action-code-coverage@v2 |
| 62 | + with: |
| 63 | + lcov_path: coverage.lcov |
0 commit comments