Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,34 @@ jobs:
name: pytest-results-${{ matrix.python-version }}
path: coverage.xml

coverage-badge:
runs-on: ubuntu-latest
permissions:
contents: write
needs:
- tests
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download coverage artifact
uses: actions/download-artifact@v4
with:
name: pytest-results-3.13
- name: Run coverage badge
run: |
sudo apt-get install xq
pip install anybadge
mkdir -p badges/
cov_value=$(xq --xpath "//coverage/@line-rate" coverage.xml)
cov_rounded=$(printf "%.1f\n" $(bc <<< "100*${cov_value}"))
echo "Coverage found: ${cov_rounded}%"
anybadge --label python:coverage --value ${cov_rounded} --suffix "%" --file badges/coverage-python.svg --overwrite
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore(docs): update coverage badge"
commit_user_name: "CI/CD Push Token"

lint:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/siemens-standard-bom-python
url: https://pypi.org/p/siemens-standard-bom
permissions:
id-token: write
needs: call-build-and-test-workflow
Expand Down
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Standard BOM for Python

[![build](https://github.com/siemens/standard-bom-python/actions/workflows/ci.yml/badge.svg)](https://github.com/siemens/standard-bom-python/actions/workflows/ci.yml)
![coverage](badges/coverage-python.svg)
[![GitHub Tag](https://img.shields.io/github/v/tag/siemens/standard-bom-python)](https://github.com/siemens/standard-bom-python/releases/latest)

A Python library for creating and consuming documents in
[standard-bom format](https://sbom.siemens.io/latest/format.html).

"Standard BOM" is our Siemens-internal SBOM format based on the [Siemens CycloneDX Property Taxonomy](https://github.com/siemens/cyclonedx-property-taxonomy), which is 100% compatible with the CycloneDX.
"Standard BOM" is our Siemens-internal SBOM format based on
the [Siemens CycloneDX Property Taxonomy](https://github.com/siemens/cyclonedx-property-taxonomy), which is 100% compatible with the
CycloneDX.

Every Standard BOM document is a 100% CycloneDX document, so both CycloneDX and Standard BOM formats are supported both
for reading and writing SBOMs with this library.
Expand All @@ -27,11 +30,13 @@ pip install siemens-standard-bom
poetry add siemens-standard-bom
```

The library provides Standard BOM parser and serializer classes. The parser class is used to read a Standard BOM from a file, and the serializer class is used to write a Standard BOM to a file.
The library provides Standard BOM parser and serializer classes. The parser class is used to read a Standard BOM from a file, and the
serializer class is used to write a Standard BOM to a file.

> 💡 **Hint:**
This library provides strict type checking using [mypy](https://mypy.readthedocs.io/en/stable/).
Using [mypy with strict type checks](https://mypy.readthedocs.io/en/stable/existing_code.html#introduce-stricter-options) in your own codebase is recommended to ensure type safety.
> This library provides strict type checking using [mypy](https://mypy.readthedocs.io/en/stable/).
> Using [mypy with strict type checks](https://mypy.readthedocs.io/en/stable/existing_code.html#introduce-stricter-options) in your own
> codebase is recommended to ensure type safety.

## Read a Standard BOM from a JSON file

Expand Down Expand Up @@ -108,7 +113,8 @@ tools: Iterable[SbomComponent] = bom.tools
## Setting licenses to a component

You can set licenses to a component by using the `licenses` setter method of the `SbomComponent`
class. `SbomComponent.licenses` setter method accepts an iterable of type `License` which can be a `LicenseExpression` or a `DisjunctiveLicense`:
class. `SbomComponent.licenses` setter method accepts an iterable of type `License` which can be a `LicenseExpression` or
a `DisjunctiveLicense`:

```python
from cyclonedx.model.license import LicenseExpression
Expand All @@ -134,21 +140,21 @@ Once you have those prerequisites you can perform following development tasks lo
poetry install
```

then
then

```bash
poetry build
```

This will generate the build artifacts under `dist/` folder.
This will generate the build artifacts under `dist/` folder.

- Run all unit tests with all test cases and static code analysis

```bash
poetry run tox run
```

This will run all the tests for all supported Python versions as well as static linting and type checking.
This will run all the tests for all supported Python versions as well as static linting and type checking.

## License

Expand Down
23 changes: 23 additions & 0 deletions badges/coverage-python.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.