mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-23 22:51:07 +01:00
ci: rely more on just recipes (#558)
This commit is contained in:
parent
95ca8f0318
commit
3147dbe7ca
@ -2,8 +2,6 @@
|
|||||||
lint = "clippy --workspace --tests --examples --bins -- -Dclippy::todo"
|
lint = "clippy --workspace --tests --examples --bins -- -Dclippy::todo"
|
||||||
lint-all = "clippy --workspace --all-features --tests --examples --bins -- -Dclippy::todo"
|
lint-all = "clippy --workspace --all-features --tests --examples --bins -- -Dclippy::todo"
|
||||||
|
|
||||||
ci-doctest = "test --workspace --all-features --doc --no-fail-fast -- --nocapture"
|
|
||||||
|
|
||||||
# just check the library (without dev deps)
|
# just check the library (without dev deps)
|
||||||
ci-check-min = "hack --workspace check --no-default-features"
|
ci-check-min = "hack --workspace check --no-default-features"
|
||||||
ci-check-lib = "hack --workspace --feature-powerset --depth=2 --exclude-features=io-uring check"
|
ci-check-lib = "hack --workspace --feature-powerset --depth=2 --exclude-features=io-uring check"
|
||||||
@ -19,8 +17,5 @@ ci-test-rustls-020 = "hack --feature-powerset --depth=2 --exclude-features=io-ur
|
|||||||
ci-test-rustls-021 = "hack --feature-powerset --depth=2 --exclude-features=io-uring,rustls-0_20,rustls-0_22 test --lib --tests --no-fail-fast -- --nocapture"
|
ci-test-rustls-021 = "hack --feature-powerset --depth=2 --exclude-features=io-uring,rustls-0_20,rustls-0_22 test --lib --tests --no-fail-fast -- --nocapture"
|
||||||
ci-test-rustls-022 = "hack --feature-powerset --depth=2 --exclude-features=io-uring,rustls-0_20,rustls-0_21 test --lib --tests --no-fail-fast -- --nocapture"
|
ci-test-rustls-022 = "hack --feature-powerset --depth=2 --exclude-features=io-uring,rustls-0_20,rustls-0_21 test --lib --tests --no-fail-fast -- --nocapture"
|
||||||
|
|
||||||
# tests avoiding io-uring feature on Windows
|
|
||||||
ci-test-win = "hack --feature-powerset --depth=2 --exclude-features=io-uring test --lib --tests --no-fail-fast -- --nocapture"
|
|
||||||
|
|
||||||
# test with io-uring feature
|
# test with io-uring feature
|
||||||
ci-test-linux = "hack --feature-powerset --depth=2 --exclude-features=rustls-0_20 test --lib --tests --no-fail-fast -- --nocapture"
|
ci-test-linux = "hack --feature-powerset --depth=2 --exclude-features=rustls-0_20,rustls-0_21 test --lib --tests --no-fail-fast -- --nocapture"
|
||||||
|
10
.github/workflows/ci-post-merge.yml
vendored
10
.github/workflows/ci-post-merge.yml
vendored
@ -56,10 +56,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
toolchain: ${{ matrix.version }}
|
toolchain: ${{ matrix.version }}
|
||||||
|
|
||||||
- name: Install cargo-hack and cargo-ci-cache-clean
|
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
|
||||||
uses: taiki-e/install-action@v2.33.17
|
uses: taiki-e/install-action@v2.33.17
|
||||||
with:
|
with:
|
||||||
tool: cargo-hack,cargo-ci-cache-clean
|
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
|
||||||
|
|
||||||
- name: check lib
|
- name: check lib
|
||||||
if: >
|
if: >
|
||||||
@ -84,10 +84,8 @@ jobs:
|
|||||||
run: cargo ci-check-linux
|
run: cargo ci-check-linux
|
||||||
|
|
||||||
- name: tests
|
- name: tests
|
||||||
if: >
|
if: matrix.target.os != 'ubuntu-latest'
|
||||||
matrix.target.os != 'ubuntu-latest'
|
run: just test-code
|
||||||
&& matrix.target.triple != 'x86_64-pc-windows-gnu'
|
|
||||||
run: cargo ci-test
|
|
||||||
- name: tests
|
- name: tests
|
||||||
if: matrix.target.os == 'ubuntu-latest'
|
if: matrix.target.os == 'ubuntu-latest'
|
||||||
run: >-
|
run: >-
|
||||||
|
45
.github/workflows/ci.yml
vendored
45
.github/workflows/ci.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
|||||||
- { name: Windows (MinGW), os: windows-latest, triple: x86_64-pc-windows-gnu }
|
- { name: Windows (MinGW), os: windows-latest, triple: x86_64-pc-windows-gnu }
|
||||||
- { name: Windows (32-bit), os: windows-latest, triple: i686-pc-windows-msvc }
|
- { name: Windows (32-bit), os: windows-latest, triple: i686-pc-windows-msvc }
|
||||||
version:
|
version:
|
||||||
- { name: msrv, version: 1.65.0 }
|
- { name: msrv, version: 1.70.0 }
|
||||||
- { name: stable, version: stable }
|
- { name: stable, version: stable }
|
||||||
|
|
||||||
name: ${{ matrix.target.name }} / ${{ matrix.version.name }}
|
name: ${{ matrix.target.name }} / ${{ matrix.version.name }}
|
||||||
@ -58,17 +58,17 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
toolchain: ${{ matrix.version.version }}
|
toolchain: ${{ matrix.version.version }}
|
||||||
|
|
||||||
- name: Install just, cargo-hack, cargo-ci-cache-clean
|
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
|
||||||
uses: taiki-e/install-action@v2.33.17
|
uses: taiki-e/install-action@v2.33.17
|
||||||
with:
|
with:
|
||||||
tool: just,cargo-hack,cargo-ci-cache-clean
|
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
|
||||||
|
|
||||||
- name: Generate Cargo.lock
|
- name: Generate Cargo.lock
|
||||||
run: cargo generate-lockfile
|
run: cargo generate-lockfile
|
||||||
|
|
||||||
- name: workaround MSRV issues
|
- name: workaround MSRV issues
|
||||||
if: matrix.version.name == 'msrv'
|
if: matrix.version.name == 'msrv'
|
||||||
run: just downgrade-msrv
|
run: just downgrade-for-msrv
|
||||||
|
|
||||||
- name: check lib
|
- name: check lib
|
||||||
if: >
|
if: >
|
||||||
@ -79,7 +79,7 @@ jobs:
|
|||||||
if: matrix.target.os == 'ubuntu-latest'
|
if: matrix.target.os == 'ubuntu-latest'
|
||||||
run: cargo ci-check-lib-linux
|
run: cargo ci-check-lib-linux
|
||||||
- name: check lib
|
- name: check lib
|
||||||
if: matrix.target.triple == 'x86_64-pc-windows-gnu'
|
if: matrix.target.triple != 'x86_64-pc-windows-gnu'
|
||||||
run: cargo ci-check-min
|
run: cargo ci-check-min
|
||||||
|
|
||||||
- name: check full
|
- name: check full
|
||||||
@ -93,30 +93,15 @@ jobs:
|
|||||||
run: cargo ci-check-linux
|
run: cargo ci-check-linux
|
||||||
|
|
||||||
- name: tests
|
- name: tests
|
||||||
if: matrix.target.os == 'macos-latest'
|
run: just test
|
||||||
run: cargo ci-test
|
|
||||||
- name: tests
|
# TODO: re-instate some io-uring tests for PRs
|
||||||
if: >
|
|
||||||
matrix.target.os == 'windows-latest'
|
|
||||||
&& matrix.target.triple != 'x86_64-pc-windows-gnu'
|
|
||||||
run: cargo ci-test-win
|
|
||||||
- name: tests
|
|
||||||
if: matrix.target.os == 'ubuntu-latest'
|
|
||||||
run: >-
|
|
||||||
sudo bash -c "
|
|
||||||
ulimit -Sl 512
|
|
||||||
&& ulimit -Hl 512
|
|
||||||
&& PATH=$PATH:/usr/share/rust/.cargo/bin
|
|
||||||
&& RUSTUP_TOOLCHAIN=${{ matrix.version.version }} cargo ci-test-rustls-020
|
|
||||||
&& RUSTUP_TOOLCHAIN=${{ matrix.version.version }} cargo ci-test-rustls-021
|
|
||||||
&& RUSTUP_TOOLCHAIN=${{ matrix.version.version }} cargo ci-test-linux
|
|
||||||
"
|
|
||||||
|
|
||||||
- name: CI cache clean
|
- name: CI cache clean
|
||||||
run: cargo-ci-cache-clean
|
run: cargo-ci-cache-clean
|
||||||
|
|
||||||
rustdoc:
|
docs:
|
||||||
name: rustdoc
|
name: Documentation
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@ -127,6 +112,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
toolchain: nightly
|
toolchain: nightly
|
||||||
|
|
||||||
- name: doc tests io-uring
|
- name: Install just
|
||||||
run: |
|
uses: taiki-e/install-action@v2.33.17
|
||||||
sudo bash -c "ulimit -Sl 512 && ulimit -Hl 512 && PATH=$PATH:/usr/share/rust/.cargo/bin && RUSTUP_TOOLCHAIN=nightly cargo ci-doctest"
|
with:
|
||||||
|
tool: just
|
||||||
|
|
||||||
|
- name: doc tests
|
||||||
|
run: just test-docs
|
||||||
|
@ -34,6 +34,8 @@ pub mod reexports {
|
|||||||
/// Returns root certificates via `rustls-native-certs` crate as a rustls certificate store.
|
/// Returns root certificates via `rustls-native-certs` crate as a rustls certificate store.
|
||||||
///
|
///
|
||||||
/// See [`rustls_native_certs::load_native_certs()`] for more info on behavior and errors.
|
/// See [`rustls_native_certs::load_native_certs()`] for more info on behavior and errors.
|
||||||
|
///
|
||||||
|
/// [`rustls_native_certs::load_native_certs()`]: rustls_native_certs_06::load_native_certs()
|
||||||
#[cfg(feature = "rustls-0_20-native-roots")]
|
#[cfg(feature = "rustls-0_20-native-roots")]
|
||||||
pub fn native_roots_cert_store() -> io::Result<RootCertStore> {
|
pub fn native_roots_cert_store() -> io::Result<RootCertStore> {
|
||||||
let mut root_certs = RootCertStore::empty();
|
let mut root_certs = RootCertStore::empty();
|
||||||
|
@ -34,6 +34,8 @@ pub mod reexports {
|
|||||||
/// Returns root certificates via `rustls-native-certs` crate as a rustls certificate store.
|
/// Returns root certificates via `rustls-native-certs` crate as a rustls certificate store.
|
||||||
///
|
///
|
||||||
/// See [`rustls_native_certs::load_native_certs()`] for more info on behavior and errors.
|
/// See [`rustls_native_certs::load_native_certs()`] for more info on behavior and errors.
|
||||||
|
///
|
||||||
|
/// [`rustls_native_certs::load_native_certs()`]: rustls_native_certs_06::load_native_certs()
|
||||||
#[cfg(feature = "rustls-0_21-native-roots")]
|
#[cfg(feature = "rustls-0_21-native-roots")]
|
||||||
pub fn native_roots_cert_store() -> io::Result<RootCertStore> {
|
pub fn native_roots_cert_store() -> io::Result<RootCertStore> {
|
||||||
let mut root_certs = RootCertStore::empty();
|
let mut root_certs = RootCertStore::empty();
|
||||||
|
@ -34,6 +34,8 @@ pub mod reexports {
|
|||||||
/// Returns root certificates via `rustls-native-certs` crate as a rustls certificate store.
|
/// Returns root certificates via `rustls-native-certs` crate as a rustls certificate store.
|
||||||
///
|
///
|
||||||
/// See [`rustls_native_certs::load_native_certs()`] for more info on behavior and errors.
|
/// See [`rustls_native_certs::load_native_certs()`] for more info on behavior and errors.
|
||||||
|
///
|
||||||
|
/// [`rustls_native_certs::load_native_certs()`]: rustls_native_certs_07::load_native_certs()
|
||||||
#[cfg(feature = "rustls-0_22-native-roots")]
|
#[cfg(feature = "rustls-0_22-native-roots")]
|
||||||
pub fn native_roots_cert_store() -> io::Result<tokio_rustls::rustls::RootCertStore> {
|
pub fn native_roots_cert_store() -> io::Result<tokio_rustls::rustls::RootCertStore> {
|
||||||
let mut root_certs = tokio_rustls::rustls::RootCertStore::empty();
|
let mut root_certs = tokio_rustls::rustls::RootCertStore::empty();
|
||||||
|
@ -27,6 +27,6 @@ actix-utils = "3"
|
|||||||
tracing = "0.1.35"
|
tracing = "0.1.35"
|
||||||
tracing-futures = "0.2"
|
tracing-futures = "0.2"
|
||||||
|
|
||||||
[dev_dependencies]
|
[dev-dependencies]
|
||||||
actix-rt = "2"
|
actix-rt = "2"
|
||||||
slab = "0.4"
|
slab = "0.4"
|
||||||
|
53
justfile
53
justfile
@ -3,7 +3,7 @@ _list:
|
|||||||
|
|
||||||
# Downgrade dev-dependencies necessary to run MSRV checks/tests.
|
# Downgrade dev-dependencies necessary to run MSRV checks/tests.
|
||||||
[private]
|
[private]
|
||||||
downgrade-msrv:
|
downgrade-for-msrv:
|
||||||
cargo update -p=ciborium --precise=0.2.1
|
cargo update -p=ciborium --precise=0.2.1
|
||||||
cargo update -p=ciborium-ll --precise=0.2.1
|
cargo update -p=ciborium-ll --precise=0.2.1
|
||||||
cargo update -p=time --precise=0.3.16
|
cargo update -p=time --precise=0.3.16
|
||||||
@ -12,14 +12,51 @@ downgrade-msrv:
|
|||||||
cargo update -p=anstyle --precise=1.0.2
|
cargo update -p=anstyle --precise=1.0.2
|
||||||
cargo update -p=trybuild --precise=1.0.89
|
cargo update -p=trybuild --precise=1.0.89
|
||||||
|
|
||||||
|
msrv := ```
|
||||||
|
cargo metadata --format-version=1 \
|
||||||
|
| jq -r 'first(.packages[] | .name = "actix-tls") | .rust_version'
|
||||||
|
```
|
||||||
|
msrv_full := msrv + ".0" # comment out if the MSRV has a patch version specified
|
||||||
|
msrv_rustup := "+" + msrv_full
|
||||||
|
|
||||||
|
non_linux_all_features_list := ```
|
||||||
|
cargo metadata --format-version=1 \
|
||||||
|
| jq '.packages[] | select(.source == null) | .features | keys' \
|
||||||
|
| jq -r --slurp \
|
||||||
|
--arg exclusions "tokio-uring,io-uring" \
|
||||||
|
'add | unique | . - ($exclusions | split(",")) | join(",")'
|
||||||
|
```
|
||||||
|
|
||||||
|
all_crate_features := if os() == "linux" {
|
||||||
|
"--all-features"
|
||||||
|
} else {
|
||||||
|
"--features='" + non_linux_all_features_list + "'"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test workspace code.
|
||||||
|
test toolchain="":
|
||||||
|
cargo {{ toolchain }} test --lib --tests --package=actix-macros
|
||||||
|
cargo {{ toolchain }} nextest run --workspace --exclude=actix-macros --no-default-features
|
||||||
|
cargo {{ toolchain }} nextest run --workspace --exclude=actix-macros {{ all_crate_features }}
|
||||||
|
|
||||||
|
# Test workspace using MSRV.
|
||||||
|
test-msrv: downgrade-for-msrv (test msrv_rustup)
|
||||||
|
|
||||||
|
# Test workspace docs.
|
||||||
|
test-docs toolchain="": && doc
|
||||||
|
cargo {{ toolchain }} test --doc --workspace {{ all_crate_features }} --no-fail-fast -- --nocapture
|
||||||
|
|
||||||
|
# Test workspace.
|
||||||
|
test-all toolchain="": (test toolchain) (test-docs)
|
||||||
|
|
||||||
# Document crates in workspace.
|
# Document crates in workspace.
|
||||||
doc:
|
doc *args:
|
||||||
RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc --no-deps --workspace --features=rustls,openssl
|
RUSTDOCFLAGS="--cfg=docsrs -Dwarnings" cargo +nightly doc --no-deps --workspace {{ all_crate_features }} {{ args }}
|
||||||
|
|
||||||
# Document crates in workspace and watch for changes.
|
# Document crates in workspace and watch for changes.
|
||||||
doc-watch:
|
doc-watch:
|
||||||
RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc --no-deps --workspace --features=rustls-0_20,rustls-0_21,rustls-0_20-native-roots,rustls-0_21-native-roots,openssl --open
|
@just doc --open
|
||||||
cargo watch -- RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc --no-deps --workspace --features=rustls-0_20,rustls-0_21,rustls-0_20-native-roots,rustls-0_21-native-roots,openssl
|
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 toolchain="+nightly":
|
||||||
@ -27,7 +64,7 @@ check-external-types-all toolchain="+nightly":
|
|||||||
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 check-external-types-manifest "$f" {{ toolchain }}; then exit=1; fi
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
done
|
done
|
||||||
@ -40,9 +77,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 check-external-types-manifest "$f" {{ toolchain }} --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 toolchain="+nightly" *extra_args="":
|
||||||
cargo {{toolchain}} check-external-types --manifest-path "{{manifest_path}}" {{extra_args}}
|
cargo {{ toolchain }} check-external-types --manifest-path "{{ manifest_path }}" {{ extra_args }}
|
||||||
|
Loading…
Reference in New Issue
Block a user