Skip to content

Commit df2c8d1

Browse files
committed
Add gh actions
1 parent 6a9f5e9 commit df2c8d1

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

.github/workflows/black.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Lint
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: psf/black@stable
11+
with:
12+
options: "--check --verbose"
13+
src: "./bbox_visualizer/bbox_visualizer.py ./tests/test_bbox_visualizer.py"
14+
version: "~= 24.1"
15+
use_pyproject: true

.github/workflows/publish.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Upload Python Package to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Set up Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: '3.12'
17+
18+
- name: Install uv
19+
run: |
20+
python -m pip install --upgrade pip
21+
pip install uv
22+
23+
- name: Install dependencies
24+
run: |
25+
uv venv
26+
uv pip install ".[dev]"
27+
28+
- name: Run tests
29+
run: uv pip run pytest
30+
31+
build:
32+
needs: test
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- name: Set up Python
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: '3.12'
41+
42+
- name: Install uv
43+
run: |
44+
python -m pip install --upgrade pip
45+
pip install uv
46+
47+
- name: Install build dependencies
48+
run: |
49+
uv venv
50+
uv pip install build hatchling
51+
52+
- name: Build package
53+
run: uv pip run python -m build
54+
55+
- name: Store dist artifacts
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: dist
59+
path: dist/
60+
retention-days: 7
61+
62+
publish:
63+
needs: build
64+
runs-on: ubuntu-latest
65+
environment:
66+
name: pypi
67+
url: https://pypi.org/p/bbox-visualizer
68+
permissions:
69+
id-token: write # IMPORTANT: mandatory for trusted publishing
70+
71+
steps:
72+
- name: Download dist artifacts
73+
uses: actions/download-artifact@v4
74+
with:
75+
name: dist
76+
path: dist
77+
78+
- name: Publish package distributions to PyPI
79+
uses: pypa/gh-action-pypi-publish@release/v1
80+
with:
81+
verbose: true
82+
print-hash: true

0 commit comments

Comments
 (0)