Skip to content

Commit 3adbca0

Browse files
MagicalTuxclaude
andcommitted
Add CI + release-plz workflows, switch to crates.io deps, badges, LICENSE
- Cargo.toml: depend on published purecrypto 0.6.25 / compcol 0.6.5 / rsurl 0.1.2 instead of local path deps, so the crate builds on CI and can publish. - .github/workflows/ci.yml: fmt + clippy(--all-features -D warnings) + test on Linux/macOS/Windows, a feature-combination build matrix, MSRV (1.88) check, and a docs build (mirrors purecrypto's CI, minus the no_std/C-ABI jobs). - .github/workflows/release-plz.yml: release-pr + release (publishes to crates.io) using the group-wide RELEASE_PLZ_TOKEN / CARGO_REGISTRY_TOKEN. - README: CI / crates.io / docs.rs / license badges. Add MIT LICENSE. - cargo fmt the tree (CI enforces --check); gate Response::from_parts dead-code warning to the compress feature. 53 tests pass; clippy clean across --all-features; fmt clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent d47a9f7 commit 3adbca0

31 files changed

Lines changed: 469 additions & 146 deletions

.github/workflows/ci.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
test:
16+
name: Test & lint (${{ matrix.os }})
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: [ubuntu-latest, windows-latest, macos-latest]
22+
steps:
23+
- uses: actions/checkout@v6
24+
25+
- name: Install Rust
26+
uses: dtolnay/rust-toolchain@stable
27+
with:
28+
components: rustfmt, clippy
29+
30+
- name: Cache
31+
uses: Swatinem/rust-cache@v2
32+
with:
33+
key: ${{ matrix.os }}
34+
35+
- name: Format
36+
if: runner.os == 'Linux' # formatting is platform-independent
37+
run: cargo fmt --all --check
38+
39+
- name: Clippy (all features, warnings denied)
40+
run: cargo clippy --all-targets --all-features -- -D warnings
41+
42+
- name: Test (all features)
43+
run: cargo test --all-features
44+
45+
features:
46+
name: Feature combinations
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v6
50+
51+
- name: Install Rust
52+
uses: dtolnay/rust-toolchain@stable
53+
54+
- name: Cache
55+
uses: Swatinem/rust-cache@v2
56+
with:
57+
key: features
58+
59+
# The sans-I/O core must build with no runtime / TLS / protocol features.
60+
- name: Core only (no default features)
61+
run: cargo build --no-default-features
62+
63+
- name: TLS + HTTP/1.1 only
64+
run: cargo build --no-default-features --features rt-threadpool,tls
65+
66+
- name: HTTP/2 (no HTTP/3)
67+
run: cargo build --no-default-features --features rt-threadpool,tls,h2
68+
69+
- name: ACME without HTTP/3
70+
run: cargo build --no-default-features --features cli,tls,acme
71+
72+
- name: tokio runtime
73+
run: cargo build --no-default-features --features rt-tokio,tls,h2
74+
75+
- name: mio runtime
76+
run: cargo build --no-default-features --features rt-mio,tls
77+
78+
- name: Everything
79+
run: cargo build --all-features
80+
81+
msrv:
82+
name: MSRV (Rust 1.88)
83+
runs-on: ubuntu-latest
84+
steps:
85+
- uses: actions/checkout@v6
86+
87+
# Keep this pin in sync with `rust-version` in Cargo.toml. The default
88+
# feature set (no tokio/mio/rsurl) is the surface we promise to build on
89+
# the declared minimum; compile-only (behavior is covered by `test`).
90+
- name: Install Rust 1.88 (declared MSRV)
91+
uses: dtolnay/rust-toolchain@1.88
92+
93+
- name: Cache
94+
uses: Swatinem/rust-cache@v2
95+
with:
96+
key: msrv
97+
98+
- name: cargo check (default features)
99+
run: cargo check --all-targets
100+
101+
docs:
102+
name: Docs build (warnings denied)
103+
runs-on: ubuntu-latest
104+
env:
105+
RUSTDOCFLAGS: -D warnings -D rustdoc::broken-intra-doc-links
106+
steps:
107+
- uses: actions/checkout@v6
108+
109+
- name: Install Rust
110+
uses: dtolnay/rust-toolchain@stable
111+
112+
- name: Cache
113+
uses: Swatinem/rust-cache@v2
114+
115+
- name: cargo doc --no-deps --all-features
116+
run: cargo doc --no-deps --all-features

.github/workflows/release-plz.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release-plz
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
permissions:
8+
# Open/update the release PR and create GitHub Releases.
9+
contents: write
10+
pull-requests: write
11+
12+
# Don't run two release-plz jobs in parallel.
13+
concurrency:
14+
group: release-plz-${{ github.ref }}
15+
cancel-in-progress: false
16+
17+
jobs:
18+
release-plz-release:
19+
name: Release-plz release
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v6
24+
with:
25+
fetch-depth: 0
26+
# release-plz pushes the version-bump commit / tag via git, so the PAT
27+
# must be persisted on the checkout — a tag pushed with the default
28+
# GITHUB_TOKEN cannot trigger other workflows.
29+
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
30+
31+
- name: Install Rust
32+
uses: dtolnay/rust-toolchain@stable
33+
34+
- name: Run release-plz
35+
uses: release-plz/action@v0.5
36+
with:
37+
command: release
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
40+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
41+
42+
release-plz-pr:
43+
name: Release-plz PR
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v6
48+
with:
49+
fetch-depth: 0
50+
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
51+
52+
- name: Install Rust
53+
uses: dtolnay/rust-toolchain@stable
54+
55+
- name: Run release-plz
56+
uses: release-plz/action@v0.5
57+
with:
58+
command: release-pr
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}

