Skip to content

Commit 16969f4

Browse files
committed
ci(coverage.yml): add GitHub Actions workflow for running tests and collecting coverage reports
docs(README.md): update README to display GitHub Actions workflow status and Codecov badge
1 parent b112c50 commit 16969f4

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

.github/workflows/coverage.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Run tests
2+
on:
3+
push:
4+
branches:
5+
- master
6+
7+
jobs:
8+
tests:
9+
runs-on: ubuntu-22.04
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-python@v4
13+
with:
14+
python-version: "3.12"
15+
- name: Install Poetry
16+
uses: abatilo/actions-poetry@v2
17+
- name: Setup a local virtual environment
18+
run: |
19+
poetry config virtualenvs.create true --local
20+
poetry config virtualenvs.in-project true --local
21+
- uses: actions/cache@v3
22+
name: Define a cache for the virtual environment based on the dependencies lock file
23+
with:
24+
path: ./.venv
25+
key: venv-${{ hashFiles('poetry.lock') }}
26+
- name: Install dependencies
27+
run: poetry install
28+
- name: Run tests and collect coverage
29+
run: poetry run pytest --cov .
30+
- name: Upload coverage raports to Codecov
31+
uses: codecov/codecov-action@v4.0.1
32+
with:
33+
token: ${{ secrets.CODECOV_TOKEN }}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22

33
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
44
![GitHub License](https://img.shields.io/github/license/SpaceShaman/pypi-workflow)
5+
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/SpaceShaman/pypi-workflow/tests.yml)
6+
![Codecov](https://img.shields.io/codecov/c/github/SpaceShaman/pypi-workflow)

0 commit comments

Comments
 (0)