Skip to content

Commit 23e4d74

Browse files
committed
localize rdf5d to this repo
1 parent 642fb09 commit 23e4d74

27 files changed

+6429
-4
lines changed

Cargo.lock

Lines changed: 10 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: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
members = [
33
"lib",
44
"cli",
5-
"python"
5+
"python",
6+
"rdf5d"
67
]
78
resolver = "2"
89

@@ -34,7 +35,7 @@ petgraph = { version = "0.8", features = ["serde-1"] }
3435
clap = { version = "4.4.18", features = ["derive"] }
3536
derive_builder = "0.20"
3637
oxigraph = "0.4.11"
37-
rdf5d = { version = "0.1.2", features = ["oxigraph", "zstd"] }
38+
rdf5d = { path = "rdf5d", features = ["oxigraph", "zstd"] }
3839

3940
ontoenv = { version = "0.4.0-a4", path = "lib" }
4041

rdf5d/.github/workflows/ci.yml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
tags: [ 'v*.*.*' ]
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
name: "Test (${{ matrix.os }} | features: ${{ matrix.features }})"
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-latest, macos-latest, windows-latest]
17+
features: ["", "oxigraph", "oxigraph,mmap", "zstd", "oxigraph,zstd", "oxigraph,mmap,zstd"]
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Install Rust
23+
uses: dtolnay/rust-toolchain@stable
24+
25+
- name: Cache cargo
26+
uses: actions/cache@v4
27+
with:
28+
path: |
29+
~/.cargo/registry
30+
~/.cargo/git
31+
target
32+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
33+
restore-keys: |
34+
${{ runner.os }}-cargo-
35+
36+
- name: Build
37+
shell: bash
38+
run: |
39+
if [ -z "${{ matrix.features }}" ]; then
40+
cargo build --all-targets --locked
41+
else
42+
cargo build --all-targets --locked --features "${{ matrix.features }}"
43+
fi
44+
45+
- name: Test
46+
shell: bash
47+
run: |
48+
if [ -z "${{ matrix.features }}" ]; then
49+
cargo test --locked
50+
else
51+
cargo test --locked --features "${{ matrix.features }}"
52+
fi
53+
54+
lint:
55+
name: Lint (clippy + fmt)
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Checkout
59+
uses: actions/checkout@v4
60+
61+
- name: Install Rust (components)
62+
uses: dtolnay/rust-toolchain@stable
63+
with:
64+
components: clippy, rustfmt
65+
66+
- name: Cache cargo
67+
uses: actions/cache@v4
68+
with:
69+
path: |
70+
~/.cargo/registry
71+
~/.cargo/git
72+
target
73+
key: ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }}
74+
restore-keys: |
75+
${{ runner.os }}-cargo-
76+
77+
- name: cargo fmt --check
78+
run: cargo fmt --all -- --check
79+
80+
- name: cargo clippy
81+
run: cargo clippy --all-targets -- -D warnings
82+
83+
publish:
84+
name: Publish (crates.io)
85+
runs-on: ubuntu-latest
86+
needs: [test, lint]
87+
if: startsWith(github.ref, 'refs/tags/v')
88+
steps:
89+
- name: Checkout
90+
uses: actions/checkout@v4
91+
92+
- name: Install Rust
93+
uses: dtolnay/rust-toolchain@stable
94+
95+
- name: Publish crate
96+
env:
97+
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
98+
run: |
99+
cargo publish --locked
100+
101+
build-cli:
102+
name: Build CLI Artifacts (${{ matrix.os }})
103+
runs-on: ${{ matrix.os }}
104+
needs: [test]
105+
if: startsWith(github.ref, 'refs/tags/v')
106+
strategy:
107+
matrix:
108+
os: [ubuntu-latest, macos-latest, windows-latest]
109+
steps:
110+
- name: Checkout
111+
uses: actions/checkout@v4
112+
113+
- name: Install Rust
114+
uses: dtolnay/rust-toolchain@stable
115+
116+
- name: Build CLI (release)
117+
run: cargo build --release --bin r5tu --features "oxigraph,mmap" --locked
118+
119+
- name: Upload artifact
120+
uses: actions/upload-artifact@v4
121+
with:
122+
name: r5tu-${{ matrix.os }}
123+
path: |
124+
target/release/r5tu*
125+
126+
release:
127+
name: GitHub Release
128+
runs-on: ubuntu-latest
129+
needs: [test, lint, build-cli]
130+
if: startsWith(github.ref, 'refs/tags/v')
131+
steps:
132+
- name: Checkout
133+
uses: actions/checkout@v4
134+
135+
- name: Extract tag
136+
id: vars
137+
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
138+
139+
- name: Download artifacts
140+
uses: actions/download-artifact@v4
141+
with:
142+
path: artifacts
143+
144+
- name: Create GitHub Release
145+
uses: softprops/action-gh-release@v2
146+
with:
147+
tag_name: ${{ steps.vars.outputs.tag }}
148+
name: ${{ steps.vars.outputs.tag }}
149+
draft: false
150+
prerelease: ${{ contains(steps.vars.outputs.tag, '-') }}
151+
files: |
152+
artifacts/**
153+
env:
154+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

rdf5d/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

rdf5d/AGENTS.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Repository Guidelines
2+
3+
## Project Structure & Module Organization
4+
- Root crate: `Cargo.toml` (Rust edition 2024).
5+
- Library code lives in `src/` (entry: `src/lib.rs`). Keep modules small and cohesive (e.g., `src/codec/`, `src/dict/`).
6+
- Unit tests sit next to code via `#[cfg(test)]` blocks; add integration tests under `tests/` when behavior spans modules.
7+
- Architecture reference: see `ARCH.md` for on‑disk format details and terminology.
8+
9+
## Build, Test, and Development Commands
10+
- Build: `cargo build` — compile debug build; `cargo build --release` for optimized.
11+
- Test: `cargo test` — run unit/integration tests.
12+
- Format: `cargo fmt --all` — apply `rustfmt` to the whole workspace.
13+
- Lint: `cargo clippy --all-targets -- -D warnings` — static checks; treat warnings as errors.
14+
15+
## Coding Style & Naming Conventions
16+
- Indentation: 4 spaces; no tabs. Always run `cargo fmt` before committing.
17+
- Naming: `snake_case` for modules/files/functions; `CamelCase` for types/traits; `SCREAMING_SNAKE_CASE` for constants.
18+
- Error handling: prefer `Result<T, E>` with descriptive error enums; avoid panics in library code.
19+
- Docs: add `///` rustdoc on public items; include small examples where practical.
20+
21+
## Testing Guidelines
22+
- Unit tests colocated with modules for tight feedback; name tests after behavior (e.g., `encodes_empty_dict`).
23+
- Integration tests in `tests/` mirror public API surface; one file per feature area (e.g., `tests/dict_roundtrip.rs`).
24+
- Edge cases: cover empty inputs, max sizes, and invalid headers described in `ARCH.md`.
25+
- Run: `cargo test`; aim to keep tests deterministic and mmap‑safe (no flaky fs assumptions).
26+
27+
## Commit & Pull Request Guidelines
28+
- Messages: use Conventional Commits (e.g., `feat(dict): add key16 index`, `fix(io): handle LE offset overflow`).
29+
- PRs: include a clear description, link related issues, reference `ARCH.md` sections when relevant, add/adjust tests, and attach benchmarks if performance‑affecting.
30+
- Pre‑PR checklist: `cargo fmt`, `cargo clippy -- -D warnings`, `cargo test` all passing.
31+
32+
## Security & Configuration Tips
33+
- Use stable Rust with up‑to‑date toolchain via `rustup`; enable `mmap`‑related tests only on supported platforms.
34+
- When touching file I/O or offsets, validate sizes and bounds; prefer checked math and fuzz tests for parsers.

0 commit comments

Comments
 (0)