Skip to content

Commit a03f27b

Browse files
mowens3claude
andcommitted
Add Codecov and CI workflow
- GitHub Actions workflow for PHP 8.1/8.2/8.3 matrix - PHPUnit with PCOV coverage - Codecov integration with coverage upload - PHPStan static analysis - README badges for CI, coverage, version, license Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a67161d commit a03f27b

5 files changed

Lines changed: 111 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
pull_request:
7+
branches: [master, main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
php: ['8.1', '8.2', '8.3']
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: ${{ matrix.php }}
23+
extensions: mbstring, json
24+
coverage: pcov
25+
26+
- name: Get Composer cache directory
27+
id: composer-cache
28+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
29+
30+
- name: Cache Composer dependencies
31+
uses: actions/cache@v4
32+
with:
33+
path: ${{ steps.composer-cache.outputs.dir }}
34+
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
35+
restore-keys: |
36+
${{ runner.os }}-php-${{ matrix.php }}-
37+
38+
- name: Install dependencies
39+
run: composer install --prefer-dist --no-progress
40+
41+
- name: Run tests with coverage
42+
run: vendor/bin/phpunit --coverage-clover coverage.xml
43+
44+
- name: Upload coverage to Codecov
45+
if: matrix.php == '8.3'
46+
uses: codecov/codecov-action@v4
47+
with:
48+
files: coverage.xml
49+
fail_ci_if_error: false
50+
token: ${{ secrets.CODECOV_TOKEN }}
51+
52+
static-analysis:
53+
runs-on: ubuntu-latest
54+
55+
steps:
56+
- uses: actions/checkout@v4
57+
58+
- name: Setup PHP
59+
uses: shivammathur/setup-php@v2
60+
with:
61+
php-version: '8.3'
62+
63+
- name: Install dependencies
64+
run: composer install --prefer-dist --no-progress
65+
66+
- name: Run PHPStan
67+
run: vendor/bin/phpstan analyse src --level=5

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
/.phpunit.cache/
33
composer.lock
44
.phpunit.result.cache
5+
coverage.xml
6+
/coverage-html/

README.md

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

3+
[![CI](https://github.com/code-wheel/mcp-http-security/actions/workflows/ci.yml/badge.svg)](https://github.com/code-wheel/mcp-http-security/actions/workflows/ci.yml)
4+
[![codecov](https://codecov.io/gh/code-wheel/mcp-http-security/graph/badge.svg)](https://codecov.io/gh/code-wheel/mcp-http-security)
5+
[![Latest Stable Version](https://poser.pugx.org/code-wheel/mcp-http-security/v)](https://packagist.org/packages/code-wheel/mcp-http-security)
6+
[![License](https://poser.pugx.org/code-wheel/mcp-http-security/license)](https://packagist.org/packages/code-wheel/mcp-http-security)
7+
38
Secure HTTP transport wrapper for MCP (Model Context Protocol) servers in PHP.
49

510
Provides production-ready security components that don't exist elsewhere in the PHP MCP ecosystem:

codecov.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
codecov:
2+
require_ci_to_pass: yes
3+
4+
coverage:
5+
precision: 2
6+
round: down
7+
range: "70...100"
8+
9+
status:
10+
project:
11+
default:
12+
target: auto
13+
threshold: 2%
14+
patch:
15+
default:
16+
target: auto
17+
threshold: 2%
18+
19+
parsers:
20+
gcov:
21+
branch_detection:
22+
conditional: yes
23+
loop: yes
24+
method: no
25+
macro: no
26+
27+
comment:
28+
layout: "reach,diff,flags,files"
29+
behavior: default
30+
require_changes: no

phpunit.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,11 @@
2121
<directory suffix=".php">src</directory>
2222
</include>
2323
</source>
24+
25+
<coverage>
26+
<report>
27+
<clover outputFile="coverage.xml"/>
28+
<html outputDirectory="coverage-html"/>
29+
</report>
30+
</coverage>
2431
</phpunit>

0 commit comments

Comments
 (0)