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:
|
||||
- uses: actions/checkout@v6
|
||||
- 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
|
||||
- run: cargo fmt --check
|
||||
clippy:
|
||||
name: Run lints
|
||||
machete:
|
||||
name: Detect unused dependencies
|
||||
runs-on: ubuntu-latest
|
||||
needs: [format]
|
||||
strategy:
|
||||
matrix:
|
||||
toolchain:
|
||||
@@ -33,36 +34,84 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- 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
|
||||
- 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:
|
||||
name: Build project and test
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: [clippy_debug, clippy_release]
|
||||
strategy:
|
||||
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:
|
||||
- stable
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- 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
|
||||
- run: cargo test --verbose
|
||||
- name: Cargo nextest
|
||||
run: cargo nextest run --verbose
|
||||
- name: Cargo doctest
|
||||
run: cargo test --doc --verbose
|
||||
build_release:
|
||||
name: Build project in release
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: [build_and_test]
|
||||
strategy:
|
||||
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:
|
||||
- stable
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
|
||||
- run: rustup component add rustfmt --toolchain ${{ matrix.toolchain }}
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Build Release
|
||||
shell: bash
|
||||
@@ -83,20 +132,6 @@ jobs:
|
||||
name: pumpkin-${{ runner.arch }}-${{ runner.os }}
|
||||
compression-level: 9
|
||||
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:
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
3
Cargo.lock
generated
3
Cargo.lock
generated
@@ -2158,7 +2158,6 @@ dependencies = [
|
||||
"bytes",
|
||||
"console-subscriber",
|
||||
"crossbeam",
|
||||
"dashmap",
|
||||
"flate2",
|
||||
"futures",
|
||||
"hmac 0.13.0-rc.4",
|
||||
@@ -2182,7 +2181,6 @@ dependencies = [
|
||||
"serde_json",
|
||||
"sha1",
|
||||
"sha2 0.11.0-rc.4",
|
||||
"signature 2.2.0",
|
||||
"simplelog",
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
@@ -2253,7 +2251,6 @@ name = "pumpkin-macros"
|
||||
version = "0.1.0-dev+1.21.11"
|
||||
dependencies = [
|
||||
"proc-macro-error2",
|
||||
"proc-macro2",
|
||||
"pumpkin-data",
|
||||
"quote",
|
||||
"syn",
|
||||
|
||||
@@ -39,4 +39,7 @@ harness = false
|
||||
|
||||
# Generated files generate a lot of warns
|
||||
# [lints]
|
||||
# workspace = true
|
||||
# workspace = true
|
||||
|
||||
[package.metadata.cargo-machete]
|
||||
ignored = ["phf"]
|
||||
|
||||
@@ -12,9 +12,8 @@ proc-macro-error2.workspace = true
|
||||
pumpkin-data.workspace = true
|
||||
|
||||
|
||||
proc-macro2.workspace = true
|
||||
quote.workspace = true
|
||||
syn.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
workspace = true
|
||||
|
||||
@@ -88,3 +88,6 @@ tokio_taskdump = []
|
||||
|
||||
# [lints]
|
||||
# workspace = true
|
||||
|
||||
[package.metadata.cargo-machete]
|
||||
ignored = ["serde_json"]
|
||||
|
||||
@@ -53,7 +53,6 @@ bytes.workspace = true
|
||||
rand.workspace = true
|
||||
|
||||
num-bigint.workspace = true
|
||||
dashmap.workspace = true
|
||||
|
||||
# Console line reading
|
||||
rustyline.workspace = true
|
||||
@@ -89,7 +88,7 @@ tokio-util = { workspace = true, features = ["rt"] }
|
||||
|
||||
flate2.workspace = true
|
||||
console-subscriber = { workspace = true, optional = true }
|
||||
signature.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile.workspace = true
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ impl Context {
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// ```ignore
|
||||
/// context.register_service("my_service", Arc::new(MyService::new())).await;
|
||||
/// ```
|
||||
pub async fn register_service<N: Into<String>, T: Payload + 'static>(
|
||||
@@ -132,7 +132,7 @@ impl Context {
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// ```ignore
|
||||
/// if let Some(service) = context.get_service::<MyService>("my_service").await {
|
||||
/// // Use the service
|
||||
/// }
|
||||
@@ -283,7 +283,7 @@ impl Context {
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```no_run
|
||||
/// ```ignore
|
||||
/// // Create and register a custom Lua plugin loader
|
||||
/// let lua_loader = Arc::new(LuaPluginLoader::new());
|
||||
/// context.register_plugin_loader(lua_loader).await;
|
||||
|
||||
Reference in New Issue
Block a user