Skip to content

Commit

Permalink
chore(core): Display status on readme (#589)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
Tranquility2 authored Jun 5, 2024
1 parent 9045c0a commit 54822de
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
31 changes: 30 additions & 1 deletion .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
branches: [main]

jobs:
test:
run-tests-and-coverage:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
Expand All @@ -27,5 +27,34 @@ jobs:
run: poetry build && poetry run twine check dist/*.tar.gz
- name: Run tests
run: make core/tests
- name: Rename coverage file
run: mv .coverage .coverage.${{ matrix.python-version}}
- name: "Save coverage artifact"
uses: actions/upload-artifact@v4
with:
name: "coverage-artifact-${{ matrix.python-version}}"
path: ".coverage.*"
retention-days: 1
- name: Run doctests
run: make core/doctests

coverage-compile:
needs: "run-tests-and-coverage"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: ./.github/actions/setup-env
- name: Install Python dependencies
run: poetry install --all-extras
- name: "Download coverage artifacts"
uses: actions/download-artifact@v4
with:
pattern: "coverage-artifact-*"
merge-multiple: true
- name: Compile coverage
run: make coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ tests : ${TESTS}
${TESTS} : %/tests :
poetry run pytest -v --cov=testcontainers.$* $*/tests

# Target to combine and report coverage.
coverage:
poetry run coverage combine
poetry run coverage report
poetry run coverage xml
poetry run coverage html

# Target to lint the code.
lint:
pre-commit run -a
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
[![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)
[![image](https://img.shields.io/pypi/v/testcontainers.svg)](https://pypi.python.org/pypi/testcontainers)
[![image](https://img.shields.io/pypi/l/testcontainers.svg)](https://github.com/testcontainers/testcontainers-python/blob/main/LICENSE)
[![image](https://img.shields.io/pypi/pyversions/testcontainers.svg)](https://pypi.python.org/pypi/testcontainers)
[![codecov](https://codecov.io/gh/testcontainers/testcontainers-python/branch/master/graph/badge.svg)](https://codecov.io/gh/testcontainers/testcontainers-python)


# Testcontainers Python

`testcontainers-python` facilitates the use of Docker containers for functional and integration testing.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ priority = "primary"
line-length = 120

[tool.pytest.ini_options]
addopts = "--cov-report=term --cov-report=html --tb=short --strict-markers"
addopts = "--tb=short --strict-markers"
log_cli = true
log_cli_level = "INFO"

Expand Down

0 comments on commit 54822de

Please sign in to comment.