Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,28 @@ jobs:
- name: Check REUSE compliance
run: reuse lint

machete:
name: Unused Dependencies
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Install cargo-machete
uses: taiki-e/install-action@41049aa56687c35e0afa74eed4f09cec4f9afabf # v2.85.2
with:
tool: cargo-machete

# The examples are the reference dependency set for a consumer, so
# a leftover there teaches the wrong thing — and would hide the
# facade regressing back to naming runtime crates in expansions.
# Dependencies reached only through emitted derives are declared
# in each manifest's cargo-machete metadata.
- name: Check for unused dependencies
run: cargo machete

workflows:
name: Workflow Audit
runs-on: ubuntu-latest
Expand Down Expand Up @@ -511,6 +533,7 @@ jobs:
- semver
- reuse
- workflows
- machete
- test
- examples
- postgres
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ run drops it once it is half an hour old.
| Examples | `cargo check --manifest-path examples/<name>/Cargo.toml --all-targets` |
| Feature combinations | `cargo hack check --workspace --feature-powerset --depth 2 --no-dev-deps` |
| Dependency policy | `cargo deny check` |
| Unused dependencies | `cargo machete` |
| Workflow audit | `zizmor --offline .github/workflows/` — actions must be pinned to a commit SHA |

`CI Success` is the terminal job: it reports every other job's outcome as
Expand Down
10 changes: 6 additions & 4 deletions examples/basic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ edition = "2024"
publish = false
description = "Basic CRUD example with entity-derive and Axum"

# Reached only through derives the macro emits — `serde::Serialize`
# on the DTOs, `utoipa::ToSchema` on the OpenAPI ones — which the
# unused-dependency heuristic cannot see.
[package.metadata.cargo-machete]
ignored = ["serde"]

