mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
ci: detect unused dependencies in CI + rearrange CI-steps (#1419)
* chore: detect unused dependencies * fix: exclude phf in pumpkin-data * fix: combine CI-steps and fail earlier * fix: use cargo-nextest + split clippy-steps
This commit is contained in:
83
.github/workflows/rust.yml
vendored
83
.github/workflows/rust.yml
vendored
@@ -20,12 +20,13 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
||||||
- run: rustup component add rustfmt --toolchain ${{ matrix.toolchain }}
|
- run: rustup component add rustfmt
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- run: cargo fmt --check
|
- run: cargo fmt --check
|
||||||
clippy:
|
machete:
|
||||||
name: Run lints
|
name: Detect unused dependencies
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: [format]
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
toolchain:
|
toolchain:
|
||||||
@@ -33,36 +34,84 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
||||||
- run: rustup component add clippy rustfmt --toolchain ${{ matrix.toolchain }}
|
- uses: bnjbvr/cargo-machete@main
|
||||||
|
clippy_debug:
|
||||||
|
name: Run lints (debug)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [machete]
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
toolchain:
|
||||||
|
- stable
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
||||||
|
- run: rustup component add clippy
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- run: cargo clippy --all-targets --all-features
|
- name: Clippy (debug)
|
||||||
|
run: cargo clippy --all-targets --all-features
|
||||||
|
clippy_release:
|
||||||
|
name: Run lints (release)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [machete]
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
toolchain:
|
||||||
|
- stable
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
||||||
|
- run: rustup component add clippy
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
- name: Clippy (release)
|
||||||
|
run: cargo clippy --release --all-targets --all-features
|
||||||
build_and_test:
|
build_and_test:
|
||||||
name: Build project and test
|
name: Build project and test
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
needs: [clippy_debug, clippy_release]
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-latest, macos-15-intel]
|
os:
|
||||||
|
[
|
||||||
|
ubuntu-latest,
|
||||||
|
ubuntu-24.04-arm,
|
||||||
|
windows-latest,
|
||||||
|
windows-11-arm,
|
||||||
|
macos-latest,
|
||||||
|
macos-15-intel,
|
||||||
|
]
|
||||||
toolchain:
|
toolchain:
|
||||||
- stable
|
- stable
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
||||||
- run: rustup component add rustfmt --toolchain ${{ matrix.toolchain }}
|
- uses: taiki-e/install-action@nextest
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- run: cargo test --verbose
|
- name: Cargo nextest
|
||||||
|
run: cargo nextest run --verbose
|
||||||
|
- name: Cargo doctest
|
||||||
|
run: cargo test --doc --verbose
|
||||||
build_release:
|
build_release:
|
||||||
name: Build project in release
|
name: Build project in release
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
needs: [build_and_test]
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-latest, macos-15-intel]
|
os:
|
||||||
|
[
|
||||||
|
ubuntu-latest,
|
||||||
|
ubuntu-24.04-arm,
|
||||||
|
windows-latest,
|
||||||
|
windows-11-arm,
|
||||||
|
macos-latest,
|
||||||
|
macos-15-intel,
|
||||||
|
]
|
||||||
toolchain:
|
toolchain:
|
||||||
- stable
|
- stable
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
||||||
- run: rustup component add rustfmt --toolchain ${{ matrix.toolchain }}
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- name: Build Release
|
- name: Build Release
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -83,20 +132,6 @@ jobs:
|
|||||||
name: pumpkin-${{ runner.arch }}-${{ runner.os }}
|
name: pumpkin-${{ runner.arch }}-${{ runner.os }}
|
||||||
compression-level: 9
|
compression-level: 9
|
||||||
path: dist/pumpkin-*
|
path: dist/pumpkin-*
|
||||||
|
|
||||||
clippy_release:
|
|
||||||
name: Run lints in release mode
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
toolchain:
|
|
||||||
- stable
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v6
|
|
||||||
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
|
||||||
- run: rustup component add clippy rustfmt --toolchain ${{ matrix.toolchain }}
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
|
||||||
- run: cargo clippy --release --all-targets --all-features
|
|
||||||
draft_release:
|
draft_release:
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|||||||
3
Cargo.lock
generated
3
Cargo.lock
generated
@@ -2158,7 +2158,6 @@ dependencies = [
|
|||||||
"bytes",
|
"bytes",
|
||||||
"console-subscriber",
|
"console-subscriber",
|
||||||
"crossbeam",
|
"crossbeam",
|
||||||
"dashmap",
|
|
||||||
"flate2",
|
"flate2",
|
||||||
"futures",
|
"futures",
|
||||||
"hmac 0.13.0-rc.4",
|
"hmac 0.13.0-rc.4",
|
||||||
@@ -2182,7 +2181,6 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"sha1",
|
"sha1",
|
||||||
"sha2 0.11.0-rc.4",
|
"sha2 0.11.0-rc.4",
|
||||||
"signature 2.2.0",
|
|
||||||
"simplelog",
|
"simplelog",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
@@ -2253,7 +2251,6 @@ name = "pumpkin-macros"
|
|||||||
version = "0.1.0-dev+1.21.11"
|
version = "0.1.0-dev+1.21.11"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-error2",
|
"proc-macro-error2",
|
||||||
"proc-macro2",
|
|
||||||
"pumpkin-data",
|
"pumpkin-data",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn",
|
||||||
|
|||||||
@@ -39,4 +39,7 @@ harness = false
|
|||||||
|
|
||||||
# Generated files generate a lot of warns
|
# Generated files generate a lot of warns
|
||||||
# [lints]
|
# [lints]
|
||||||
# workspace = true
|
# workspace = true
|
||||||
|
|
||||||
|
[package.metadata.cargo-machete]
|
||||||
|
ignored = ["phf"]
|
||||||
|
|||||||
@@ -12,9 +12,8 @@ proc-macro-error2.workspace = true
|
|||||||
pumpkin-data.workspace = true
|
pumpkin-data.workspace = true
|
||||||
|
|
||||||
|
|
||||||
proc-macro2.workspace = true
|
|
||||||
quote.workspace = true
|
quote.workspace = true
|
||||||
syn.workspace = true
|
syn.workspace = true
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|||||||
@@ -88,3 +88,6 @@ tokio_taskdump = []
|
|||||||
|
|
||||||
# [lints]
|
# [lints]
|
||||||
# workspace = true
|
# workspace = true
|
||||||
|
|
||||||
|
[package.metadata.cargo-machete]
|
||||||
|
ignored = ["serde_json"]
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ bytes.workspace = true
|
|||||||
rand.workspace = true
|
rand.workspace = true
|
||||||
|
|
||||||
num-bigint.workspace = true
|
num-bigint.workspace = true
|
||||||
dashmap.workspace = true
|
|
||||||
|
|
||||||
# Console line reading
|
# Console line reading
|
||||||
rustyline.workspace = true
|
rustyline.workspace = true
|
||||||
@@ -89,7 +88,7 @@ tokio-util = { workspace = true, features = ["rt"] }
|
|||||||
|
|
||||||
flate2.workspace = true
|
flate2.workspace = true
|
||||||
console-subscriber = { workspace = true, optional = true }
|
console-subscriber = { workspace = true, optional = true }
|
||||||
signature.workspace = true
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile.workspace = true
|
tempfile.workspace = true
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ impl Context {
|
|||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```ignore
|
||||||
/// context.register_service("my_service", Arc::new(MyService::new())).await;
|
/// context.register_service("my_service", Arc::new(MyService::new())).await;
|
||||||
/// ```
|
/// ```
|
||||||
pub async fn register_service<N: Into<String>, T: Payload + 'static>(
|
pub async fn register_service<N: Into<String>, T: Payload + 'static>(
|
||||||
@@ -132,7 +132,7 @@ impl Context {
|
|||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```ignore
|
||||||
/// if let Some(service) = context.get_service::<MyService>("my_service").await {
|
/// if let Some(service) = context.get_service::<MyService>("my_service").await {
|
||||||
/// // Use the service
|
/// // Use the service
|
||||||
/// }
|
/// }
|
||||||
@@ -283,7 +283,7 @@ impl Context {
|
|||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```ignore
|
||||||
/// // Create and register a custom Lua plugin loader
|
/// // Create and register a custom Lua plugin loader
|
||||||
/// let lua_loader = Arc::new(LuaPluginLoader::new());
|
/// let lua_loader = Arc::new(LuaPluginLoader::new());
|
||||||
/// context.register_plugin_loader(lua_loader).await;
|
/// context.register_plugin_loader(lua_loader).await;
|
||||||
|
|||||||
Reference in New Issue
Block a user