Skip to content

Commit 4566fe4

Browse files
authored
Merge pull request #8 from harvard-lil/packaging
Packaging workflow
2 parents 6d88557 + e2ecbda commit 4566fe4

24 files changed

Lines changed: 872 additions & 94 deletions

File tree

.github/dependabot.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: cargo
5+
directory: "/"
6+
schedule:
7+
interval: weekly
8+
open-pull-requests-limit: 10
9+
groups:
10+
cargo-minor-patch:
11+
patterns:
12+
- "*"
13+
update-types:
14+
- minor
15+
- patch
16+
17+
- package-ecosystem: uv
18+
directory: "/binoc-python"
19+
schedule:
20+
interval: weekly
21+
open-pull-requests-limit: 5
22+
23+
- package-ecosystem: uv
24+
directory: "/model-plugins/binoc-sqlite"
25+
schedule:
26+
interval: weekly
27+
open-pull-requests-limit: 5
28+
29+
- package-ecosystem: uv
30+
directory: "/model-plugins/binoc-html"
31+
schedule:
32+
interval: weekly
33+
open-pull-requests-limit: 5
34+
35+
- package-ecosystem: github-actions
36+
directory: "/"
37+
schedule:
38+
interval: weekly
39+
open-pull-requests-limit: 5

.github/workflows/ci.yml

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches: [main]
66
pull_request:
77

8+
permissions:
9+
contents: read
10+
811
concurrency:
912
group: ${{ github.workflow }}-${{ github.ref }}
1013
cancel-in-progress: true
@@ -16,31 +19,54 @@ jobs:
1619
check:
1720
runs-on: ubuntu-latest
1821
steps:
19-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2023

21-
- uses: dtolnay/rust-toolchain@stable
24+
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
2225
with:
2326
components: clippy, rustfmt
2427

25-
- uses: Swatinem/rust-cache@v2
28+
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
2629

27-
- uses: astral-sh/setup-uv@v5
30+
- uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
2831

29-
- uses: extractions/setup-just@v2
32+
- uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2
3033

3134
- run: just check
3235

33-
test:
36+
rust-test:
3437
runs-on: ubuntu-latest
3538
steps:
36-
- uses: actions/checkout@v4
39+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
40+
41+
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
42+
43+
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
3744

38-
- uses: dtolnay/rust-toolchain@stable
45+
- uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
3946

40-
- uses: Swatinem/rust-cache@v2
47+
- run: cargo test
4148

42-
- uses: astral-sh/setup-uv@v5
49+
python-test:
50+
name: Python tests (${{ matrix.python-version }})
51+
runs-on: ubuntu-latest
52+
strategy:
53+
fail-fast: false
54+
matrix:
55+
# security or bugfix versions under https://devguide.python.org/versions/
56+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
57+
steps:
58+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
59+
60+
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
61+
62+
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
63+
64+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
65+
with:
66+
python-version: ${{ matrix.python-version }}
4367

44-
- uses: extractions/setup-just@v2
68+
- uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
4569

46-
- run: just test
70+
- run: cd binoc-python && uv run --extra dev pytest
71+
- run: cd model-plugins/binoc-sqlite && uv run --extra dev maturin develop && uv run --extra dev python -m pytest
72+
- run: cd model-plugins/binoc-html && uv run --extra dev python -m pytest

