Skip to content
This repository was archived by the owner on Jul 10, 2026. It is now read-only.

Mark repository as archived in README #5

Mark repository as archived in README

Mark repository as archived in README #5

Workflow file for this run

---
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2025 The Linux Foundation
# Runs on a new pull request, performs build and runs tests
name: 'Python Build/Test'
# yamllint disable-line rule:truthy
on:
workflow_dispatch:
pull_request:
types: [opened, reopened, edited, synchronize]
branches:
- main
- master
paths:
- '**'
- '!.github/**'
- '!.*'
- '!tox.ini'
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
permissions: {}
jobs:
python-build:
name: 'Python Build'
runs-on: 'ubuntu-latest'
outputs:
matrix_json: "${{ steps.python-build.outputs.matrix_json }}"
artefact_name: "${{ steps.python-build.outputs.artefact_name }}"
artefact_path: "${{ steps.python-build.outputs.artefact_path }}"
permissions:
contents: read
timeout-minutes: 12
env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
steps:
# Harden the runner used by this workflow
# yamllint disable-line rule:line-length
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: 'audit'
# yamllint disable-line rule:line-length
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: 'Build Python project'
id: python-build
# yamllint disable-line rule:line-length
uses: lfreleng-actions/python-build-action@48381cece78a990a6ba93bd5924bcd40bf0d1a7d # v0.1.20
python-tests:
name: 'Python Tests'
runs-on: 'ubuntu-latest'
needs: 'python-build'
# Matrix job
strategy:
fail-fast: false
matrix: "${{ fromJson(needs.python-build.outputs.matrix_json) }}"
permissions:
contents: read
timeout-minutes: 12
steps:
# Harden the runner used by this workflow
# yamllint disable-line rule:line-length
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
# yamllint disable-line rule:line-length
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: "Python tests [pytest] ${{ matrix.python-version }}"
# yamllint disable-line rule:line-length
uses: lfreleng-actions/python-test-action@b997656111c9b547f8458b18baf6be139e2d2c6c # v0.1.12
with:
python_version: ${{ matrix.python-version }}
python-audit:
name: 'Python Audit'
runs-on: 'ubuntu-latest'
needs: 'python-build'
# Matrix job
strategy:
fail-fast: false
matrix: "${{ fromJson(needs.python-build.outputs.matrix_json) }}"
permissions:
contents: read
timeout-minutes: 10
steps:
# Harden the runner used by this workflow
# yamllint disable-line rule:line-length
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: 'audit'
# yamllint disable-line rule:line-length
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: "Audit dependencies ${{ matrix.python-version }}"
# yamllint disable-line rule:line-length
uses: lfreleng-actions/python-audit-action@d2a271bdbf08572dbd8addd3358e5e937ab3739b # v0.2.3
with:
python_version: "${{ matrix.python-version }}"
sbom:
name: 'Generate SBOM'
runs-on: ubuntu-latest
needs: 'python-build'
timeout-minutes: 10
permissions:
contents: read
steps:
# yamllint disable-line rule:line-length
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: "Generate SBOM"
id: sbom
# yamllint disable-line rule:line-length
uses: lfreleng-actions/python-sbom-action@ae4aca2ef28d7da4ec95049cc78be43e632d322a # v0.1.0
with:
include_dev: "false"
sbom_format: "both"
- name: "Upload SBOM artifacts"
# yamllint disable-line rule:line-length
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: sbom-files
path: |
sbom-cyclonedx.json
sbom-cyclonedx.xml
retention-days: 45
- name: "Security scan with Grype"
# yamllint disable-line rule:line-length
uses: anchore/scan-action@568b89d27fc18c60e56937bff480c91c772cd993 # v7.1.0
with:
sbom: "${{ steps.sbom.outputs.sbom_json_path }}"
- name: "Summary step"
run: |
# Summary step
echo "SBOM count: ${{ steps.sbom.outputs.component_count }}"
echo "Tool used: ${{ steps.sbom.outputs.dependency_manager }}"