1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-05-15 16:23:20 +02:00

build: rework justfile toolchain input

This commit is contained in:
Rob Ede 2025-05-09 04:29:52 +01:00
parent d61b33928d
commit 69041c4f6c
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
3 changed files with 19 additions and 13 deletions

3
.cspell.yml Normal file
View File

@ -0,0 +1,3 @@
version: "0.2"
words:
- rustup

View File

@ -1,4 +1,4 @@
//! When MSRV is 1.48, replace with `core::future::Ready` and `core::future::ready()`. //! When MSRV is 1.82, replace with `core::future::Ready` and `core::future::ready()`.
use core::{ use core::{
future::Future, future::Future,

View File

@ -21,7 +21,6 @@ fmt:
# Downgrade dependencies necessary to run MSRV checks/tests. # Downgrade dependencies necessary to run MSRV checks/tests.
[private] [private]
downgrade-for-msrv: downgrade-for-msrv:
cargo update -p=clap --precise=4.4.18 # next ver: 1.74.0
cargo update -p=native-tls --precise=0.2.13 # next ver: 1.80.0 cargo update -p=native-tls --precise=0.2.13 # next ver: 1.80.0
cargo update -p=litemap --precise=0.7.4 # next ver: 1.81.0 cargo update -p=litemap --precise=0.7.4 # next ver: 1.81.0
cargo update -p=zerofrom --precise=0.1.5 # next ver: 1.81.0 cargo update -p=zerofrom --precise=0.1.5 # next ver: 1.81.0
@ -42,38 +41,42 @@ non_linux_all_features_list := ```
``` ```
all_crate_features := if os() == "linux" { "--all-features" } else { "--features='" + non_linux_all_features_list + "'" } all_crate_features := if os() == "linux" { "--all-features" } else { "--features='" + non_linux_all_features_list + "'" }
toolchain := ""
# Run Clippy over workspace. # Run Clippy over workspace.
clippy toolchain="": clippy:
cargo {{ toolchain }} clippy --workspace --all-targets {{ all_crate_features }} cargo {{ toolchain }} clippy --workspace --all-targets {{ all_crate_features }}
# Run Clippy using MSRV. # Run Clippy using MSRV.
clippy-msrv: downgrade-for-msrv (clippy msrv_rustup) clippy-msrv: downgrade-for-msrv
@just toolchain={{ msrv_rustup }} clippy
# Test workspace code. # Test workspace code.
[macos] [macos]
[windows] [windows]
test toolchain="": test:
cargo {{ toolchain }} test --lib --tests --package=actix-macros cargo {{ toolchain }} test --lib --tests --package=actix-macros
cargo {{ toolchain }} nextest run --no-tests=warn --workspace --exclude=actix-macros --no-default-features cargo {{ toolchain }} nextest run --no-tests=warn --workspace --exclude=actix-macros --no-default-features
cargo {{ toolchain }} nextest run --no-tests=warn --workspace --exclude=actix-macros {{ all_crate_features }} cargo {{ toolchain }} nextest run --no-tests=warn --workspace --exclude=actix-macros {{ all_crate_features }}
# Test workspace code. # Test workspace code.
[linux] [linux]
test toolchain="": test:
cargo {{ toolchain }} test --lib --tests --package=actix-macros cargo {{ toolchain }} test --lib --tests --package=actix-macros
cargo {{ toolchain }} nextest run --no-tests=warn --workspace --exclude=actix-macros --no-default-features cargo {{ toolchain }} nextest run --no-tests=warn --workspace --exclude=actix-macros --no-default-features
cargo {{ toolchain }} nextest run --no-tests=warn --workspace --exclude=actix-macros {{ non_linux_all_features_list }} cargo {{ toolchain }} nextest run --no-tests=warn --workspace --exclude=actix-macros {{ non_linux_all_features_list }}
cargo {{ toolchain }} nextest run --no-tests=warn --workspace --exclude=actix-macros {{ all_crate_features }} cargo {{ toolchain }} nextest run --no-tests=warn --workspace --exclude=actix-macros {{ all_crate_features }}
# Test workspace using MSRV. # Test workspace using MSRV.
test-msrv: downgrade-for-msrv (test msrv_rustup) test-msrv: downgrade-for-msrv
@just toolchain={{ msrv_rustup }} test
# Test workspace docs. # Test workspace docs.
test-docs toolchain="": && doc test-docs: && doc
cargo {{ toolchain }} test --doc --workspace {{ all_crate_features }} --no-fail-fast -- --nocapture cargo {{ toolchain }} test --doc --workspace {{ all_crate_features }} --no-fail-fast -- --nocapture
# Test workspace. # Test workspace.
test-all toolchain="": (test toolchain) (test-docs toolchain) test-all: test test-docs
# Document crates in workspace. # Document crates in workspace.
doc *args: && doc-set-workspace-crates doc *args: && doc-set-workspace-crates
@ -96,12 +99,12 @@ doc-watch:
cargo watch -- just doc cargo watch -- just doc
# Check for unintentional external type exposure on all crates in workspace. # Check for unintentional external type exposure on all crates in workspace.
check-external-types-all toolchain="+nightly": check-external-types-all:
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
exit=0 exit=0
for f in $(find . -mindepth 2 -maxdepth 2 -name Cargo.toml | grep -vE "\-codegen/|\-derive/|\-macros/"); do for f in $(find . -mindepth 2 -maxdepth 2 -name Cargo.toml | grep -vE "\-codegen/|\-derive/|\-macros/"); do
if ! just check-external-types-manifest "$f" {{ toolchain }}; then exit=1; fi if ! just toolchain="+nightly" check-external-types-manifest "$f"; then exit=1; fi
echo echo
echo echo
done done
@ -114,9 +117,9 @@ check-external-types-all-table toolchain="+nightly":
for f in $(find . -mindepth 2 -maxdepth 2 -name Cargo.toml | grep -vE "\-codegen/|\-derive/|\-macros/"); do for f in $(find . -mindepth 2 -maxdepth 2 -name Cargo.toml | grep -vE "\-codegen/|\-derive/|\-macros/"); do
echo echo
echo "Checking for $f" echo "Checking for $f"
just check-external-types-manifest "$f" {{ toolchain }} --output-format=markdown-table just toolchain="+nightly" check-external-types-manifest "$f" --output-format=markdown-table
done done
# Check for unintentional external type exposure on a crate. # Check for unintentional external type exposure on a crate.
check-external-types-manifest manifest_path toolchain="+nightly" *extra_args="": check-external-types-manifest manifest_path *extra_args="":
cargo {{ toolchain }} check-external-types --manifest-path "{{ manifest_path }}" {{ extra_args }} cargo {{ toolchain }} check-external-types --manifest-path "{{ manifest_path }}" {{ extra_args }}