Skip to content

Commit 197c4be

Browse files
Added many crates from asa-common to Cargo workspace (#169)
1 parent 0c54955 commit 197c4be

13 files changed

Lines changed: 110 additions & 5601 deletions

File tree

.github/workflows/rust.yml

Lines changed: 10 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
- 'asap-common/dependencies/rs/**'
99
- 'asap-common/tests/**'
1010
- 'asap-common/sketch-core/**'
11+
- 'Cargo.toml'
12+
- 'Cargo.lock'
1113
- '.github/workflows/rust.yml'
1214
pull_request:
1315
branches: [ main ]
@@ -16,6 +18,8 @@ on:
1618
- 'asap-common/dependencies/rs/**'
1719
- 'asap-common/tests/**'
1820
- 'asap-common/sketch-core/**'
21+
- 'Cargo.toml'
22+
- 'Cargo.lock'
1923
- '.github/workflows/rust.yml'
2024
workflow_dispatch:
2125

@@ -43,66 +47,14 @@ jobs:
4347
path: |
4448
~/.cargo/registry
4549
~/.cargo/git
46-
asap-query-engine/target
50+
target
4751
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
4852

4953
- name: Check formatting
50-
run: cargo fmt -- --check
51-
working-directory: asap-query-engine
52-
53-
- name: Check formatting (sketch_db_common)
54-
run: cargo fmt -- --check
55-
working-directory: asap-common/dependencies/rs/sketch_db_common
54+
run: cargo fmt --all -- --check
5655

5756
- name: Run clippy
58-
run: cargo clippy --all-targets --all-features -- -D warnings
59-
working-directory: asap-query-engine
60-
env:
61-
RUSTC_WRAPPER: sccache
62-
63-
- name: Run clippy (sketch_db_common)
64-
run: cargo clippy --all-targets --all-features -- -D warnings
65-
working-directory: asap-common/dependencies/rs/sketch_db_common
66-
env:
67-
RUSTC_WRAPPER: sccache
68-
69-
- name: Check formatting (sketch-core)
70-
run: cargo fmt -- --check
71-
working-directory: asap-common/sketch-core
72-
73-
- name: Run clippy (sketch-core)
74-
run: cargo clippy --all-targets --all-features -- -D warnings
75-
working-directory: asap-common/sketch-core
76-
env:
77-
RUSTC_WRAPPER: sccache
78-
79-
- name: Check formatting (sql_utilities)
80-
run: cargo fmt -- --check
81-
working-directory: asap-common/dependencies/rs/sql_utilities
82-
83-
- name: Run clippy (sql_utilities)
84-
run: cargo clippy --all-targets --all-features -- -D warnings
85-
working-directory: asap-common/dependencies/rs/sql_utilities
86-
env:
87-
RUSTC_WRAPPER: sccache
88-
89-
- name: Check formatting (promql_utilities)
90-
run: cargo fmt -- --check
91-
working-directory: asap-common/dependencies/rs/promql_utilities
92-
93-
- name: Run clippy (promql_utilities)
94-
run: cargo clippy --all-targets --all-features -- -D warnings
95-
working-directory: asap-common/dependencies/rs/promql_utilities
96-
env:
97-
RUSTC_WRAPPER: sccache
98-
99-
- name: Check formatting (datafusion_summary_library)
100-
run: cargo fmt -- --check
101-
working-directory: asap-common/dependencies/rs/datafusion_summary_library
102-
103-
- name: Run clippy (datafusion_summary_library)
104-
run: cargo clippy --all-targets --all-features -- -D warnings
105-
working-directory: asap-common/dependencies/rs/datafusion_summary_library
57+
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
10658
env:
10759
RUSTC_WRAPPER: sccache
10860

@@ -125,33 +77,11 @@ jobs:
12577
path: |
12678
~/.cargo/registry
12779
~/.cargo/git
128-
asap-query-engine/target
80+
target
12981
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
13082

131-
- name: Run QueryEngineRust tests
132-
run: cargo test
133-
working-directory: asap-query-engine
134-
env:
135-
RUSTC_WRAPPER: sccache
136-
137-
- name: Run sql_utilities tests
138-
run: cargo test
139-
working-directory: asap-common/dependencies/rs/sql_utilities
140-
env:
141-
RUSTC_WRAPPER: sccache
142-
143-
- name: Run promql_utilities tests
144-
run: cargo test
145-
working-directory: asap-common/dependencies/rs/promql_utilities
146-
env:
147-
RUSTC_WRAPPER: sccache
148-
149-
- name: Run sketch-core tests
150-
run: cargo test
151-
working-directory: asap-common/sketch-core
152-
- name: Run sketch_db_common tests
153-
run: cargo test
154-
working-directory: asap-common/dependencies/rs/sketch_db_common
83+
- name: Run all workspace tests
84+
run: cargo test --workspace
15585
env:
15686
RUSTC_WRAPPER: sccache
15787

.pre-commit-config.yaml

Lines changed: 15 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -66,114 +66,37 @@ repos:
6666
- prometheus-client
6767
- urllib3
6868

69-
# Rust formatting and linting
69+
# Rust formatting, linting, and tests (workspace-level)
7070
- repo: local
7171
hooks:
7272
- id: cargo-fmt
7373
name: cargo fmt
74-
description: Format Rust files with rustfmt.
75-
entry: bash -c 'cargo fmt --manifest-path asap-query-engine/Cargo.toml -- --check'
74+
description: Format all Rust workspace crates with rustfmt.
75+
entry: bash -c 'cargo fmt --all -- --check'
7676
language: system
77-
files: ^asap-query-engine/.*\.rs$
77+
files: \.rs$
7878
pass_filenames: false
7979

8080
- id: cargo-check
8181
name: cargo check
82-
description: Check the package for errors.
83-
entry: bash -c 'cargo check --manifest-path asap-query-engine/Cargo.toml --all'
82+
description: Check the workspace for errors.
83+
entry: bash -c 'cargo check --workspace'
8484
language: system
85-
files: ^asap-query-engine/.*\.rs$
85+
files: \.rs$
8686
pass_filenames: false
8787

8888
- id: cargo-clippy
8989
name: cargo clippy
90-
description: Lint Rust sources
91-
entry: bash -c 'cargo clippy --manifest-path asap-query-engine/Cargo.toml --all-targets --all-features -- -D warnings'
90+
description: Lint all Rust workspace crates.
91+
entry: bash -c 'cargo clippy --workspace --all-targets --all-features -- -D warnings'
9292
language: system
93-
files: ^asap-query-engine/.*\.rs$
93+
files: \.rs$
9494
pass_filenames: false
9595

96-
- id: cargo-fmt-datafusion-summary-library
97-
name: cargo fmt (datafusion_summary_library)
98-
description: Format datafusion_summary_libraryRust files with rustfmt.
99-
entry: bash -c 'cargo fmt --manifest-path asap-common/dependencies/rs/datafusion_summary_library/Cargo.toml -- --check'
96+
- id: cargo-test
97+
name: cargo test
98+
description: Run all Rust workspace tests.
99+
entry: bash -c 'cargo test --workspace'
100100
language: system
101-
files: ^asap-common/dependencies/rs/datafusion_summary_library/.*\.rs$
102-
pass_filenames: false
103-
104-
- id: cargo-test-datafusion-summary-library
105-
name: cargo test (datafusion_summary_library)
106-
description: Run datafusion_summary_library tests.
107-
entry: bash -c 'cargo test --manifest-path asap-common/dependencies/rs/datafusion_summary_library/Cargo.toml'
108-
language: system
109-
files: ^asap-common/dependencies/rs/datafusion_summary_library/.*\.rs$
110-
pass_filenames: false
111-
112-
- id: cargo-fmt-sql-utilities
113-
name: cargo fmt (sql_utilities)
114-
description: Format sql_utilities Rust files with rustfmt.
115-
entry: bash -c 'cargo fmt --manifest-path asap-common/dependencies/rs/sql_utilities/Cargo.toml -- --check'
116-
language: system
117-
files: ^asap-common/dependencies/rs/sql_utilities/.*\.rs$
118-
pass_filenames: false
119-
120-
- id: cargo-test-sql-utilities
121-
name: cargo test (sql_utilities)
122-
description: Run sql_utilities tests.
123-
entry: bash -c 'cargo test --manifest-path asap-common/dependencies/rs/sql_utilities/Cargo.toml'
124-
language: system
125-
files: ^asap-common/dependencies/rs/sql_utilities/.*\.rs$
126-
pass_filenames: false
127-
128-
- id: cargo-fmt-promql-utilities
129-
name: cargo fmt (promql_utilities)
130-
description: Format promql_utilities Rust files with rustfmt.
131-
entry: bash -c 'cargo fmt --manifest-path asap-common/dependencies/rs/promql_utilities/Cargo.toml -- --check'
132-
language: system
133-
files: ^asap-common/dependencies/rs/promql_utilities/.*\.rs$
134-
pass_filenames: false
135-
136-
- id: cargo-test-promql-utilities
137-
name: cargo test (promql_utilities)
138-
description: Run promql_utilities tests.
139-
entry: bash -c 'cargo test --manifest-path asap-common/dependencies/rs/promql_utilities/Cargo.toml'
140-
language: system
141-
files: ^asap-common/dependencies/rs/promql_utilities/.*\.rs$
142-
pass_filenames: false
143-
- id: cargo-fmt-sketch-core
144-
name: cargo fmt (sketch-core)
145-
description: Format sketch-core Rust files with rustfmt.
146-
entry: bash -c 'cargo fmt --manifest-path asap-common/sketch-core/Cargo.toml -- --check'
147-
language: system
148-
files: ^asap-common/sketch-core/.*\.rs$
149-
pass_filenames: false
150-
151-
- id: cargo-clippy-sketch-core
152-
name: cargo clippy (sketch-core)
153-
description: Lint sketch-core Rust sources.
154-
entry: bash -c 'cargo clippy --manifest-path asap-common/sketch-core/Cargo.toml --all-targets --all-features -- -D warnings'
155-
language: system
156-
files: ^asap-common/sketch-core/.*\.rs$
157-
pass_filenames: false
158-
159-
- id: cargo-test-sketch-core
160-
name: cargo test (sketch-core)
161-
description: Run sketch-core tests.
162-
entry: bash -c 'cargo test --manifest-path asap-common/sketch-core/Cargo.toml'
163-
language: system
164-
files: ^asap-common/sketch-core/.*\.rs$
165-
- id: cargo-fmt-sketch-db-common
166-
name: cargo fmt (sketch_db_common)
167-
description: Format sketch_db_common Rust files with rustfmt.
168-
entry: bash -c 'cargo fmt --manifest-path asap-common/dependencies/rs/sketch_db_common/Cargo.toml -- --check'
169-
language: system
170-
files: ^asap-common/dependencies/rs/sketch_db_common/.*\.rs$
171-
pass_filenames: false
172-
173-
- id: cargo-test-sketch-db-common
174-
name: cargo test (sketch_db_common)
175-
description: Run sketch_db_common tests.
176-
entry: bash -c 'cargo test --manifest-path asap-common/dependencies/rs/sketch_db_common/Cargo.toml'
177-
language: system
178-
files: ^asap-common/dependencies/rs/sketch_db_common/.*\.rs$
101+
files: \.rs$
179102
pass_filenames: false

Cargo.toml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
11
[workspace]
2-
members = ["asap-common/sketch-core", "asap-query-engine"]
32
resolver = "2"
3+
members = [
4+
"asap-common/sketch-core",
5+
"asap-common/dependencies/rs/promql_utilities",
6+
"asap-common/dependencies/rs/sql_utilities",
7+
"asap-common/dependencies/rs/sketch_db_common",
8+
"asap-common/dependencies/rs/datafusion_summary_library",
9+
"asap-query-engine",
10+
]
11+
12+
[workspace.package]
13+
edition = "2021"
14+
version = "0.1.0"
15+
16+
[workspace.dependencies]
17+
# Shared external deps (used by 2+ crates)
18+
serde = { version = "1.0", features = ["derive"] }
19+
serde_json = "1.0"
20+
serde_yaml = "0.9"
21+
thiserror = "1.0"
22+
anyhow = "1.0"
23+
tracing = "0.1"
24+
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
25+
clap = { version = "4.0", features = ["derive"] }
26+
chrono = { version = "0.4", features = ["serde"] }
27+
promql-parser = "0.5.0"
28+
tokio = { version = "1.0", features = ["full"] }
29+
30+
# Internal crates
31+
sketch-core = { path = "asap-common/sketch-core" }
32+
promql_utilities = { path = "asap-common/dependencies/rs/promql_utilities" }
33+
sql_utilities = { path = "asap-common/dependencies/rs/sql_utilities" }
34+
sketch_db_common = { path = "asap-common/dependencies/rs/sketch_db_common" }
35+
datafusion_summary_library = { path = "asap-common/dependencies/rs/datafusion_summary_library" }

0 commit comments

Comments
 (0)