Skip to content

Commit 5297049

Browse files
committed
feat: add github workflows
Add workflows to lint, test and publish. Signed-off-by: Christoph Steiger <[email protected]>
1 parent 958c97d commit 5297049

File tree

3 files changed

+117
-0
lines changed

3 files changed

+117
-0
lines changed

.github/workflows/lint.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (C) 2025 Siemens
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
name: Lint Python Code
6+
7+
on:
8+
pull_request:
9+
branches:
10+
- master
11+
push:
12+
13+
jobs:
14+
format:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.x"
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install black
28+
- name: Check code formatting with black
29+
run: |
30+
black --check --diff $(git ls-files '*.py')

.github/workflows/publish.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copyright (C) 2025 Siemens
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
name: Deploy
6+
7+
on:
8+
release:
9+
types: [published]
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
release-build:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.x"
24+
25+
- name: Build release distributions
26+
run: |
27+
python -m pip install build
28+
python -m build
29+
30+
- name: Upload distributions
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: release-dists
34+
path: dist/
35+
36+
pypi-publish:
37+
runs-on: ubuntu-latest
38+
needs:
39+
- release-build
40+
permissions:
41+
id-token: write
42+
43+
environment:
44+
name: pypi
45+
url: https://pypi.org/project/debsbom/${{ github.event.release.name }}
46+
47+
steps:
48+
- name: Retrieve release distributions
49+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
50+
with:
51+
name: release-dists
52+
path: dist/
53+
54+
- name: Publish release distributions to PyPI
55+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
56+
with:
57+
packages-dir: dist/

.github/workflows/test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (C) 2025 Siemens
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
name: Run Tests
6+
7+
on:
8+
pull_request:
9+
branches:
10+
- master
11+
push:
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.x"
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install .[dev]
28+
29+
- name: Run pytest
30+
run: pytest

0 commit comments

Comments
 (0)