Skip to content

Commit bbc1934

Browse files
committed
wip ci and publishing
1 parent 4dcc287 commit bbc1934

File tree

4 files changed

+95
-0
lines changed

4 files changed

+95
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: uv-build
2+
description: Build the project with uv and run smoke tests
3+
inputs:
4+
python-version:
5+
description: Python version to install
6+
required: true
7+
runs:
8+
using: composite
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v5
12+
- name: Install uv
13+
uses: astral-sh/setup-uv@v6
14+
- name: Install Python
15+
shell: bash
16+
run: uv python install ${{ inputs.python-version }}
17+
- name: Build
18+
shell: bash
19+
run: uv build
20+
- name: Smoke test (wheel)
21+
shell: bash
22+
run: uv run --isolated --no-project --with dist/*.whl tests/smoke_test.py
23+
- name: Smoke test (source distribution)
24+
shell: bash
25+
run: uv run --isolated --no-project --with dist/*.tar.gz tests/smoke_test.py
26+
27+

.github/workflows/build.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- johan/pypi-ci
8+
pull_request:
9+
branches:
10+
- main
11+
jobs:
12+
run:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: [3.9, 3.10, 3.11, 3.12, 3.13]
17+
steps:
18+
- name: Build and smoke test
19+
uses: ./.github/actions/uv-build
20+
with:
21+
python-version: ${{ matrix.python-version }}

.github/workflows/publish.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: PyPI Publish
2+
3+
on:
4+
push:
5+
tags:
6+
# Publish on any tag starting with a `v`, e.g., v0.1.0
7+
- v*
8+
workflow_dispatch:
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: [3.9, 3.10, 3.11, 3.12, 3.13]
15+
steps:
16+
- name: Build and smoke test
17+
uses: ./.github/actions/uv-build
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
21+
publish:
22+
runs-on: ubuntu-latest
23+
needs: build
24+
environment:
25+
name: pypi
26+
permissions:
27+
id-token: write
28+
contents: read
29+
steps:
30+
- name: Build and smoke test
31+
uses: ./.github/actions/uv-build
32+
with:
33+
python-version: 3.12
34+
- name: Publish
35+
run: uv publish

tests/smoke_test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def test_smoke():
2+
import torch
3+
from romatch import roma_outdoor
4+
device = torch.device('cpu')
5+
model = roma_outdoor(device=device)
6+
assert model._get_device() == device
7+
assert model.w_resized == 560, f"Expected 560, got {model.w_resized}"
8+
assert model.h_resized == 560, f"Expected 560, got {model.h_resized}"
9+
assert model.upsample_res == (864, 864), f"Expected (864, 864), got {model.upsample_res}"
10+
11+
if __name__ == "__main__":
12+
test_smoke()

0 commit comments

Comments
 (0)