Skip to content

Commit 1cac2c9

Browse files
authored
ci: Add test coverage (#73)
1 parent df9f9ee commit 1cac2c9

File tree

5 files changed

+33
-0
lines changed

5 files changed

+33
-0
lines changed

.env-ci

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PYTEST_ADDOPTS=--cov . --cov-report xml

.github/workflows/python-test.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@ name: Python Checks and Unit Tests
22

33
on:
44
pull_request:
5+
push:
6+
branches:
7+
- main
58

69
jobs:
710
lint-test:
811
runs-on: ubuntu-latest
912

13+
permissions:
14+
id-token: write
15+
contents: read
16+
1017
strategy:
1118
max-parallel: 2
1219
matrix:
@@ -45,4 +52,14 @@ jobs:
4552
run: make typecheck
4653

4754
- name: Run Tests
55+
env:
56+
DOTENV_OVERRIDE_FILE: .env-ci
4857
run: make test
58+
59+
- name: Upload Coverage
60+
uses: codecov/codecov-action@v5
61+
env:
62+
PYTHON: ${{ matrix.python-version }}
63+
with:
64+
use_oidc: true
65+
env_vars: PYTHON

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
.EXPORT_ALL_VARIABLES:
22

3+
DOTENV_OVERRIDE_FILE ?= .env
4+
35
POETRY_VERSION ?= 2.1.3
46

57
COMPOSE_FILE ?= docker/docker-compose.local.yml
68
COMPOSE_PROJECT_NAME ?= flagsmith-common
79

10+
-include $(DOTENV_OVERRIDE_FILE)
11+
812
.PHONY: install-pip
913
install-pip:
1014
python -m pip install --upgrade pip

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# flagsmith-common
2+
3+
[![Coverage](https://codecov.io/gh/Flagsmith/flagsmith-common/graph/badge.svg?token=L3OGOXH86K)](https://codecov.io/gh/Flagsmith/flagsmith-common)
4+
25
Flagsmith's common library
36

47
### Development Setup

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ types-simplejson = "^3.20.0.20250326"
8484
requires = ["poetry-core"]
8585
build-backend = "poetry.core.masonry.api"
8686

87+
[tool.coverage.report]
88+
# Regexes for lines to exclude from consideration
89+
exclude_also = [
90+
'if TYPE_CHECKING:',
91+
'if typing.TYPE_CHECKING:',
92+
'@(abc\\.)?abstractmethod',
93+
]
94+
8795
[tool.pytest.ini_options]
8896
addopts = ['--ds=settings.dev', '-vvvv', '-p', 'no:warnings']
8997
console_output_style = 'count'

0 commit comments

Comments
 (0)