rsurl 0.0.4

A pure-Rust implementation of curl. Library, C FFI, and CLI for HTTP/HTTPS/FTP/FTPS.
Documentation
name: CI

on:
  push:
    branches: [master]
  pull_request:

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Test & lint (${{ matrix.os }}, ${{ matrix.backend.name }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        # Two TLS backends ship in the crate (purecrypto-tls is the default,
        # rustls-tls is opt-in). Build & test both on every PR so neither
        # rots. The flags are stored on the matrix entry to keep the steps
        # below shell-portable across Linux/macOS/Windows runners.
        backend:
          - name: default
            flags: --all-features
          - name: rustls
            flags: --no-default-features --features rustls-tls
    steps:
      - uses: actions/checkout@v6

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy

      - name: Cache
        uses: Swatinem/rust-cache@v2
        with:
          key: ${{ matrix.os }}-${{ matrix.backend.name }}

      - name: Format
        # Formatting is platform- and backend-independent; only run it once.
        if: runner.os == 'Linux' && matrix.backend.name == 'default'
        run: cargo fmt --all --check

      - name: Clippy (warnings denied)
        run: cargo clippy --all-targets ${{ matrix.backend.flags }} -- -D warnings

      - name: Test (release)
        # `--release` so the integration tests in tests/ (which spin up a
        # local HTTP/1.1 server and round-trip real bytes through rsurl)
        # exercise the same code paths CI ships. The unit tests are cheap
        # enough that running them in release adds no meaningful time.
        run: cargo test --release ${{ matrix.backend.flags }}

  c_abi:
    name: C ABI smoke test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Cache
        uses: Swatinem/rust-cache@v2

      - name: Build the C library (static + shared)
        # Cargo.toml declares crate-type = ["rlib", "cdylib", "staticlib"],
        # so a plain release build produces librsurl.a and librsurl.so.
        run: cargo build --release

      - name: Compile and run the C smoke test (static link)
        run: |
          cc tests/ffi_smoke.c -I include target/release/librsurl.a \
             -lpthread -ldl -lm -o ffi_smoke_static
          ./ffi_smoke_static

      - name: Compile and run the C smoke test (shared link)
        # Same source, linked against the cdylib instead of the staticlib.
        # LD_LIBRARY_PATH points the loader at target/release so the
        # binary can find librsurl.so at run time without installing it.
        run: |
          cc tests/ffi_smoke.c -I include \
             -L target/release -lrsurl \
             -o ffi_smoke_shared
          LD_LIBRARY_PATH=target/release ./ffi_smoke_shared

  docs:
    name: Docs build (warnings denied)
    runs-on: ubuntu-latest
    env:
      RUSTDOCFLAGS: -D warnings -D rustdoc::broken-intra-doc-links
    steps:
      - uses: actions/checkout@v6

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Cache
        uses: Swatinem/rust-cache@v2

      - name: cargo doc --no-deps --all-features
        run: cargo doc --no-deps --all-features