Skip to content

Commit 54822de

Browse files
authored
chore(core): Display status on readme (#589)
Make the Readme display some more details regarding the project: - using ruff (just a nice reference) - pypi version (good visibility) - license (good visibility) - supported python versions (good visibility) - code coverage reporting (main driver for this PR) ![image](https://github.com/testcontainers/testcontainers-python/assets/7189138/1e8897b6-15eb-47eb-a1e7-42caa7db1eca) Relates to #544 - export code coverage (e.g. to codecov)
1 parent 9045c0a commit 54822de

File tree

4 files changed

+45
-2
lines changed

4 files changed

+45
-2
lines changed

.github/workflows/ci-core.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
branches: [main]
1010

1111
jobs:
12-
test:
12+
run-tests-and-coverage:
1313
runs-on: ubuntu-22.04
1414
strategy:
1515
fail-fast: false
@@ -27,5 +27,34 @@ jobs:
2727
run: poetry build && poetry run twine check dist/*.tar.gz
2828
- name: Run tests
2929
run: make core/tests
30+
- name: Rename coverage file
31+
run: mv .coverage .coverage.${{ matrix.python-version}}
32+
- name: "Save coverage artifact"
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: "coverage-artifact-${{ matrix.python-version}}"
36+
path: ".coverage.*"
37+
retention-days: 1
3038
- name: Run doctests
3139
run: make core/doctests
40+
41+
coverage-compile:
42+
needs: "run-tests-and-coverage"
43+
runs-on: ubuntu-22.04
44+
steps:
45+
- uses: actions/checkout@v4
46+
- name: Set up Python
47+
uses: ./.github/actions/setup-env
48+
- name: Install Python dependencies
49+
run: poetry install --all-extras
50+
- name: "Download coverage artifacts"
51+
uses: actions/download-artifact@v4
52+
with:
53+
pattern: "coverage-artifact-*"
54+
merge-multiple: true
55+
- name: Compile coverage
56+
run: make coverage
57+
- name: Upload coverage to Codecov
58+
uses: codecov/codecov-action@v4
59+
with:
60+
token: ${{ secrets.CODECOV_TOKEN }}

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ tests : ${TESTS}
2727
${TESTS} : %/tests :
2828
poetry run pytest -v --cov=testcontainers.$* $*/tests
2929

30+
# Target to combine and report coverage.
31+
coverage:
32+
poetry run coverage combine
33+
poetry run coverage report
34+
poetry run coverage xml
35+
poetry run coverage html
36+
3037
# Target to lint the code.
3138
lint:
3239
pre-commit run -a

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
[![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)
2+
[![image](https://img.shields.io/pypi/v/testcontainers.svg)](https://pypi.python.org/pypi/testcontainers)
3+
[![image](https://img.shields.io/pypi/l/testcontainers.svg)](https://github.com/testcontainers/testcontainers-python/blob/main/LICENSE)
4+
[![image](https://img.shields.io/pypi/pyversions/testcontainers.svg)](https://pypi.python.org/pypi/testcontainers)
5+
[![codecov](https://codecov.io/gh/testcontainers/testcontainers-python/branch/master/graph/badge.svg)](https://codecov.io/gh/testcontainers/testcontainers-python)
6+
7+
18
# Testcontainers Python
29

310
`testcontainers-python` facilitates the use of Docker containers for functional and integration testing.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ priority = "primary"
159159
line-length = 120
160160

161161
[tool.pytest.ini_options]
162-
addopts = "--cov-report=term --cov-report=html --tb=short --strict-markers"
162+
addopts = "--tb=short --strict-markers"
163163
log_cli = true
164164
log_cli_level = "INFO"
165165

0 commit comments

Comments
 (0)