diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 00000000..89afbee0 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,42 @@ +name: Rust Tests + +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + test: + name: Test + runs-on: ubuntu-latest + if: github.event_name == 'push' || !github.event.pull_request.draft + steps: + - uses: actions/checkout@v4 + with: + lfs: true + - uses: dsherret/rust-toolchain-file@v1 + - uses: Swatinem/rust-cache@v2 + - name: Fetch LFS files + run: git lfs fetch --all && git lfs checkout + - name: Run tests + run: cargo test --all-features + + clippy: + name: Clippy + runs-on: ubuntu-latest + if: github.event_name == 'push' || !github.event.pull_request.draft + steps: + - uses: actions/checkout@v4 + - uses: dsherret/rust-toolchain-file@v1 + - uses: Swatinem/rust-cache@v2 + - run: cargo clippy --all-targets --all-features -- -D clippy::correctness diff --git a/Cargo.toml b/Cargo.toml index 3dcb0cce..252af282 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,3 +48,5 @@ tracing = "0.1.41" tracing-subscriber = "0.3.19" url = "2.5.4" valuable = "0.1.1" + +[workspace.lints.clippy] diff --git a/crates/archive/Cargo.toml b/crates/archive/Cargo.toml index ade5c755..cfbc9141 100644 --- a/crates/archive/Cargo.toml +++ b/crates/archive/Cargo.toml @@ -30,3 +30,6 @@ tokio-util = "0.7.13" tracing = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter", "json", "time"] } url = { workspace = true } + +[lints] +workspace = true diff --git a/crates/array/Cargo.toml b/crates/array/Cargo.toml index 169c53db..b61d00d4 100644 --- a/crates/array/Cargo.toml +++ b/crates/array/Cargo.toml @@ -18,3 +18,6 @@ proptest = "1.5.0" [[bench]] name = "main" harness = false + +[lints] +workspace = true diff --git a/crates/bds/Cargo.toml b/crates/bds/Cargo.toml index 62c6d1e2..99ffd850 100644 --- a/crates/bds/Cargo.toml +++ b/crates/bds/Cargo.toml @@ -23,3 +23,6 @@ tracing = { workspace = true, features = ["valuable"] } tracing-subscriber = { workspace = true, features = ["env-filter", "json", "valuable"] } url = { workspace = true } uuid = { workspace = true, features = ["v7"] } + +[lints] +workspace = true diff --git a/crates/bloom-filter/Cargo.toml b/crates/bloom-filter/Cargo.toml index 327a1e40..7c9c1e8a 100644 --- a/crates/bloom-filter/Cargo.toml +++ b/crates/bloom-filter/Cargo.toml @@ -12,3 +12,6 @@ criterion = "0.5.1" [[bench]] name = "main" harness = false + +[lints] +workspace = true diff --git a/crates/data-source/Cargo.toml b/crates/data-source/Cargo.toml index 1acc6c72..c2213b04 100644 --- a/crates/data-source/Cargo.toml +++ b/crates/data-source/Cargo.toml @@ -10,3 +10,6 @@ sqd-data-client = { path = "../data-client" } sqd-primitives = { path = "../primitives" } tokio = { workspace = true } tracing = { workspace = true } + +[lints] +workspace = true diff --git a/crates/data/Cargo.toml b/crates/data/Cargo.toml index 90dd9796..c2c08197 100644 --- a/crates/data/Cargo.toml +++ b/crates/data/Cargo.toml @@ -13,4 +13,7 @@ sqd-array = { path = "../array" } sqd-bloom-filter = { path = "../bloom-filter" } sqd-data-core = { path = "../data-core" } sqd-dataset = { path = "../dataset" } -sqd-primitives = { path = "../primitives" } \ No newline at end of file +sqd-primitives = { path = "../primitives" } + +[lints] +workspace = true diff --git a/crates/dataset/Cargo.toml b/crates/dataset/Cargo.toml index 54d2986d..56af78e9 100644 --- a/crates/dataset/Cargo.toml +++ b/crates/dataset/Cargo.toml @@ -4,3 +4,6 @@ version = "0.1.0" edition = "2021" [dependencies] + +[lints] +workspace = true diff --git a/crates/hotblocks/Cargo.toml b/crates/hotblocks/Cargo.toml index c001feab..cd9a93c8 100644 --- a/crates/hotblocks/Cargo.toml +++ b/crates/hotblocks/Cargo.toml @@ -32,3 +32,6 @@ tower-http = { version = "0.6.1", features = ["request-id", "trace"] } tracing = { workspace = true, features = ["valuable"] } tracing-subscriber = { workspace = true, features = ["env-filter", "json", "valuable"] } url = { workspace = true, features = ["serde"] } + +[lints] +workspace = true diff --git a/crates/polars/Cargo.toml b/crates/polars/Cargo.toml index 8ad33baf..b81012e0 100644 --- a/crates/polars/Cargo.toml +++ b/crates/polars/Cargo.toml @@ -19,4 +19,7 @@ features = [ "is_in", "lazy", "semi_anti_join" -] \ No newline at end of file +] + +[lints] +workspace = true diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index 4959a8e1..c6df5bc5 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -10,4 +10,7 @@ valuable = { workspace = true, optional = true, features = ["derive"] } [features] range = [] -sid = [] \ No newline at end of file +sid = [] + +[lints] +workspace = true diff --git a/crates/query-example/Cargo.toml b/crates/query-example/Cargo.toml index b59acf05..a4e2a610 100644 --- a/crates/query-example/Cargo.toml +++ b/crates/query-example/Cargo.toml @@ -8,3 +8,6 @@ anyhow = { workspace = true } flate2 = { workspace = true } sqd-query = { path = "../query", features = ["parquet"] } sqd-polars = { path = "../polars" } + +[lints] +workspace = true diff --git a/crates/query/Cargo.toml b/crates/query/Cargo.toml index 37bb19c3..2b5b0551 100644 --- a/crates/query/Cargo.toml +++ b/crates/query/Cargo.toml @@ -55,4 +55,7 @@ _bench_query = [ [[bench]] name = "main" -harness = false \ No newline at end of file +harness = false + +[lints] +workspace = true diff --git a/crates/storage/Cargo.toml b/crates/storage/Cargo.toml index 2bd38883..4e87652a 100644 --- a/crates/storage/Cargo.toml +++ b/crates/storage/Cargo.toml @@ -19,3 +19,6 @@ sqd-primitives = { path = "../primitives", features = ["borsh", "sid", "range"] proptest = { workspace = true } tempfile = { workspace = true } rand = "0.9.0" + +[lints] +workspace = true diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 4f3e8c52..f018685e 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,3 @@ [toolchain] channel = "1.89" +components = [ "rustfmt", "clippy" ]