Skip to content

Commit 3147dbe

Browse files
authored
ci: rely more on just recipes (#558)
1 parent 95ca8f0 commit 3147dbe

File tree

8 files changed

+74
-49
lines changed

8 files changed

+74
-49
lines changed

.cargo/config.toml

+1-6
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
lint = "clippy --workspace --tests --examples --bins -- -Dclippy::todo"
33
lint-all = "clippy --workspace --all-features --tests --examples --bins -- -Dclippy::todo"
44

5-
ci-doctest = "test --workspace --all-features --doc --no-fail-fast -- --nocapture"
6-
75
# just check the library (without dev deps)
86
ci-check-min = "hack --workspace check --no-default-features"
97
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
1917
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"
2018
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"
2119

22-
# tests avoiding io-uring feature on Windows
23-
ci-test-win = "hack --feature-powerset --depth=2 --exclude-features=io-uring test --lib --tests --no-fail-fast -- --nocapture"
24-
2520
# test with io-uring feature
26-
ci-test-linux = "hack --feature-powerset --depth=2 --exclude-features=rustls-0_20 test --lib --tests --no-fail-fast -- --nocapture"
21+
ci-test-linux = "hack --feature-powerset --depth=2 --exclude-features=rustls-0_20,rustls-0_21 test --lib --tests --no-fail-fast -- --nocapture"

.github/workflows/ci-post-merge.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ jobs:
5656
with:
5757
toolchain: ${{ matrix.version }}
5858

59-
- name: Install cargo-hack and cargo-ci-cache-clean
59+
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
6060
uses: taiki-e/[email protected]
6161
with:
62-
tool: cargo-hack,cargo-ci-cache-clean
62+
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
6363

6464
- name: check lib
6565
if: >
@@ -84,10 +84,8 @@ jobs:
8484
run: cargo ci-check-linux
8585

8686
- name: tests
87-
if: >
88-
matrix.target.os != 'ubuntu-latest'
89-
&& matrix.target.triple != 'x86_64-pc-windows-gnu'
90-
run: cargo ci-test
87+
if: matrix.target.os != 'ubuntu-latest'
88+
run: just test-code
9189
- name: tests
9290
if: matrix.target.os == 'ubuntu-latest'
9391
run: >-

.github/workflows/ci.yml

+17-28
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- { name: Windows (MinGW), os: windows-latest, triple: x86_64-pc-windows-gnu }
2626
- { name: Windows (32-bit), os: windows-latest, triple: i686-pc-windows-msvc }
2727
version:
28-
- { name: msrv, version: 1.65.0 }
28+
- { name: msrv, version: 1.70.0 }
2929
- { name: stable, version: stable }
3030

3131
name: ${{ matrix.target.name }} / ${{ matrix.version.name }}
@@ -58,17 +58,17 @@ jobs:
5858
with:
5959
toolchain: ${{ matrix.version.version }}
6060

61-
- name: Install just, cargo-hack, cargo-ci-cache-clean
61+
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
6262
uses: taiki-e/[email protected]
6363
with:
64-
tool: just,cargo-hack,cargo-ci-cache-clean
64+
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
6565

6666
- name: Generate Cargo.lock
6767
run: cargo generate-lockfile
6868

6969
- name: workaround MSRV issues
7070
if: matrix.version.name == 'msrv'
71-
run: just downgrade-msrv
71+
run: just downgrade-for-msrv
7272

7373
- name: check lib
7474
if: >
@@ -79,7 +79,7 @@ jobs:
7979
if: matrix.target.os == 'ubuntu-latest'
8080
run: cargo ci-check-lib-linux
8181
- name: check lib
82-
if: matrix.target.triple == 'x86_64-pc-windows-gnu'
82+
if: matrix.target.triple != 'x86_64-pc-windows-gnu'
8383
run: cargo ci-check-min
8484

8585
- name: check full
@@ -93,30 +93,15 @@ jobs:
9393
run: cargo ci-check-linux
9494

9595
- name: tests
96-
if: matrix.target.os == 'macos-latest'
97-
run: cargo ci-test
98-
- name: tests
99-
if: >
100-
matrix.target.os == 'windows-latest'
101-
&& matrix.target.triple != 'x86_64-pc-windows-gnu'
102-
run: cargo ci-test-win
103-
- name: tests
104-
if: matrix.target.os == 'ubuntu-latest'
105-
run: >-
106-
sudo bash -c "
107-
ulimit -Sl 512
108-
&& ulimit -Hl 512
109-
&& PATH=$PATH:/usr/share/rust/.cargo/bin
110-
&& RUSTUP_TOOLCHAIN=${{ matrix.version.version }} cargo ci-test-rustls-020
111-
&& RUSTUP_TOOLCHAIN=${{ matrix.version.version }} cargo ci-test-rustls-021
112-
&& RUSTUP_TOOLCHAIN=${{ matrix.version.version }} cargo ci-test-linux
113-
"
96+
run: just test
97+
98+
# TODO: re-instate some io-uring tests for PRs
11499

115100
- name: CI cache clean
116101
run: cargo-ci-cache-clean
117102

118-
rustdoc:
119-
name: rustdoc
103+
docs:
104+
name: Documentation
120105
runs-on: ubuntu-latest
121106

122107
steps:
@@ -127,6 +112,10 @@ jobs:
127112
with:
128113
toolchain: nightly
129114

130-
- name: doc tests io-uring
131-
run: |
132-
sudo bash -c "ulimit -Sl 512 && ulimit -Hl 512 && PATH=$PATH:/usr/share/rust/.cargo/bin && RUSTUP_TOOLCHAIN=nightly cargo ci-doctest"
115+
- name: Install just
116+
uses: taiki-e/[email protected]
117+
with:
118+
tool: just
119+
120+
- name: doc tests
121+
run: just test-docs

actix-tls/src/connect/rustls_0_20.rs

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ pub mod reexports {
3434
/// Returns root certificates via `rustls-native-certs` crate as a rustls certificate store.
3535
///
3636
/// See [`rustls_native_certs::load_native_certs()`] for more info on behavior and errors.
37+
///
38+
/// [`rustls_native_certs::load_native_certs()`]: rustls_native_certs_06::load_native_certs()
3739
#[cfg(feature = "rustls-0_20-native-roots")]
3840
pub fn native_roots_cert_store() -> io::Result<RootCertStore> {
3941
let mut root_certs = RootCertStore::empty();

actix-tls/src/connect/rustls_0_21.rs

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ pub mod reexports {
3434
/// Returns root certificates via `rustls-native-certs` crate as a rustls certificate store.
3535
///
3636
/// See [`rustls_native_certs::load_native_certs()`] for more info on behavior and errors.
37+
///
38+
/// [`rustls_native_certs::load_native_certs()`]: rustls_native_certs_06::load_native_certs()
3739
#[cfg(feature = "rustls-0_21-native-roots")]
3840
pub fn native_roots_cert_store() -> io::Result<RootCertStore> {
3941
let mut root_certs = RootCertStore::empty();

actix-tls/src/connect/rustls_0_22.rs

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ pub mod reexports {
3434
/// Returns root certificates via `rustls-native-certs` crate as a rustls certificate store.
3535
///
3636
/// See [`rustls_native_certs::load_native_certs()`] for more info on behavior and errors.
37+
///
38+
/// [`rustls_native_certs::load_native_certs()`]: rustls_native_certs_07::load_native_certs()
3739
#[cfg(feature = "rustls-0_22-native-roots")]
3840
pub fn native_roots_cert_store() -> io::Result<tokio_rustls::rustls::RootCertStore> {
3941
let mut root_certs = tokio_rustls::rustls::RootCertStore::empty();

actix-tracing/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ actix-utils = "3"
2727
tracing = "0.1.35"
2828
tracing-futures = "0.2"
2929

30-
[dev_dependencies]
30+
[dev-dependencies]
3131
actix-rt = "2"
3232
slab = "0.4"

justfile

+45-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ _list:
33

44
# Downgrade dev-dependencies necessary to run MSRV checks/tests.
55
[private]
6-
downgrade-msrv:
6+
downgrade-for-msrv:
77
cargo update -p=ciborium --precise=0.2.1
88
cargo update -p=ciborium-ll --precise=0.2.1
99
cargo update -p=time --precise=0.3.16
@@ -12,22 +12,59 @@ downgrade-msrv:
1212
cargo update -p=anstyle --precise=1.0.2
1313
cargo update -p=trybuild --precise=1.0.89
1414

15+
msrv := ```
16+
cargo metadata --format-version=1 \
17+
| jq -r 'first(.packages[] | .name = "actix-tls") | .rust_version'
18+
```
19+
msrv_full := msrv + ".0" # comment out if the MSRV has a patch version specified
20+
msrv_rustup := "+" + msrv_full
21+
22+
non_linux_all_features_list := ```
23+
cargo metadata --format-version=1 \
24+
| jq '.packages[] | select(.source == null) | .features | keys' \
25+
| jq -r --slurp \
26+
--arg exclusions "tokio-uring,io-uring" \
27+
'add | unique | . - ($exclusions | split(",")) | join(",")'
28+
```
29+
30+
all_crate_features := if os() == "linux" {
31+
"--all-features"
32+
} else {
33+
"--features='" + non_linux_all_features_list + "'"
34+
}
35+
36+
# Test workspace code.
37+
test toolchain="":
38+
cargo {{ toolchain }} test --lib --tests --package=actix-macros
39+
cargo {{ toolchain }} nextest run --workspace --exclude=actix-macros --no-default-features
40+
cargo {{ toolchain }} nextest run --workspace --exclude=actix-macros {{ all_crate_features }}
41+
42+
# Test workspace using MSRV.
43+
test-msrv: downgrade-for-msrv (test msrv_rustup)
44+
45+
# Test workspace docs.
46+
test-docs toolchain="": && doc
47+
cargo {{ toolchain }} test --doc --workspace {{ all_crate_features }} --no-fail-fast -- --nocapture
48+
49+
# Test workspace.
50+
test-all toolchain="": (test toolchain) (test-docs)
51+
1552
# Document crates in workspace.
16-
doc:
17-
RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc --no-deps --workspace --features=rustls,openssl
53+
doc *args:
54+
RUSTDOCFLAGS="--cfg=docsrs -Dwarnings" cargo +nightly doc --no-deps --workspace {{ all_crate_features }} {{ args }}
1855

1956
# Document crates in workspace and watch for changes.
2057
doc-watch:
21-
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
22-
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
58+
@just doc --open
59+
cargo watch -- just doc
2360

2461
# Check for unintentional external type exposure on all crates in workspace.
2562
check-external-types-all toolchain="+nightly":
2663
#!/usr/bin/env bash
2764
set -euo pipefail
2865
exit=0
2966
for f in $(find . -mindepth 2 -maxdepth 2 -name Cargo.toml | grep -vE "\-codegen/|\-derive/|\-macros/"); do
30-
if ! just check-external-types-manifest "$f" {{toolchain}}; then exit=1; fi
67+
if ! just check-external-types-manifest "$f" {{ toolchain }}; then exit=1; fi
3168
echo
3269
echo
3370
done
@@ -40,9 +77,9 @@ check-external-types-all-table toolchain="+nightly":
4077
for f in $(find . -mindepth 2 -maxdepth 2 -name Cargo.toml | grep -vE "\-codegen/|\-derive/|\-macros/"); do
4178
echo
4279
echo "Checking for $f"
43-
just check-external-types-manifest "$f" {{toolchain}} --output-format=markdown-table
80+
just check-external-types-manifest "$f" {{ toolchain }} --output-format=markdown-table
4481
done
4582

4683
# Check for unintentional external type exposure on a crate.
4784
check-external-types-manifest manifest_path toolchain="+nightly" *extra_args="":
48-
cargo {{toolchain}} check-external-types --manifest-path "{{manifest_path}}" {{extra_args}}
85+
cargo {{ toolchain }} check-external-types --manifest-path "{{ manifest_path }}" {{ extra_args }}

0 commit comments

Comments
 (0)