Skip to content

Commit 0639062

Browse files
authored
refactor: repo structure and unify crates (#1426)
1 parent 8798e98 commit 0639062

508 files changed

Lines changed: 2228 additions & 8888 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cargo/config.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
router = "run --package hive-router"
44
dev = "run --package qp-dev-cli"
55
subgraphs = "run --package subgraphs"
6-
test_qp = "nextest run --package hive-router-query-planner"
6+
test_qp = "nextest run --package hive-router query_planner::"
77
test_all = "nextest run --workspace --exclude e2e"
88
test_e2e = "nextest run --package e2e --test-threads 5"
9-
test_qpe = "nextest run --package hive-router-plan-executor"
9+
test_qpe = "nextest run --package hive-router executor::"
1010
"clippy:fix" = "clippy --all --fix --allow-dirty --allow-staged"
11-
"router-config" = "run --release -p hive-router-config router-config.schema.json"
11+
"router-config" = "run --release -p hive-router --bin config_schema_generator router-config.schema.json"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
hive-router: major
3+
---
4+
5+
Merge the `hive-router-query-planner`, `hive-router-plan-executor`, `hive-router-config`, and `hive-router-internal` crates into the main `hive-router` crate. They are no longer published as separate crates on crates.io.
6+
7+
**If you just run the router (binary or Docker image), or write plugins against the `hive-router` crate: nothing changes for you.** The plugin API (`hive_router::plugins::*`, `RouterPlugin`, hooks, and everything re-exported at the crate root) is unaffected.
8+
9+
**If you depend directly on one of the four merged crates**, you'll need to switch to depending on `hive-router` instead and update your imports:
10+
11+
| Before | After |
12+
| ------------------------------------------ | ----------------------------------- |
13+
| `hive-router-query-planner` (Cargo dep) | `hive-router` |
14+
| `hive_router_query_planner::...` | `hive_router::query_planner::...` |
15+
| `hive-router-plan-executor` (Cargo dep) | `hive-router` |
16+
| `hive_router_plan_executor::...` | `hive_router::executor::...` |
17+
| `hive-router-config` (Cargo dep) | `hive-router` |
18+
| `hive_router_config::...` | `hive_router::config::...` |
19+
20+
`hive-router-internal` has no public replacement — it was never meant for use outside of the router itself, and is now a private module.
21+
22+
The four crates' existing published versions on crates.io are untouched, but they won't receive any further releases.

.github/workflows/build-router.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1
9191
with:
9292
target: ${{ matrix.rust_target }}
93-
cache-key: ${{ matrix.name }}
93+
cache-key: cache_v2_${{ matrix.name }}
9494

9595
# Only if using Zigbuild
9696
- uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2
@@ -125,7 +125,7 @@ jobs:
125125
- name: node-addon build (${{ matrix.rust_target }})
126126
working-directory: lib/node-addon
127127
env:
128-
CROSS_COMPILE: ${{ matrix.zigbuild }}
128+
USE_CROSS_COMPILE: ${{ matrix.zigbuild }}
129129
TARGET: ${{ matrix.rust_target }}
130130
run: npm run build
131131
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

.github/workflows/ci.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,16 @@ jobs:
134134
include:
135135
- name: "graphql-tools"
136136
package: "./lib/graphql-tools"
137+
bench_args: ""
137138
- name: "query-planner"
138-
package: "./lib/query-planner"
139+
package: "./bin/router"
140+
bench_args: "--bench qp_benches"
139141
- name: "executor"
140-
package: "./lib/executor"
142+
package: "./bin/router"
143+
bench_args: "--bench executor_benches --bench demand_control_benches --bench coprocessor_benches"
141144
- name: "router"
142145
package: "./bin/router"
146+
bench_args: "--features testing --bench persisted_documents_matcher_benches --bench router_benches"
143147
name: benchmark / ${{ matrix.name }}
144148
runs-on: ubuntu-latest
145149
steps:
@@ -153,7 +157,7 @@ jobs:
153157
name: Run subgraphs
154158
run: ./target/release/subgraphs & sleep 5
155159
- name: Run benchmarks
156-
run: cargo bench
160+
run: cargo bench ${{ matrix.bench_args }}
157161
working-directory: ${{ matrix.package }}
158162
- name: Upload benchmark results
159163
if: always() # Upload results even if benchmarks fail

.github/workflows/release.yaml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ jobs:
3535
- check
3636
env:
3737
CRATES_PUBLISH_JSON: ${{ needs.check.outputs.crates_to_publish }}
38-
PUBLISH_CONFIG_CRATE: ${{ contains(needs.check.outputs.crates_to_publish, '"hive-router-config"') }}
39-
PUBLISH_INTERNAL_CRATE: ${{ contains(needs.check.outputs.crates_to_publish, '"hive-router-internal"') }}
40-
PUBLISH_QUERY_PLANNER_CRATE: ${{ contains(needs.check.outputs.crates_to_publish, '"hive-router-query-planner"') }}
41-
PUBLISH_EXECUTOR_CRATE: ${{ contains(needs.check.outputs.crates_to_publish, '"hive-router-plan-executor"') }}
4238
PUBLISH_ROUTER_CRATE: ${{ contains(needs.check.outputs.crates_to_publish, '"hive-router"') }}
4339
PUBLISH_GRAPHQL_TOOLS_CRATE: ${{ contains(needs.check.outputs.crates_to_publish, '"graphql-tools"') }}
4440
PUBLISH_CONSOLE_SDK_CRATE: ${{ contains(needs.check.outputs.crates_to_publish, '"hive-console-sdk"') }}
@@ -82,34 +78,6 @@ jobs:
8278
run: |
8379
cargo publish --manifest-path ${{ fromJson(needs.check.outputs.crates_to_publish).hive-apollo-router-plugin }}
8480
85-
- name: publish config lib
86-
if: env.PUBLISH_CONFIG_CRATE == 'true'
87-
env:
88-
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
89-
run: |
90-
cargo publish --manifest-path ${{ fromJson(needs.check.outputs.crates_to_publish).hive-router-config }}
91-
92-
- name: publish internal lib
93-
if: env.PUBLISH_INTERNAL_CRATE == 'true'
94-
env:
95-
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
96-
run: |
97-
cargo publish --manifest-path ${{ fromJson(needs.check.outputs.crates_to_publish).hive-router-internal }}
98-
99-
- name: publish query-planner lib
100-
if: env.PUBLISH_QUERY_PLANNER_CRATE == 'true'
101-
env:
102-
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
103-
run: |
104-
cargo publish --manifest-path ${{ fromJson(needs.check.outputs.crates_to_publish).hive-router-query-planner }}
105-
106-
- name: publish executor lib
107-
if: env.PUBLISH_EXECUTOR_CRATE == 'true'
108-
env:
109-
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
110-
run: |
111-
cargo publish --manifest-path ${{ fromJson(needs.check.outputs.crates_to_publish).hive-router-plan-executor }}
112-
11381
- name: publish router lib
11482
if: env.PUBLISH_ROUTER_CRATE == 'true'
11583
env:

Cargo.lock

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

0 commit comments

Comments
 (0)