Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
* text=auto eol=lf
# The bytes as Chrome sent them, with CRLF and binary bodies.
/tests/Fixtures/chrome/*.req -text

/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/composer.lock export-ignore
/CONTRIBUTING.md export-ignore
/CODE_OF_CONDUCT.md export-ignore
/demo export-ignore
/phpstan.neon export-ignore
/phpunit.xml export-ignore
/pint.json export-ignore
/rector.php export-ignore
/tests export-ignore
/type-coverage.xml export-ignore
/works-with export-ignore
37 changes: 37 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: 2

# Each update waits 14 days after its release, so a broken or taken-over release is found by others
# first. No Composer: the lock serves only the test tools, and the newest job takes their updates.
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
cooldown:
default-days: 14
groups:
actions:
patterns: ['*']

# The images the jobs of Alpine, Debian and the workflows run in, and the image of the demo.
- package-ecosystem: docker
directories:
- /demo
- /.github/docker/actionlint
- /.github/docker/alpine
- /.github/docker/debian
- /.github/docker/zizmor
schedule:
interval: monthly
cooldown:
default-days: 14
groups:
images:
patterns: ['*']
# Debian runs the lowest PHP the package requires; only its patches are updates.
ignore:
- dependency-name: php
update-types: [version-update:semver-major, version-update:semver-minor]
# Go is the version of tests/Fixtures/go-net-http/go/VERSION; only its digest is an update.
- dependency-name: golang
update-types: [version-update:semver-major, version-update:semver-minor, version-update:semver-patch]
3 changes: 3 additions & 0 deletions .github/docker/actionlint/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# actionlint, which checks the syntax and the expressions of the workflows. A Dockerfile, so
# Dependabot updates the digest.
FROM rhysd/actionlint:1.7.12@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667
12 changes: 12 additions & 0 deletions .github/docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Alpine, on musl, with PHP and Composer, pcntl for the test of a signal in `stream_select()`,
# sockets for the test of a reset before the accept, and the Go of the reference of GoNetHttpTest.
# A Dockerfile, so Dependabot updates the digests.
FROM golang:1.27.4-alpine@sha256:70bd7ddea8b6cbe5d6943cde279d6b67feb10cc924fb9100d1d8757c1575b280 AS go

FROM composer:2.10.3@sha256:b6dcd72ca98fa19d0e5b8476de179859704891fad06dd9e0b96833d4c430a5fc

COPY --from=go /usr/local/go /usr/local/go
ENV PATH=/usr/local/go/bin:$PATH

RUN apk add --no-cache linux-headers > /dev/null \
&& docker-php-ext-install pcntl sockets > /dev/null
17 changes: 17 additions & 0 deletions .github/docker/debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Debian, on glibc, with the lowest PHP the package requires, pcntl for the test of a signal in
# `stream_select()`, sockets for the test of a reset before the accept, and the Go of the reference
# of GoNetHttpTest. A Dockerfile, so Dependabot updates the digests.
FROM composer:2.10.3@sha256:b6dcd72ca98fa19d0e5b8476de179859704891fad06dd9e0b96833d4c430a5fc AS composer

FROM golang:1.27.4@sha256:205c7636d74e0ffbe3d007162df7d74f859f5a8c8322dfb9f907977686c126cf AS go

FROM php:8.4.23-cli@sha256:3a70cc45c4b03b691f04ea3c032030613a5ff6ee61053127aadb8a93b39cc7c3

COPY --from=composer /usr/bin/composer /usr/local/bin/composer
COPY --from=go /usr/local/go /usr/local/go
ENV PATH=/usr/local/go/bin:$PATH

RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends unzip > /dev/null \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-install pcntl sockets > /dev/null
2 changes: 2 additions & 0 deletions .github/docker/zizmor/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# zizmor, which audits the workflows. A Dockerfile, so Dependabot updates the digest.
FROM ghcr.io/zizmorcore/zizmor:1.30.1@sha256:a2eb396d886c053073405c7a980f2139ba2248ec172243cfa3841e57196e8101
53 changes: 53 additions & 0 deletions .github/workflows/caddy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: caddy

# Against the newest releases of Caddy and FrankenPHP: composer check:caddy. A difference fails the
# job. The weekly job of frankenphp.yml tests the newest FrankenPHP, with its Caddy.

on:
schedule:
- cron: '41 5 * * 1'
workflow_dispatch:
push:
branches: [main]
paths:
- tests/Fixtures/caddy/**
- tests/Caddy/**
- tests/Upstream.php
- composer.json
- .github/workflows/caddy.yml
pull_request:
paths:
- tests/Fixtures/caddy/**
- tests/Caddy/**
- tests/Upstream.php
- composer.json
- .github/workflows/caddy.yml

permissions:
contents: read

jobs:
caddy:
name: Newest Caddy
runs-on: ubuntu-24.04
timeout-minutes: 30

steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Setup PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: '8.5'
extensions: sockets
coverage: none
tools: composer:2.10.3@sha256:7a2d379d5b8ffdaa028580ef26494c36d2feef4b178d3dd1473a4dbc5e17c8d6

- name: Install dependencies
run: composer install --no-interaction --prefer-dist

- name: Compare with caddy.lock and frankenphp.lock
run: composer check:caddy
79 changes: 79 additions & 0 deletions .github/workflows/frankenphp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Latest FrankenPHP

# Against the newest release of FrankenPHP: composer check:frankenphp, then each suite with the
# binary it loads, because each suite that compares answers compares them with FrankenPHP. Each
# step runs; a difference fails the job.

on:
schedule:
- cron: '53 5 * * 1'
workflow_dispatch:
push:
branches: [main]
paths:
- tests/Fixtures/frankenphp/**
- tests/Fixtures/caddy/**
- tests/FrankenPhp/**
- tests/Pest.php
- src/Internal/Php.php
- src/Internal/Caddy.php
- tests/Upstream.php
- composer.json
- .github/workflows/frankenphp.yml
pull_request:
paths:
- tests/Fixtures/frankenphp/**
- tests/Fixtures/caddy/**
- tests/FrankenPhp/**
- tests/Pest.php
- src/Internal/Php.php
- src/Internal/Caddy.php
- tests/Upstream.php
- composer.json
- .github/workflows/frankenphp.yml

permissions:
contents: read

jobs:
frankenphp:
name: Newest FrankenPHP
runs-on: ubuntu-24.04
timeout-minutes: 30

steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Setup PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: '8.5'
extensions: sockets
coverage: none
tools: composer:2.10.3@sha256:7a2d379d5b8ffdaa028580ef26494c36d2feef4b178d3dd1473a4dbc5e17c8d6

# The Go of the reference of the parser test.
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: tests/GoNetHttp/go.mod
cache: false

- name: Install dependencies
run: composer install --no-interaction --prefer-dist

# The token only raises the limit of the API of GitHub; the check needs none.
- name: Compare with release.lock, frankenphp.lock and php-src.lock
id: newest
env:
GITHUB_TOKEN: ${{ github.token }}
run: composer check:frankenphp

- name: Test with that FrankenPHP
if: ${{ !cancelled() && steps.newest.outputs.binary != '' }}
env:
FRANKENPHP_BINARY: ${{ steps.newest.outputs.binary }}
run: vendor/bin/pest --exclude-group=pins
91 changes: 91 additions & 0 deletions .github/workflows/go-net-http.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Go net/http of FrankenPHP

# Against the Go of the FrankenPHP of release.lock: composer check:go, then GoNetHttpTest with that
# Go for the parser and more mutated requests. The answers come from that FrankenPHP. Each step
# runs; a difference in one fails the job.

on:
schedule:
- cron: '23 5 * * 1'
workflow_dispatch:
push:
branches: [main]
paths:
- tests/Fixtures/go-net-http/**
- tests/Fixtures/frankenphp/release.lock
- tests/GoNetHttp/**
- tests/FrankenPhp/**
- tests/Pest.php
- tests/Upstream.php
- composer.json
- .github/workflows/go-net-http.yml
pull_request:
paths:
- tests/Fixtures/go-net-http/**
- tests/Fixtures/frankenphp/release.lock
- tests/GoNetHttp/**
- tests/FrankenPhp/**
- tests/Pest.php
- tests/Upstream.php
- composer.json
- .github/workflows/go-net-http.yml

permissions:
contents: read

jobs:
go:
name: Go of FrankenPHP
runs-on: ubuntu-24.04
# Each mutated request with limits of its own starts a FrankenPHP for them.
timeout-minutes: 60

steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Setup PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: '8.5'
extensions: sockets
coverage: none
tools: composer:2.10.3@sha256:7a2d379d5b8ffdaa028580ef26494c36d2feef4b178d3dd1473a4dbc5e17c8d6

- name: Install dependencies
run: composer install --no-interaction --prefer-dist

# The binary is about 200 MB; without the cache each run loads it again.
- name: Cache FrankenPHP
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 # zizmor: ignore[cache-poisoning]
with:
path: .frankenphp
key: frankenphp-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('tests/Fixtures/frankenphp/release.lock') }}

- name: Install FrankenPHP
env:
GITHUB_TOKEN: ${{ github.token }}
run: composer frankenphp:install

- name: Compare with go.lock
id: compare
run: composer check:go

- name: Setup that Go
id: setup
if: ${{ !cancelled() && steps.compare.outputs.version != '' }}
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ steps.compare.outputs.version }}
cache: false

# GoReference runs only the Go that VERSION names.
- name: Test with that Go
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
env:
GO_NET_HTTP_FUZZ: '20000'
run: |
go env GOVERSION > tests/Fixtures/go-net-http/go/VERSION
vendor/bin/pest --testsuite=GoNetHttp --exclude-group=pins
76 changes: 76 additions & 0 deletions .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: mutation

# A run of all of src/ takes about 3.3 hours on one core, so it runs each week and on request, not
# on each push, and four jobs take a part of src/ each.
# Composer, pinned by digest in `tools`, is updated by hand; Dependabot updates the actions.
on:
schedule:
- cron: '17 4 * * 1'
workflow_dispatch:

permissions:
contents: read

jobs:
mutation:
name: Mutation · ${{ matrix.part }}
runs-on: ubuntu-24.04
timeout-minutes: 180

# The parts have about the same number of mutants, and each had 99.6 % or more on 2026-11-06.
# The last part is the rest of src/, so a new file goes there. Its ignore lists the other files.
strategy:
fail-fast: false
matrix:
include:
- part: Answer, Connection
path: src/Internal/Answer.php,src/Internal/Connection.php
- part: Php, BodyReader, ReadBuffer
path: src/Internal/Php.php,src/Internal/BodyReader.php,src/Internal/ReadBuffer.php
- part: Exchange, Server, Sniff
path: src/Internal/Exchange.php,src/Server.php,src/Internal/Sniff.php
- part: rest
path: src
ignore: src/Internal/Answer.php,src/Internal/Connection.php,src/Internal/Php.php,src/Internal/BodyReader.php,src/Internal/ReadBuffer.php,src/Internal/Exchange.php,src/Server.php,src/Internal/Sniff.php

steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Setup PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: '8.5'
extensions: sockets
coverage: pcov
tools: composer:2.10.3@sha256:7a2d379d5b8ffdaa028580ef26494c36d2feef4b178d3dd1473a4dbc5e17c8d6

# The Go of the reference of GoNetHttpTest.
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: tests/GoNetHttp/go.mod
cache: false

- name: Install dependencies
run: composer install --no-interaction --prefer-dist

- name: Cache FrankenPHP
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 # zizmor: ignore[cache-poisoning]
with:
path: .frankenphp
key: frankenphp-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('tests/Fixtures/frankenphp/release.lock') }}

- name: Install FrankenPHP
env:
GITHUB_TOKEN: ${{ github.token }}
run: composer frankenphp:install

# Serial: with --parallel, Pest Mutate counts each mutant as killed.
- name: Mutation
env:
MUTATE_PATH: ${{ matrix.path }}
MUTATE_IGNORE: ${{ matrix.ignore }}
run: composer test:mutation -- "--path=$MUTATE_PATH" ${MUTATE_IGNORE:+"--ignore=$MUTATE_IGNORE"}
Loading
Loading