1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: CI
on:
push:
branches:
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:
# 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
# HTTP-only: no SSH, no BitTorrent (so no `puressh` dependency) — the
# minimal surface an HTTP source driver builds against. Guards the
# feature gating so an ungated `ssh`/`bittorrent` reference can't
# sneak back in unnoticed.
- name: http-only
flags: --no-default-features --features purecrypto-tls,idn
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