[features]
default = ["postgres", "api"]
postgres = []
Expand All @@ -20,7 +26,6 @@ entity-derive = { path = "../../crates/entity-derive", features = [
"postgres",
"api",
] }
masterror = { version = "0.27", features = ["axum", "openapi"] }
axum = "0.8"
tokio = { version = "1", features = ["full"] }
sqlx = { version = "0.9", features = [
Expand All @@ -32,9 +37,6 @@ sqlx = { version = "0.9", features = [
uuid = { version = "1", features = ["v4", "v7", "serde"] }
chrono = { version = "0.4", features = ["serde"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
async-trait = "0.1"
tower-http = { version = "0.7", features = ["trace"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
utoipa = { version = "5", features = ["axum_extras", "chrono", "uuid"] }
Expand Down
9 changes: 6 additions & 3 deletions examples/commands/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ edition = "2024"
publish = false
description = "CQRS commands example with entity-derive"

# Reached only through derives the macro emits — `serde::Serialize`
# on the DTOs, `utoipa::ToSchema` on the OpenAPI ones — which the
# unused-dependency heuristic cannot see.
[package.metadata.cargo-machete]
ignored = ["utoipa"]

[features]
default = ["postgres", "api"]
postgres = []
Expand All @@ -20,7 +26,6 @@ entity-derive = { path = "../../crates/entity-derive", features = [
"postgres",
"api",
] }
entity-core = { path = "../../crates/entity-core", features = ["postgres"] }
axum = "0.8"
tokio = { version = "1", features = ["full"] }
sqlx = { version = "0.9", features = [
Expand All @@ -32,8 +37,6 @@ sqlx = { version = "0.9", features = [
uuid = { version = "1", features = ["v4", "v7", "serde"] }
chrono = { version = "0.4", features = ["serde"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
async-trait = "0.1"
utoipa = { version = "5", features = ["chrono", "uuid"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
9 changes: 6 additions & 3 deletions examples/events/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ edition = "2024"
publish = false
description = "Lifecycle events example with entity-derive"

# Reached only through derives the macro emits — `serde::Serialize`
# on the DTOs, `utoipa::ToSchema` on the OpenAPI ones — which the
# unused-dependency heuristic cannot see.
[package.metadata.cargo-machete]
ignored = ["utoipa"]

[features]
default = ["postgres", "api"]
postgres = []
Expand All @@ -20,7 +26,6 @@ entity-derive = { path = "../../crates/entity-derive", features = [
"postgres",
"api",
] }
entity-core = { path = "../../crates/entity-core", features = ["postgres"] }
axum = "0.8"
tokio = { version = "1", features = ["full", "sync"] }
sqlx = { version = "0.9", features = [
Expand All @@ -32,8 +37,6 @@ sqlx = { version = "0.9", features = [
uuid = { version = "1", features = ["v4", "v7", "serde"] }
chrono = { version = "0.4", features = ["serde"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
async-trait = "0.1"
utoipa = { version = "5", features = ["chrono", "uuid"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
8 changes: 6 additions & 2 deletions examples/filtering/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ edition = "2024"
publish = false
description = "Type-safe filtering example with entity-derive"

# Reached only through derives the macro emits — `serde::Serialize`
# on the DTOs, `utoipa::ToSchema` on the OpenAPI ones — which the
# unused-dependency heuristic cannot see.
[package.metadata.cargo-machete]
ignored = ["utoipa"]

[features]
default = ["postgres", "api"]
postgres = []
Expand All @@ -23,8 +29,6 @@ sqlx = { version = "0.9", features = ["runtime-tokio", "postgres", "uuid", "chro
uuid = { version = "1", features = ["v4", "v7", "serde"] }
chrono = { version = "0.4", features = ["serde"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
async-trait = "0.1"
utoipa = { version = "5", features = ["chrono", "uuid"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
4 changes: 0 additions & 4 deletions examples/full-app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ entity-core = { path = "../../crates/entity-core", features = [
"postgres",
"streams",
] }
masterror = { version = "0.27", features = ["axum", "openapi"] }
axum = "0.8"
tokio = { version = "1", features = ["full", "sync"] }
tokio-stream = "0.1"
sqlx = { version = "0.9", features = [
"runtime-tokio",
"postgres",
Expand All @@ -41,9 +39,7 @@ uuid = { version = "1", features = ["v4", "v7", "serde"] }
chrono = { version = "0.4", features = ["serde"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
async-trait = "0.1"
futures = "0.3"
tower-http = { version = "0.7", features = ["trace", "cors"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
utoipa = { version = "5", features = ["axum_extras", "chrono", "uuid"] }
Expand Down
7 changes: 6 additions & 1 deletion examples/hooks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ edition = "2024"
publish = false
description = "Lifecycle hooks example with entity-derive"

# Reached only through derives the macro emits — `serde::Serialize`
# on the DTOs, `utoipa::ToSchema` on the OpenAPI ones — which the
# unused-dependency heuristic cannot see.
[package.metadata.cargo-machete]
ignored = ["serde", "utoipa"]

[features]
default = ["postgres", "api"]
postgres = []
Expand All @@ -31,7 +37,6 @@ sqlx = { version = "0.9", features = [
uuid = { version = "1", features = ["v4", "v7", "serde"] }
chrono = { version = "0.4", features = ["serde"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
async-trait = "0.1"
utoipa = { version = "5", features = ["chrono", "uuid"] }
tracing = "0.1"
Expand Down
7 changes: 6 additions & 1 deletion examples/relations/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ edition = "2024"
publish = false
description = "Entity relations example with belongs_to and has_many"

# Reached only through derives the macro emits — `serde::Serialize`
# on the DTOs, `utoipa::ToSchema` on the OpenAPI ones — which the
# unused-dependency heuristic cannot see.
[package.metadata.cargo-machete]
ignored = ["serde", "utoipa"]

[features]
default = ["postgres", "api"]
postgres = []
Expand All @@ -24,7 +30,6 @@ uuid = { version = "1", features = ["v4", "v7", "serde"] }
chrono = { version = "0.4", features = ["serde"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
async-trait = "0.1"
utoipa = { version = "5", features = ["chrono", "uuid"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
8 changes: 6 additions & 2 deletions examples/soft-delete/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ edition = "2024"
publish = false
description = "Soft delete example with entity-derive"

# Reached only through derives the macro emits — `serde::Serialize`
# on the DTOs, `utoipa::ToSchema` on the OpenAPI ones — which the
# unused-dependency heuristic cannot see.
[package.metadata.cargo-machete]
ignored = ["serde", "utoipa"]

[features]
default = ["postgres", "api"]
postgres = []
Expand All @@ -23,8 +29,6 @@ sqlx = { version = "0.9", features = ["runtime-tokio", "postgres", "uuid", "chro
uuid = { version = "1", features = ["v4", "v7", "serde"] }
chrono = { version = "0.4", features = ["serde"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
async-trait = "0.1"
utoipa = { version = "5", features = ["chrono", "uuid"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
12 changes: 6 additions & 6 deletions examples/streams/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ edition = "2024"
publish = false
description = "Real-time streams example with entity-derive"

# Reached only through derives the macro emits — `serde::Serialize`
# on the DTOs, `utoipa::ToSchema` on the OpenAPI ones — which the
# unused-dependency heuristic cannot see.
[package.metadata.cargo-machete]
ignored = ["utoipa"]

[features]
default = ["postgres", "api"]
postgres = []
Expand All @@ -21,13 +27,8 @@ entity-derive = { path = "../../crates/entity-derive", features = [
"api",
"streams",
] }
entity-core = { path = "../../crates/entity-core", features = [
"postgres",
"streams",
] }
axum = "0.8"
tokio = { version = "1", features = ["full", "sync"] }
tokio-stream = "0.1"
sqlx = { version = "0.9", features = [
"runtime-tokio",
"postgres",
Expand All @@ -38,7 +39,6 @@ uuid = { version = "1", features = ["v4", "v7", "serde"] }
chrono = { version = "0.4", features = ["serde"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
async-trait = "0.1"
utoipa = { version = "5", features = ["chrono", "uuid"] }
futures = "0.3"
tracing = "0.1"
Expand Down
8 changes: 6 additions & 2 deletions examples/transactions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ edition = "2024"
publish = false
description = "Multi-entity transactions example with entity-derive"

# Reached only through derives the macro emits — `serde::Serialize`
# on the DTOs, `utoipa::ToSchema` on the OpenAPI ones — which the
# unused-dependency heuristic cannot see.
[package.metadata.cargo-machete]
ignored = ["utoipa"]

[features]
default = ["postgres", "api"]
postgres = []
Expand All @@ -28,8 +34,6 @@ sqlx = { version = "0.9", features = ["runtime-tokio", "postgres", "uuid", "chro
uuid = { version = "1", features = ["v4", "v7", "serde"] }
chrono = { version = "0.4", features = ["serde"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
async-trait = "0.1"
utoipa = { version = "5", features = ["chrono", "uuid"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
Loading