[Penify]: Documentation for commit - 41294a8 #100
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: Tests | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest pytest-cov coverage-badge | |
| - name: Run tests with pytest and generate coverage | |
| run: | | |
| pytest --cov=penify_hook tests/ --cov-report=xml --cov-report=term | |
| - name: Generate coverage badge | |
| run: | | |
| coverage-badge -o coverage.svg -f | |
| - name: Commit coverage badge | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' | |
| run: | | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Action" | |
| git add coverage.svg | |
| git diff --quiet && git diff --staged --quiet || git commit -m "Update coverage badge" -a | |
| - name: Push coverage badge | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ github.ref }} |