1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-23 16:21:06 +01:00

ci: rely more on justfiles (#3365)

This commit is contained in:
Rob Ede 2024-05-14 06:30:58 +01:00 committed by GitHub
parent 44f502e050
commit 3c9a930bd1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 79 additions and 70 deletions

View File

@ -8,7 +8,3 @@ ci-check-default = "hack --workspace check"
ci-check-default-tests = "check --workspace --tests" ci-check-default-tests = "check --workspace --tests"
ci-check-all-feature-powerset="hack --workspace --feature-powerset --skip=__compress,experimental-io-uring check" ci-check-all-feature-powerset="hack --workspace --feature-powerset --skip=__compress,experimental-io-uring check"
ci-check-all-feature-powerset-linux="hack --workspace --feature-powerset --skip=__compress check" ci-check-all-feature-powerset-linux="hack --workspace --feature-powerset --skip=__compress check"
# testing
ci-doctest-default = "test --workspace --doc --no-fail-fast -- --nocapture"
ci-doctest = "test --workspace --all-features --doc --no-fail-fast -- --nocapture"

View File

@ -44,10 +44,10 @@ jobs:
with: with:
toolchain: ${{ matrix.version.version }} toolchain: ${{ matrix.version.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.16 uses: taiki-e/install-action@v2.33.16
with: with:
tool: cargo-hack,cargo-ci-cache-clean tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
- name: check minimal - name: check minimal
run: cargo ci-check-min run: cargo ci-check-min
@ -57,19 +57,7 @@ jobs:
- name: tests - name: tests
timeout-minutes: 60 timeout-minutes: 60
shell: bash run: just test
run: |
set -e
cargo test --lib --tests -p=actix-router --all-features
cargo test --lib --tests -p=actix-http --all-features
cargo test --lib --tests -p=actix-web --features=rustls-0_20,rustls-0_21,rustls-0_22,openssl -- --skip=test_reading_deflate_encoding_large_random_rustls
cargo test --lib --tests -p=actix-web-codegen --all-features
cargo test --lib --tests -p=awc --all-features
cargo test --lib --tests -p=actix-http-test --all-features
cargo test --lib --tests -p=actix-test --all-features
cargo test --lib --tests -p=actix-files
cargo test --lib --tests -p=actix-multipart --all-features
cargo test --lib --tests -p=actix-web-actors --all-features
- name: CI cache clean - name: CI cache clean
run: cargo-ci-cache-clean run: cargo-ci-cache-clean
@ -97,21 +85,3 @@ jobs:
- name: check feature combinations - name: check feature combinations
run: cargo ci-check-all-feature-powerset-linux run: cargo ci-check-all-feature-powerset-linux
nextest:
name: nextest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
- name: Install nextest
uses: taiki-e/install-action@v2.33.16
with:
tool: nextest
- name: Test with cargo-nextest
run: cargo nextest run

View File

@ -16,7 +16,13 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
read_msrv:
name: Read MSRV
uses: actions-rust-lang/msrv/.github/workflows/msrv.yml@main
build_and_test: build_and_test:
needs: read_msrv
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -26,7 +32,7 @@ jobs:
- { name: macOS, os: macos-latest, triple: x86_64-apple-darwin } - { name: macOS, os: macos-latest, triple: x86_64-apple-darwin }
- { name: Windows, os: windows-latest, triple: x86_64-pc-windows-msvc } - { name: Windows, os: windows-latest, triple: x86_64-pc-windows-msvc }
version: version:
- { name: msrv, version: 1.72.0 } - { name: msrv, version: "${{ needs.read_msrv.outputs.msrv }}" }
- { name: stable, version: stable } - { name: stable, version: stable }
name: ${{ matrix.target.name }} / ${{ matrix.version.name }} name: ${{ matrix.target.name }} / ${{ matrix.version.name }}
@ -49,15 +55,14 @@ jobs:
with: with:
toolchain: ${{ matrix.version.version }} toolchain: ${{ matrix.version.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.16 uses: taiki-e/install-action@v2.33.16
with: with:
tool: cargo-hack,cargo-ci-cache-clean tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
- name: workaround MSRV issues - name: workaround MSRV issues
if: matrix.version.name == 'msrv' if: matrix.version.name == 'msrv'
run: | run: just downgrade-for-msrv
cargo update -p=clap --precise=4.4.18
- name: check minimal - name: check minimal
run: cargo ci-check-min run: cargo ci-check-min
@ -67,20 +72,7 @@ jobs:
- name: tests - name: tests
timeout-minutes: 60 timeout-minutes: 60
shell: bash run: just test
run: |
set -e
cargo test --lib --tests -p=actix-router --no-default-features
cargo test --lib --tests -p=actix-router --all-features
cargo test --lib --tests -p=actix-http --all-features
cargo test --lib --tests -p=actix-web --features=rustls-0_20,rustls-0_21,rustls-0_22,openssl -- --skip=test_reading_deflate_encoding_large_random_rustls
cargo test --lib --tests -p=actix-web-codegen --all-features
cargo test --lib --tests -p=awc --all-features
cargo test --lib --tests -p=actix-http-test --all-features
cargo test --lib --tests -p=actix-test --all-features
cargo test --lib --tests -p=actix-files
cargo test --lib --tests -p=actix-multipart --all-features
cargo test --lib --tests -p=actix-web-actors --all-features
- name: CI cache clean - name: CI cache clean
run: cargo-ci-cache-clean run: cargo-ci-cache-clean
@ -112,6 +104,10 @@ jobs:
with: with:
toolchain: nightly toolchain: nightly
- name: Install just
uses: taiki-e/install-action@v2.33.16
with:
tool: just
- name: doc tests - name: doc tests
run: cargo ci-doctest run: just test-docs
timeout-minutes: 60

View File

@ -15,6 +15,8 @@ members = [
] ]
[workspace.package] [workspace.package]
homepage = "https://actix.rs"
repository = "https://github.com/actix/actix-web"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
edition = "2021" edition = "2021"
rust-version = "1.72" rust-version = "1.72"

View File

@ -4,10 +4,11 @@ version = "0.6.1"
authors = ["Jacob Halsey <jacob@jhalsey.com>"] authors = ["Jacob Halsey <jacob@jhalsey.com>"]
description = "Multipart form derive macro for Actix Web" description = "Multipart form derive macro for Actix Web"
keywords = ["http", "web", "framework", "async", "futures"] keywords = ["http", "web", "framework", "async", "futures"]
homepage = "https://actix.rs" homepage.workspace = true
repository = "https://github.com/actix/actix-web" repository.workspace = true
license = "MIT OR Apache-2.0" license.workspace = true
edition = "2021" edition.workspace = true
rust-version.workspace = true
[package.metadata.docs.rs] [package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs"] rustdoc-args = ["--cfg", "docsrs"]

View File

@ -2,14 +2,15 @@
name = "actix-web-codegen" name = "actix-web-codegen"
version = "4.2.2" version = "4.2.2"
description = "Routing and runtime macros for Actix Web" description = "Routing and runtime macros for Actix Web"
homepage = "https://actix.rs"
repository = "https://github.com/actix/actix-web"
authors = [ authors = [
"Nikolay Kim <fafhrd91@gmail.com>", "Nikolay Kim <fafhrd91@gmail.com>",
"Rob Ede <robjtede@icloud.com>", "Rob Ede <robjtede@icloud.com>",
] ]
license = "MIT OR Apache-2.0" homepage.workspace = true
edition = "2021" repository.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
[lib] [lib]
proc-macro = true proc-macro = true

View File

@ -6,14 +6,57 @@ fmt:
cargo +nightly fmt cargo +nightly fmt
npx -y prettier --write $(fd --type=file --hidden --extension=md --extension=yml) npx -y prettier --write $(fd --type=file --hidden --extension=md --extension=yml)
# Downgrade dev-dependencies necessary to run MSRV checks/tests.
[private]
downgrade-for-msrv:
cargo update -p=clap --precise=4.4.18
msrv := ```
cargo metadata --format-version=1 \
| jq -r 'first(.packages[] | select(.source == null and .rust_version)) | .rust_version' \
| sed -E 's/^1\.([0-9]{2})$/1\.\1\.0/'
```
msrv_rustup := "+" + msrv
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,experimental-io-uring" \
'add | unique | . - ($exclusions | split(",")) | join(",")'
```
all_crate_features := if os() == "linux" {
"--all-features"
} else {
"--features='" + non_linux_all_features_list + "'"
}
# Test workspace using MSRV.
test-msrv: downgrade-for-msrv (test msrv_rustup)
# Test workspace code.
test toolchain="":
cargo {{ toolchain }} test --lib --tests -p=actix-web-codegen --all-features
cargo {{ toolchain }} test --lib --tests -p=actix-multipart-derive --all-features
cargo {{ toolchain }} nextest run -p=actix-router --no-default-features
cargo {{ toolchain }} nextest run --workspace --exclude=actix-web-codegen --exclude=actix-multipart-derive {{ all_crate_features }} --filter-expr="not test(test_reading_deflate_encoding_large_random_rustls)"
# 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 toolchain)
# 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,openssl --open @just doc --open
cargo watch -- RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc --no-deps --workspace --features=rustls,openssl cargo watch -- just doc
# Update READMEs from crate root documentation. # Update READMEs from crate root documentation.
update-readmes: && fmt update-readmes: && fmt