Cargo.lock

Lines changed: 9 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,17 @@ rt-mio = ["dep:mio"]
5252
[dependencies]
5353
# purecrypto's `tls` module pulls in DTLS/QUIC paths that are wired to the
5454
# default feature set, so we use its defaults rather than cherry-picking.
55-
purecrypto = { path = "../purecrypto", optional = true }
56-
compcol = { path = "../compcol", optional = true, default-features = false, features = ["std", "gzip", "deflate", "zlib"] }
55+
purecrypto = { version = "0.6.25", optional = true }
56+
compcol = { version = "0.6.5", optional = true, default-features = false, features = ["std", "gzip", "deflate", "zlib"] }
5757
serde = { version = "1", optional = true, features = ["derive"] }
5858
toml = { version = "0.8", optional = true }
5959
tokio = { version = "1", optional = true, features = ["rt", "rt-multi-thread", "net", "io-util", "macros"] }
6060
mio = { version = "1", optional = true, features = ["os-poll", "net"] }
61-
rsurl = { path = "../rsurl", optional = true }
61+
rsurl = { version = "0.1.2", optional = true }
6262

6363
[dev-dependencies]
64-
purecrypto = { path = "../purecrypto" }
65-
compcol = { path = "../compcol", default-features = false, features = ["std", "gzip"] }
64+
purecrypto = "0.6.25"
65+
compcol = { version = "0.6.5", default-features = false, features = ["std", "gzip"] }
6666

6767
[package.metadata.docs.rs]
6868
all-features = true

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Karpelès Lab Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# httpsd
22

3+
[![CI](https://github.com/KarpelesLab/httpsd/actions/workflows/ci.yml/badge.svg)](https://github.com/KarpelesLab/httpsd/actions/workflows/ci.yml)
4+
[![crates.io](https://img.shields.io/crates/v/httpsd.svg)](https://crates.io/crates/httpsd)
5+
[![docs.rs](https://img.shields.io/docsrs/httpsd)](https://docs.rs/httpsd)
6+
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
7+
38
A pure-Rust HTTP server (HTTP/1.1, HTTP/2, and HTTP/3) with a **sans-I/O core**
49
and **pluggable runtimes**.
510

src/acme/client.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use purecrypto::ec::{BoxedEcdsaPrivateKey, CurveId};
1212
use purecrypto::x509::{CertSigner, CertificationRequest, DistinguishedName};
1313
use rsurl::Request;
1414

15-
use super::jose::{b64url, AccountKey, KeyId};
15+
use super::jose::{AccountKey, KeyId, b64url};
1616
use super::json::{self, Value};
1717
use crate::error::{Error, Result};
1818

@@ -62,7 +62,11 @@ impl AcmeClient {
6262
/// `email` for the `contact` field (optional). The caller is responsible for
6363
/// having obtained ToS agreement from the operator before calling
6464
/// [`ensure_account`](Self::ensure_account).
65-
pub fn new(directory_url: &str, account: AccountKey, email: Option<String>) -> Result<AcmeClient> {
65+
pub fn new(
66+
directory_url: &str,
67+
account: AccountKey,
68+
email: Option<String>,
69+
) -> Result<AcmeClient> {
6670
let resp = http_get(directory_url)?;
6771
let doc = parse_json(&resp.body)?;
6872
let dir = Directory {
@@ -387,7 +391,9 @@ mod tests {
387391
fn bad_nonce_detection() {
388392
let body = br#"{"type":"urn:ietf:params:acme:error:badNonce","detail":"bad"}"#;
389393
assert!(is_bad_nonce(body));
390-
assert!(!is_bad_nonce(br#"{"type":"urn:ietf:params:acme:error:malformed"}"#));
394+
assert!(!is_bad_nonce(
395+
br#"{"type":"urn:ietf:params:acme:error:malformed"}"#
396+
));
391397
}
392398

393399
#[test]

src/acme/jose.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! ES256 (ECDSA P-256 / SHA-256) JWS signing (RFC 7515/7518/7638, RFC 8555 §6.2).
33
44
use purecrypto::ec::{BoxedEcdsaPrivateKey, CurveId};
5-
use purecrypto::hash::{sha256, Sha256};
5+
use purecrypto::hash::{Sha256, sha256};
66

77
use super::json;
88
use crate::error::{Error, Result};
@@ -175,7 +175,9 @@ mod tests {
175175
assert_eq!(ph.get("jwk").unwrap().str_at("crv"), Some("P-256"));
176176

177177
// POST-as-GET uses an empty payload.
178-
let g = k.sign("https://acme.test/y", "n2", &KeyId::Kid("acc".into()), "").unwrap();
178+
let g = k
179+
.sign("https://acme.test/y", "n2", &KeyId::Kid("acc".into()), "")
180+
.unwrap();
179181
assert_eq!(json::parse(&g).unwrap().str_at("payload"), Some(""));
180182
}
181183

src/acme/json.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,10 @@ mod tests {
259259
let v = parse(r#"{"a":1,"b":[true,null,"x"],"c":{"d":"e"}}"#).unwrap();
260260
assert_eq!(v.get("c").unwrap().str_at("d"), Some("e"));
261261
assert_eq!(v.get("b").unwrap().as_array().unwrap().len(), 3);
262-
assert_eq!(v.get("b").unwrap().as_array().unwrap()[2].as_str(), Some("x"));
262+
assert_eq!(
263+
v.get("b").unwrap().as_array().unwrap()[2].as_str(),
264+
Some("x")
265+
);
263266
assert_eq!(v.get("a"), Some(&Value::Num(1.0)));
264267
}
265268

0 commit comments

Comments
 (0)