Skip to content

Commit c218e1f

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 c218e1f

File tree

3 files changed

+105
-0
lines changed

3 files changed

+105
-0
lines changed

.github/workflows/lint.yml

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

.github/workflows/publish.yml

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

.github/workflows/test.yml

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

0 commit comments

Comments
 (0)