Skip to content

Latest commit

 

History

History
82 lines (56 loc) · 3.68 KB

development.md

File metadata and controls

82 lines (56 loc) · 3.68 KB

Development

English | 简体中文

This guide is for changing BSWorld: which test suites cover which code, the code and documentation rules, and what CI and releases do. Set up the checkout and BabbleSim as in the README, and run the commands from the repository root with .venv active.

Tests

Suite Command Requires
BSWorld unit tests pytest tests/unit Nothing else
BabbleSim integration pytest tests/integration/babblesim -n auto BSIM_OUT_PATH
UML Host suites pytest tests/integration/uml --require-integration -n auto The UML environment
All integration tests pytest tests/integration --require-integration -n auto Both of the above
Components pytest in components/<name> See BS2G4PHY, BSClock, BSController and BSUML

Without --require-integration, a UML test whose kernel, root filesystem or Host program is missing is skipped. With it, any skipped integration test fails the run.

Measure unit-test coverage of src/bsworld with branch coverage:

pytest --cov=bsworld tests/unit

For a change to scheduling, radio behavior, Host setup or topology lifecycle, run the affected integration suites as well as the unit tests.

Code style

Ruff checks and formats all Python in the repository. Its version is pinned in pyproject.toml.

ruff check .
ruff format --check .

To fix import order and formatting:

ruff check --select I --fix .
ruff format .

The line limit of 88 characters also applies to comments and strings, so wrap prose by hand.

Documentation

These guides have a Chinese edition, which must change in the same pull request as the English one:

English Chinese
README.md, CONTRIBUTING.md, SECURITY.md, CODE_OF_CONDUCT.md, THIRD_PARTY_NOTICES.md docs/zh-CN/
docs/*.md docs/zh-CN/
docker/README.md, tests/integration/uml/README.md README.zh-CN.md in the same directory

All other documentation, including everything under components/, is English only.

CI

Pull requests to main and pushes to main run these workflows.

Workflow Runs
Checks Ruff, tests/unit, and the BSClock, BS2G4PHY and BSUML tests
BSController BSController lint and unit tests, its HCI and Link Layer tests on BabbleSim, its Bumble samples, and two coexistence runs whose captures must match
UML image Builds the Docker image and runs tests/integration and the BSUML sample in it. Uploads the reports, logs and captures as bsworld-results-uml-<run-id>-<attempt> for 14 days.
PyPI Builds the component distributions and runs twine check --strict

Releases

A published GitHub release acts on its tag.

Tag Result
bs2g4phy-v<version> Publishes bs2g4phy to PyPI
bsclock-v<version> Publishes bsclock to PyPI
bscontroller-v<version> Publishes bscontroller to PyPI
bsuml-v<version> Publishes bsuml to PyPI
v<version> Adds the tag to the Docker image that CI built for the tagged commit

A component tag must match version in that component's pyproject.toml, and the package publishes from the pypi-<package> environment. PyPI rejects a version that already exists, so raise the version before releasing a change to a component's code or README.

A v<version> release needs the sha-<commit> image, which exists once CI has passed for that commit on main.