Skip to content

Add coverage report to github actions #178

Add coverage report to github actions

Add coverage report to github actions #178

Workflow file for this run

name: Run Tests
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
jobs:
test:
runs-on: ubuntu-latest # Use the latest version of Ubuntu as the operating system
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pytest
pip install pytest-asyncio
pip install coverage
- name: Run pytest
run: coverage run -m pytest tests/
- name: Generate coverage HTML report
run: coverage html
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: './htmlcov'
- name: Generate coverage json
run: coverage json -o coverage.json
- name: Upload coverage json to gist
env:
GIST_ID: ${{ secrets.GIST_ID }}
GIST_TOKEN: ${{ secrets.GIST_TOKEN }}
run: |
# Create a GitHub CLI authentication token
echo "$GIST_TOKEN" | gh auth login --with-token
# Update existing gist
gh gist edit $GIST_ID coverage.json