diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..b5f6baa8 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,30 @@ +# Copyright (C) 2025 Siemens +# +# SPDX-License-Identifier: MIT + +name: Lint Python Code + +on: + pull_request: + branches: + - master + push: + +jobs: + format: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install black + - name: Check code formatting with black + run: | + black --check --diff $(git ls-files '*.py') diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..66bbcdef --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,57 @@ +# Copyright (C) 2025 Siemens +# +# SPDX-License-Identifier: MIT + +name: Deploy + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + release-build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + + - name: Build release distributions + run: | + python -m pip install build + python -m build + + - name: Upload distributions + uses: actions/upload-artifact@v4 + with: + name: release-dists + path: dist/ + + pypi-publish: + runs-on: ubuntu-latest + needs: + - release-build + permissions: + id-token: write + + environment: + name: pypi + url: https://pypi.org/project/debsbom/${{ github.event.release.name }} + + steps: + - name: Retrieve release distributions + uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 + with: + name: release-dists + path: dist/ + + - name: Publish release distributions to PyPI + uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e + with: + packages-dir: dist/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..94917adc --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,30 @@ +# Copyright (C) 2025 Siemens +# +# SPDX-License-Identifier: MIT + +name: Run Tests + +on: + pull_request: + branches: + - master + push: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install .[dev] + + - name: Run pytest + run: pytest