Skip to content

Add code coverage test when PR submitted #11

Add code coverage test when PR submitted

Add code coverage test when PR submitted #11

Workflow file for this run

name: Code Coverage
on:
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coverage
- name: Run tests with coverage
run: |
coverage erase
coverage run -m unittest discover -s tests
coverage report -m > coverage_report.txt
coverage html -d coverage_html_report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Comment PR
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Hello world ! :wave: