Merge pull request #109 from tavateva/constants/env-config-and-tighte… #204
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: Python Test Coverage | |
| on: | |
| push: | |
| paths: | |
| - python/**/* | |
| env: | |
| GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
| GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
| jobs: | |
| test-coverage: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Check out Git repository | |
| uses: actions/checkout@v3 | |
| - name: Install Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Poetry | |
| uses: abatilo/actions-poetry@v2 | |
| with: | |
| poetry-version: '2.1.3' | |
| - name: Install Dependencies | |
| working-directory: ./python | |
| run: poetry install | |
| - name: Run Tests | |
| run: | | |
| poetry run coverage run -m pytest | |
| poetry run coverage report -m | |
| poetry run coverage xml | |
| working-directory: ./python | |
| - name: Coverage Badge | |
| run: | | |
| poetry run genbadge coverage -i coverage.xml -o coverage.svg | |
| working-directory: ./python | |
| - name: Verify Changed files | |
| uses: tj-actions/verify-changed-files@v16 | |
| id: verify-changed-files | |
| with: | |
| files: python/coverage.svg | |
| - name: Commit files | |
| if: steps.verify-changed-files.outputs.files_changed == 'true' | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add python/coverage.svg | |
| git commit -m "Updated coverage.svg" | |
| - name: Push changes | |
| if: steps.verify-changed-files.outputs.files_changed == 'true' | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ github.ref }} |