ttfb 1.15.0

Library + CLI utility to measure the TTFB (time to first byte) of HTTP(S) requests. This includes data of intermediate steps, such as the relative and absolute timings of DNS lookup, TCP connect, and TLS handshake.
Documentation
name: Build

on:
  merge_group:
  pull_request:
  push:

env:
  CARGO_TERM_COLOR: always

jobs:
  build_binary:
    strategy:
      fail-fast: false
      matrix:
        runs-on: [ macos-latest, ubuntu-latest, windows-latest ]
        # Specific version: MSVR of the CLI binary
        rust: [ 1.85.0, stable, nightly ]
    runs-on: ${{ matrix.runs-on }}
    steps:
      - uses: actions/checkout@v4
      - name: Setup Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: ${{ matrix.rust }}
      - uses: Swatinem/rust-cache@v2
        with:
          key: "${{ matrix.runs-on }}-${{ matrix.rust }}"
      - name: cargo check (debug)
        run: cargo check --all-targets --features bin --verbose
      - name: cargo check (release)
        run: cargo check --all-targets --features bin --verbose --release
      - name: cargo build (debug)
        run: cargo build --all-targets --features bin --verbose
      - name: cargo build (release)
        run: cargo build --all-targets --features bin --verbose --release
      # The next step will be cached by the CI cache.
      - name: Install cargo-nextest
        run: which cargo-nextest || cargo +stable install cargo-nextest
      - run: cargo nextest run --verbose
      # Test that we don't segfault or so because of the LTO.
      - name: "CLI [release]: ttfb --help"
        run: cargo run --release --features bin -- --help
      - name: "CLI [release]: ttfb github.com"
        run: cargo run --release --features bin -- github.com

  # The lib is already transitively build above. Here, we only verify the MSRV.
  # The rust toolchain comes from `rust-toolchain.toml`.
  build_library_msrv:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Build Lib as Dependency with MSRV
        run: cd ttfb-lib-msrv-check && cargo check --all-targets --verbose

  tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Setup Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
      - uses: Swatinem/rust-cache@v2
      - name: Build
        run: cargo test --all-targets --verbose

  network_tests:
    runs-on: ubuntu-latest
    env:
      RUSTFLAGS: --cfg network_tests
    steps:
      - uses: actions/checkout@v4
      - name: Setup Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
      - uses: Swatinem/rust-cache@v2
      - name: Run tests
        run: cargo test --verbose

  style_checks:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Setup Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
          components: clippy, rustfmt
      - uses: Swatinem/rust-cache@v2
      - run: cargo fmt -- --check
      - run: cargo clippy --all-targets
      - run: cargo doc --document-private-items --no-deps