Skip to content

Commit f10d71e

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 12a865d + 546e821 commit f10d71e

328 files changed

Lines changed: 129721 additions & 36136 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitattributes‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/test/www*/dir/*.html text eol=lf
2+
/test/www*/dir/*.txt text eol=lf

‎.github/workflows/abidiff.yaml‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# SPDX-FileCopyrightText: 2025 Andrea Pappacoda <andrea@pappacoda.it>
2+
# SPDX-License-Identifier: MIT
3+
4+
name: abidiff
5+
6+
on: [push, pull_request]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
10+
cancel-in-progress: true
11+
12+
defaults:
13+
run:
14+
shell: sh
15+
16+
jobs:
17+
abi:
18+
runs-on: ubuntu-latest
19+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
20+
container:
21+
image: debian:testing
22+
23+
steps:
24+
- name: Install dependencies
25+
run: apt -y --update install --no-install-recommends
26+
abigail-tools
27+
ca-certificates
28+
g++
29+
git
30+
libbrotli-dev
31+
libssl-dev
32+
libzstd-dev
33+
meson
34+
pkg-config
35+
python3
36+
zlib1g-dev
37+
38+
- uses: actions/checkout@v4
39+
with:
40+
path: current
41+
42+
- uses: actions/checkout@v4
43+
with:
44+
path: previous
45+
fetch-depth: 0
46+
47+
- name: Checkout previous
48+
working-directory: previous
49+
run: |
50+
git switch master
51+
git describe --tags --abbrev=0 master | xargs git checkout
52+
53+
- name: Build current
54+
working-directory: current
55+
run: |
56+
meson setup --buildtype=debug -Dcpp-httplib_compile=true build
57+
ninja -C build
58+
59+
- name: Build previous
60+
working-directory: previous
61+
run: |
62+
meson setup --buildtype=debug -Dcpp-httplib_compile=true build
63+
ninja -C build
64+
65+
- name: Run abidiff
66+
run: abidiff
67+
--headers-dir1 previous/build
68+
--headers-dir2 current/build
69+
previous/build/libcpp-httplib.so
70+
current/build/libcpp-httplib.so
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: benchmark-ab
2+
3+
# Manual A/B throughput comparison between two refs.
4+
#
5+
# This is a measurement, not a test: it never fails the build on a slow result.
6+
# Absolute req/s from a shared runner is meaningless on its own, so both refs
7+
# are built and measured alternately in the same job and only the ratio of the
8+
# medians is reported, with a permutation test to say whether the difference
9+
# stands out from the run-to-run noise.
10+
#
11+
# Non-SSL and Linux only for now.
12+
13+
on:
14+
workflow_dispatch:
15+
inputs:
16+
base:
17+
description: "Baseline ref"
18+
required: false
19+
default: "origin/master"
20+
head:
21+
description: "Ref to compare (defaults to the ref this run was started on)"
22+
required: false
23+
default: ""
24+
rounds:
25+
description: "Measurement rounds per ref (9+ recommended; below 4 the test can never reach significance)"
26+
required: false
27+
default: "9"
28+
duration:
29+
description: "Load duration per measurement"
30+
required: false
31+
default: "5s"
32+
connections:
33+
description: "Concurrent connections"
34+
required: false
35+
default: "10"
36+
37+
permissions:
38+
contents: read
39+
40+
jobs:
41+
ubuntu:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: checkout
45+
uses: actions/checkout@v4
46+
with:
47+
fetch-depth: 0
48+
49+
- name: install bombardier
50+
run: go install github.com/codesenberg/bombardier@latest
51+
52+
- name: run A/B benchmark
53+
run: |
54+
export PATH="$(go env GOPATH)/bin:$PATH"
55+
HEAD_REF="${{ inputs.head }}"
56+
if [ -z "$HEAD_REF" ]; then HEAD_REF="${{ github.sha }}"; fi
57+
./benchmark/ab.sh \
58+
--base "${{ inputs.base }}" \
59+
--head "$HEAD_REF" \
60+
--rounds "${{ inputs.rounds }}" \
61+
--duration "${{ inputs.duration }}" \
62+
--connections "${{ inputs.connections }}"
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: benchmark-run
2+
3+
# Runs the committed benchmark (`just bench`) and records the numbers.
4+
#
5+
# This is a measurement, not a test: nothing here fails the build. Unlike
6+
# benchmark-ab, which compares two refs inside one job, this just reports the
7+
# absolute throughput of the current ref alongside Crow for reference.
8+
#
9+
# Absolute req/s is only meaningful against other runs on the same runner type,
10+
# so compare like with like when reading the history.
11+
#
12+
# Non-SSL only. Windows is excluded: benchmark/Makefile depends on `nc`, `&`
13+
# and `kill`, so it would need a PowerShell rewrite first.
14+
15+
on:
16+
workflow_dispatch:
17+
inputs:
18+
duration:
19+
description: "Load duration per server"
20+
required: false
21+
default: "5s"
22+
connections:
23+
description: "Concurrent connections"
24+
required: false
25+
default: "10"
26+
crow:
27+
description: "Also benchmark Crow v1.3.1 for reference"
28+
type: boolean
29+
required: false
30+
default: true
31+
32+
permissions:
33+
contents: read
34+
35+
jobs:
36+
bench:
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
os: [ubuntu-latest, macos-latest]
41+
runs-on: ${{ matrix.os }}
42+
steps:
43+
- name: checkout
44+
uses: actions/checkout@v4
45+
46+
# macos runners ship without Go.
47+
- name: setup Go
48+
uses: actions/setup-go@v5
49+
with:
50+
go-version: stable
51+
52+
- name: install bombardier
53+
run: go install github.com/codesenberg/bombardier@latest
54+
55+
# crow_all.h includes <asio.hpp>, which no runner has out of the box.
56+
- name: install asio
57+
if: ${{ inputs.crow }}
58+
run: |
59+
if [ "$RUNNER_OS" = "Linux" ]; then
60+
sudo apt-get update && sudo apt-get install -y libasio-dev
61+
else
62+
brew install asio
63+
fi
64+
65+
- name: run benchmark
66+
run: |
67+
# Without pipefail the `tee` below swallows a build failure and the
68+
# job reports success having measured nothing.
69+
set -o pipefail
70+
export PATH="$(go env GOPATH)/bin:$PATH"
71+
CROW_FLAGS="-std=c++17"
72+
if [ "$RUNNER_OS" = "macOS" ]; then
73+
CROW_FLAGS="$CROW_FLAGS -I$(brew --prefix asio)/include"
74+
fi
75+
if [ "${{ inputs.crow }}" = "true" ]; then TARGET=bench-all; else TARGET=bench; fi
76+
make -C benchmark "$TARGET" \
77+
CROW_CXXFLAGS="$CROW_FLAGS" \
78+
BENCH="bombardier -c ${{ inputs.connections }} -d ${{ inputs.duration }} localhost:8080" \
79+
2>&1 | tee /tmp/bench.txt
80+
81+
# pipefail only catches a failed build. Each Makefile recipe ends in
82+
# `kill`, so a bombardier that never ran still leaves make happy — check
83+
# that the measurements are actually there.
84+
- name: check results were produced
85+
run: |
86+
expected=1
87+
if [ "${{ inputs.crow }}" = "true" ]; then expected=2; fi
88+
got=$(grep -c "Reqs/sec" /tmp/bench.txt || true)
89+
if [ "$got" -lt "$expected" ]; then
90+
echo "::error::expected $expected benchmark result(s), found $got"
91+
exit 1
92+
fi
93+
94+
- name: record results
95+
if: always()
96+
run: |
97+
{
98+
echo "## Benchmark (${{ matrix.os }})"
99+
echo ""
100+
echo "- ref: \`${{ github.ref_name }}\` (${{ github.sha }})"
101+
echo "- connections=${{ inputs.connections }} duration=${{ inputs.duration }}"
102+
echo ""
103+
echo '```'
104+
cat /tmp/bench.txt
105+
echo '```'
106+
} >> "$GITHUB_STEP_SUMMARY"

‎.github/workflows/cifuzz.yaml‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
name: CIFuzz
2-
on: [pull_request]
2+
3+
# The fuzzers only build httplib.h and the targets under test/fuzzing, so a
4+
# pull request that touches neither has nothing for CIFuzz to exercise. Fuzzing
5+
# is by far the longest job in CI (10 minutes of fuzzing on top of building the
6+
# OSS-Fuzz image), and skipping it for documentation-only changes keeps the
7+
# full 600 seconds for the pull requests that do reach the parsers.
8+
on:
9+
pull_request:
10+
paths:
11+
- 'httplib.h'
12+
- 'test/fuzzing/**'
13+
- '.github/workflows/cifuzz.yaml'
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
17+
cancel-in-progress: true
18+
319
jobs:
420
Fuzzing:
521
runs-on: ubuntu-latest
@@ -19,7 +35,7 @@ jobs:
1935
dry-run: false
2036
language: c++
2137
- name: Upload Crash
22-
uses: actions/upload-artifact@v1
38+
uses: actions/upload-artifact@v4
2339
if: failure() && steps.build.outcome == 'success'
2440
with:
2541
name: artifacts

‎.github/workflows/docs.yml‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: docs
2+
on:
3+
push:
4+
branches: [master]
5+
paths:
6+
- 'docs-src/**'
7+
workflow_dispatch:
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
jobs:
16+
deploy:
17+
runs-on: ubuntu-latest
18+
environment:
19+
name: github-pages
20+
url: ${{ steps.deployment.outputs.page_url }}
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
# Full history so sitemap <lastmod> reflects each page's real last commit date
25+
fetch-depth: 0
26+
- uses: dtolnay/rust-toolchain@stable
27+
- uses: Swatinem/rust-cache@v2
28+
- name: Install docs-gen
29+
run: cargo install docs-gen
30+
- name: Build
31+
run: docs-gen build docs-src docs
32+
- uses: actions/configure-pages@v5
33+
- uses: actions/upload-pages-artifact@v3
34+
with:
35+
path: docs
36+
- id: deployment
37+
uses: actions/deploy-pages@v4
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Release Docker Image
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0 # Fetch all history and tags
16+
17+
- name: Extract tag (manual)
18+
if: github.event_name == 'workflow_dispatch'
19+
id: set_tag_manual
20+
run: |
21+
# Checkout the latest tag and set output
22+
git fetch --tags
23+
LATEST_TAG=$(git describe --tags --abbrev=0)
24+
git checkout $LATEST_TAG
25+
echo "tag=${LATEST_TAG#v}" >> $GITHUB_OUTPUT
26+
27+
- name: Extract tag (release)
28+
if: github.event_name == 'release'
29+
id: set_tag_release
30+
run: echo "tag=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
31+
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v3
34+
35+
- name: Log in to Docker Hub
36+
uses: docker/login-action@v3
37+
with:
38+
username: ${{ secrets.DOCKERHUB_USERNAME }}
39+
password: ${{ secrets.DOCKERHUB_TOKEN }}
40+
41+
- name: Build and push Docker image
42+
uses: docker/build-push-action@v5
43+
with:
44+
context: .
45+
file: ./Dockerfile
46+
push: true
47+
platforms: linux/amd64,linux/arm64 # Build for both amd64 and arm64
48+
# Use extracted tag without leading 'v'
49+
tags: |
50+
yhirose4dockerhub/cpp-httplib-server:latest
51+
yhirose4dockerhub/cpp-httplib-server:${{ steps.set_tag_manual.outputs.tag || steps.set_tag_release.outputs.tag }}

0 commit comments

Comments
 (0)