.github/workflows/publish.yml

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: false
15+
16+
env:
17+
CARGO_TERM_COLOR: always
18+
19+
jobs:
20+
build-binoc-wheels:
21+
name: Build binoc wheels (${{ matrix.artifact }})
22+
runs-on: ${{ matrix.os }}
23+
permissions:
24+
contents: read
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
include:
29+
- os: ubuntu-latest
30+
artifact: linux-x86_64
31+
target: x86_64-unknown-linux-gnu
32+
manylinux: auto
33+
- os: windows-latest
34+
artifact: windows-x86_64
35+
target: x86_64-pc-windows-msvc
36+
manylinux: off
37+
- os: macos-13
38+
artifact: macos-x86_64
39+
target: x86_64-apple-darwin
40+
manylinux: off
41+
- os: macos-14
42+
artifact: macos-aarch64
43+
target: aarch64-apple-darwin
44+
manylinux: off
45+
steps:
46+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
47+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
48+
with:
49+
python-version: "3.10"
50+
- uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1
51+
with:
52+
command: build
53+
working-directory: binoc-python
54+
target: ${{ matrix.target }}
55+
manylinux: ${{ matrix.manylinux }}
56+
args: --release --interpreter python --out dist
57+
sccache: "true"
58+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
59+
with:
60+
name: binoc-dist-${{ matrix.artifact }}
61+
path: binoc-python/dist
62+
63+
build-binoc-sdist:
64+
name: Build binoc sdist
65+
runs-on: ubuntu-latest
66+
permissions:
67+
contents: read
68+
steps:
69+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
70+
- uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1
71+
with:
72+
command: sdist
73+
working-directory: binoc-python
74+
args: --out dist
75+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
76+
with:
77+
name: binoc-dist-sdist
78+
path: binoc-python/dist
79+
80+
publish-binoc:
81+
name: Publish binoc to PyPI
82+
runs-on: ubuntu-latest
83+
needs: [build-binoc-wheels, build-binoc-sdist]
84+
environment:
85+
name: pypi-binoc
86+
url: https://pypi.org/project/binoc/
87+
permissions:
88+
contents: read
89+
id-token: write
90+
steps:
91+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
92+
with:
93+
pattern: binoc-dist-*
94+
path: dist
95+
merge-multiple: true
96+
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
97+
with:
98+
packages-dir: dist
99+
100+
build-binoc-sqlite-wheels:
101+
name: Build binoc-sqlite wheels (${{ matrix.artifact }})
102+
runs-on: ${{ matrix.os }}
103+
permissions:
104+
contents: read
105+
strategy:
106+
fail-fast: false
107+
matrix:
108+
include:
109+
- os: ubuntu-latest
110+
artifact: linux-x86_64
111+
target: x86_64-unknown-linux-gnu
112+
manylinux: auto
113+
- os: windows-latest
114+
artifact: windows-x86_64
115+
target: x86_64-pc-windows-msvc
116+
manylinux: off
117+
- os: macos-13
118+
artifact: macos-x86_64
119+
target: x86_64-apple-darwin
120+
manylinux: off
121+
- os: macos-14
122+
artifact: macos-aarch64
123+
target: aarch64-apple-darwin
124+
manylinux: off
125+
steps:
126+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
127+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
128+
with:
129+
python-version: "3.10"
130+
- uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1
131+
with:
132+
command: build
133+
working-directory: model-plugins/binoc-sqlite
134+
target: ${{ matrix.target }}
135+
manylinux: ${{ matrix.manylinux }}
136+
args: --release --interpreter python --out dist
137+
sccache: "true"
138+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
139+
with:
140+
name: binoc-sqlite-dist-${{ matrix.artifact }}
141+
path: model-plugins/binoc-sqlite/dist
142+
143+
build-binoc-sqlite-sdist:
144+
name: Build binoc-sqlite sdist
145+
runs-on: ubuntu-latest
146+
permissions:
147+
contents: read
148+
steps:
149+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
150+
- uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1
151+
with:
152+
command: sdist
153+
working-directory: model-plugins/binoc-sqlite
154+
args: --out dist
155+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
156+
with:
157+
name: binoc-sqlite-dist-sdist
158+
path: model-plugins/binoc-sqlite/dist
159+
160+
publish-binoc-sqlite:
161+
name: Publish binoc-sqlite to PyPI
162+
runs-on: ubuntu-latest
163+
needs: [build-binoc-sqlite-wheels, build-binoc-sqlite-sdist]
164+
environment:
165+
name: pypi-binoc-sqlite
166+
url: https://pypi.org/project/binoc-sqlite/
167+
permissions:
168+
contents: read
169+
id-token: write
170+
steps:
171+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
172+
with:
173+
pattern: binoc-sqlite-dist-*
174+
path: dist
175+
merge-multiple: true
176+
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
177+
with:
178+
packages-dir: dist
179+
180+
publish-binoc-sdk:
181+
name: Publish binoc-sdk to crates.io
182+
runs-on: ubuntu-latest
183+
environment:
184+
name: crates-io-binoc-sdk
185+
url: https://crates.io/crates/binoc-sdk
186+
permissions:
187+
contents: read
188+
id-token: write
189+
steps:
190+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
191+
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
192+
- uses: rust-lang/crates-io-auth-action@b7e9a28eded4986ec6b1fa40eeee8f8f165559ec # v1
193+
id: auth
194+
- run: cargo publish -p binoc-sdk --locked
195+
env:
196+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,22 @@ default-members = [
1717
"model-plugins/binoc-row-reorder",
1818
]
1919
resolver = "2"
20+
21+
[workspace.package]
22+
version = "0.1.0"
23+
edition = "2021"
24+
license = "MIT"
25+
repository = "https://github.com/harvard-lil/binoc"
26+
homepage = "https://github.com/harvard-lil/binoc"
27+
documentation = "https://github.com/harvard-lil/binoc/tree/main/docs"
28+
29+
[workspace.dependencies]
30+
binoc-sdk = { path = "binoc-sdk" }
31+
binoc-core = { path = "binoc-core" }
32+
binoc-stdlib = { path = "binoc-stdlib" }
33+
binoc-cli = { path = "binoc-cli" }
34+
35+
serde = { version = "1.0.228", features = ["derive"] }
36+
serde_json = "1.0.149"
37+
tempfile = "3.26.0"
38+
pyo3 = { version = "0.27", features = ["extension-module", "abi3-py310"] }

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,16 @@ uvx binoc --with binoc-sqlite diff snapshots/v1 snapshots/v2
141141

142142
Plugins can be Rust crates (compiled as native shared libraries via the `export_plugin!` macro) or pure Python. See [docs/adr/](docs/adr/) for architecture and [model-plugins/](model-plugins/) for reference implementations.
143143

144-
### Rust-only CLI
144+
### Rust SDK
145145

146-
A standalone Rust binary with standard library plugins (no Python, no plugin discovery) is also available:
146+
Rust plugin authors should depend on the published SDK crate:
147147

148148
```bash
149-
cargo install binoc-cli
150-
binoc-cli diff path/to/snapshot-a path/to/snapshot-b
149+
cargo add binoc-sdk
151150
```
152151

152+
The workspace also includes a standalone `binoc-cli` crate for contributors and a future Rust-only distribution path, but the SDK is the only Rust package published on crates.io for now.
153+
153154
### Development
154155

155156
Prerequisites: [Rust](https://rustup.rs/), [just](https://github.com/casey/just) (`brew install just`), and [uv](https://docs.astral.sh/uv/).

0 commit comments

Comments
 (0)