Study lyte Coverage Badge #3
This file contains 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: Study lyte Coverage Badge | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
coverage: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.10'] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
python -m pip install --upgrade pip | |
python -m pip install pytest coverage genbadge[coverage] | |
python setup.py install | |
- name: Checkout gh-pages | |
uses: actions/checkout@v3 | |
with: | |
ref: gh-pages | |
- name: Create Badges | |
shell: bash | |
run: | | |
coverage run --source study_lyte -m pytest | |
coverage xml | |
mkdir -p badges | |
genbadge coverage -i coverage.xml -o badges/coverage.svg | |
- name: Deploy Badges | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "Update badges [skip ci]" | |
skip_fetch: true | |
skip_checkout: true | |
# Without this, will get Error: | |
# Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under '/home/runner/work/coverage-badge-action/coverage-badge-action/action.yml'. | |
# Did you forget to run actions/checkout before running your local action? | |
- name: Checkout Back | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} |