# Copyright (C) 2025 Siemens # # SPDX-License-Identifier: MIT name: Tests on: push: branches: - main pull_request: jobs: test-minimal-deps: runs-on: ubuntu-24.04 strategy: matrix: sbom-type: ["cdx", "spdx"] steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: 3.14 - name: Install required dependencies for ${{ matrix.sbom-type }} shell: bash run: | python -m pip install --upgrade pip pip install .[${{ matrix.sbom-type }}] - name: Test the generate command with minimal dependencies for ${{ matrix.sbom-type }} shell: bash run: $(which debsbom) -v generate -t ${{ matrix.sbom-type }} -o sbom --root tests/root/tree --validate - name: Install test dependencies for ${{ matrix.sbom-type }} shell: bash run: pip install .[mindev] - name: Test pytest for subset ${{ matrix.sbom-type }} shell: bash run: pytest test: runs-on: ubuntu-24.04 strategy: matrix: python-version: ["3.11.2", "3.11", "3.12", "3.13.5", "3.13", "3.14"] steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: ${{ matrix.python-version }} - uses: ./.github/actions/pytest with: artifact-identifier: "${{ matrix.python-version }}" test-python-apt: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Check if python-apt is available run: python -c "import apt" - uses: ./.github/actions/pytest with: artifact-identifier: "python-apt" test-debian-trixie-compat: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Install dependencies as found in Debian trixie run: | python -m pip install --upgrade pip pip install -r requirements-trixie.txt - uses: ./.github/actions/pytest with: artifact-identifier: "debian-trixie-compat" coverage: name: Check coverage needs: test runs-on: ubuntu-24.04 steps: - name: Check out the repo uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Set up Python uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: 3.14 - name: Install dependencies run: | python -m pip install --upgrade coverage[toml] pip install .[dev] - name: Download coverage data uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: pattern: coverage-data-* merge-multiple: true - name: Check coverage and fail it it’s under 85% run: | cat >.coveragerc <> $GITHUB_STEP_SUMMARY # Report again and fail if under 85%. python -Im coverage report --fail-under=85 - name: Upload HTML report if check failed uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: html-report path: htmlcov if: ${{ failure() }}