Run prek cleanup daily (#429) #177
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: pytest and coverage | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| tests: | |
| name: pytest and coverage report | |
| if: ${{ !(github.event_name == 'pull_request' && ( contains(github.event.pull_request.labels.*.name, 'dependencies') || github.event.pull_request.user.type == 'Bot' )) }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| # Gives the action the necessary permissions for publishing new | |
| # comments in pull requests. | |
| pull-requests: write | |
| # Gives the action the necessary permissions for pushing data to the | |
| # python-coverage-comment-action branch, and for editing existing | |
| # comments (to avoid publishing multiple comments in the same PR) | |
| contents: write | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v7 | |
| - name: Debug GitHub Variables | |
| run: | | |
| echo "github.event_name: ${{ github.event_name }}" | |
| echo "github.ref_name: ${{ github.ref_name }}" | |
| echo "github.event.repository.default_branch: ${{ github.event.repository.default_branch }}" | |
| echo "github.event.pull_request.user.type: ${{ github.event.pull_request.user.type }}" | |
| echo "PR labels: ${{ github.event_name == 'pull_request' && toJSON(github.event.pull_request.labels.*.name) || '' }}" | |
| - name: Setup Python 3 (with caching) | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.x | |
| cache: 'pip' | |
| cache-dependency-path: | | |
| pyproject.toml | |
| - name: Install pytest Requirements | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install --group pytest -e . | |
| - name: Run pytest with coverage (pytest-cov) | |
| run: pytest | |
| - name: 'Generate coverage Comment (and possibly Post to PR)' | |
| id: coverage_comment | |
| uses: py-cov-action/python-coverage-comment-action@v3 | |
| with: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| MINIMUM_GREEN: 90 | |
| MINIMUM_ORANGE: 70 | |
| - name: Store PR Comment to be Posted | |
| if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| # If you use a different name, update COMMENT_ARTIFACT_NAME accordingly | |
| name: python-coverage-comment-action | |
| # If you use a different name, update COMMENT_FILENAME accordingly | |
| path: python-coverage-comment-action.txt | |
| retention-days: 1 |