Skip to content

Justfile for running test matrix locally? #106

@praveenperera

Description

@praveenperera

@ValuedMammal We've had a lot of back and forth on this PR: #103, mostly because I only ran cargo test and missed tests in the matrix, was wondering if you what you think about adding a justfile so anyone contributing could run the tests locally before doing a PR. If you want I can make the PR, it would look mostly like this.

# Default recipe shows available commands
default:
    @just --list

# Set default values
rust_version := "stable"
feature := "default"

# Build with specific Rust version and feature
build VERSION=rust_version FEAT=feature:
    @echo "Building with Rust {{VERSION}} and feature {{FEAT}}"
    cargo build --features {{FEAT}} --no-default-features

# Test with specific Rust version and feature
test VERSION=rust_version FEAT=feature:
    @echo "Testing with Rust {{VERSION}} and feature {{FEAT}}"
    cargo test --features {{FEAT}} --no-default-features -- --test-threads=1

# Switch Rust version
switch-rust VERSION:
    rustup default {{VERSION}}
    rustup set profile minimal
    rustup update

# Pin dependencies for MSRV 1.63.0
pin-msrv:
    cargo update -p zstd-sys --precise "2.0.8+zstd.1.5.5"
    cargo update -p time --precise "0.3.20"
    cargo update -p home --precise 0.5.5
    cargo update -p url --precise "2.5.0"
    cargo update -p tokio --precise "1.38.1"
    cargo update -p tokio-util --precise "0.7.11"

# Run full test matrix
test-matrix: 
    just test-stable
    just test-msrv

# Test all features on stable Rust
test-stable:
    #!/usr/bin/env bash
    features=(
        "default"
        "blocking"
        "blocking-https"
        "blocking-https-rustls"
        "blocking-https-native"
        "blocking-https-bundled"
        "async"
        "async-https"
        "async-https-native"
        "async-https-rustls"
        "async-https-rustls-manual-roots"
    )

    just switch-rust stable
    for feature in "${features[@]}"; do
        just test stable "$feature"
    done

# Test all features on MSRV (1.63.0)
test-msrv:
    #!/usr/bin/env bash
    features=(
        "default"
        "blocking"
        "blocking-https"
        "blocking-https-rustls"
        "blocking-https-native"
        "blocking-https-bundled"
        "async"
        "async-https"
        "async-https-native"
        "async-https-rustls"
        "async-https-rustls-manual-roots"
    )

    just switch-rust 1.63.0
    just pin-msrv
    for feature in "${features[@]}"; do
        just test 1.63.0 "$feature"
    done

# Clean build artifacts
clean:
    cargo clean

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions