Streamline README and add conformance score badges (#312)
- Add a shields.io badge row to the README header (version, CI, PHP version, license, conformance scores, protocol/spec) to match the other official MCP SDKs. - Expand "PHP Libraries Using the MCP SDK" into a curated, alphabetically sorted list of downstream projects. - Add tests/Conformance/bin/score.php, a Symfony Console command that turns a conformance run's --output-dir into a shields.io endpoint JSON. - Extend the weekly conformance workflow to score each run and publish the client/server pass-rate to the orphan `badges` branch that the README badges read. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1300d2ee7d
commit
3e45b1f486
1 changed files with 201 additions and 5 deletions
70
.github/workflows/conformance-weekly.yaml
vendored
70
.github/workflows/conformance-weekly.yaml
vendored
|
|
@ -4,13 +4,17 @@ name: conformance-weekly
|
|||
# @modelcontextprotocol/conformance release. The on:pull_request pipeline
|
||||
# pins to whatever version is available at PR time; this schedule catches
|
||||
# upstream releases that add scenarios between PRs.
|
||||
#
|
||||
# It also scores each run and publishes the client/server pass-rate as
|
||||
# shields.io endpoint JSON to the orphan `badges` branch (consumed by the
|
||||
# README); that branch is created on the first run.
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 6 * * 1' # Mondays 06:00 UTC
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
contents: write
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
|
|
@ -31,7 +35,10 @@ jobs:
|
|||
sleep 5
|
||||
- name: Run conformance tests
|
||||
working-directory: ./tests/Conformance
|
||||
run: npx --yes @modelcontextprotocol/conformance@latest server --url http://localhost:8000/ --expected-failures conformance-baseline.yml
|
||||
run: npx --yes @modelcontextprotocol/conformance@latest server --url http://localhost:8000/ --expected-failures conformance-baseline.yml --output-dir results
|
||||
- name: Generate score badge
|
||||
if: always()
|
||||
run: php tests/Conformance/score.php server
|
||||
- name: Show docker logs on failure
|
||||
if: failure()
|
||||
run: docker compose -f tests/Conformance/Fixtures/docker-compose.yml logs
|
||||
|
|
@ -43,6 +50,12 @@ jobs:
|
|||
path: |
|
||||
tests/Conformance/logs
|
||||
tests/Conformance/results
|
||||
- name: Upload score badge
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: server-badge
|
||||
path: tests/Conformance/server-conformance.json
|
||||
|
||||
client:
|
||||
name: conformance / client (latest)
|
||||
|
|
@ -60,7 +73,10 @@ jobs:
|
|||
- run: mkdir -p tests/Conformance/logs
|
||||
- name: Run conformance tests
|
||||
working-directory: ./tests/Conformance
|
||||
run: npx --yes @modelcontextprotocol/conformance@latest client --command "php ${{ github.workspace }}/tests/Conformance/client.php" --suite all --expected-failures conformance-baseline.yml
|
||||
run: npx --yes @modelcontextprotocol/conformance@latest client --command "php ${{ github.workspace }}/tests/Conformance/client.php" --suite all --expected-failures conformance-baseline.yml --output-dir results
|
||||
- name: Generate score badge
|
||||
if: always()
|
||||
run: php tests/Conformance/score.php client
|
||||
- name: Upload conformance results
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
|
|
@ -69,6 +85,12 @@ jobs:
|
|||
path: |
|
||||
tests/Conformance/logs
|
||||
tests/Conformance/results
|
||||
- name: Upload score badge
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: client-badge
|
||||
path: tests/Conformance/client-conformance.json
|
||||
|
||||
notify:
|
||||
name: Open issue on failure
|
||||
|
|
@ -96,3 +118,45 @@ jobs:
|
|||
|
||||
Upstream likely published a release whose scenarios the SDK does not satisfy. Either fix the SDK, update the conformance fixtures, or add the new failure to \`tests/Conformance/conformance-baseline.yml\`."
|
||||
fi
|
||||
|
||||
publish:
|
||||
name: Publish conformance badges
|
||||
runs-on: ubuntu-latest
|
||||
needs: [server, client]
|
||||
# Publish even when the suite regressed (the badge should reflect reality);
|
||||
# skip on forks, which cannot push the `badges` branch.
|
||||
if: ${{ !cancelled() && github.repository == 'modelcontextprotocol/php-sdk' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: server-badge
|
||||
path: badges-in
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: client-badge
|
||||
path: badges-in
|
||||
- name: Publish to badges branch
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
if git ls-remote --exit-code --heads origin badges >/dev/null 2>&1; then
|
||||
git fetch origin badges
|
||||
git worktree add badges-wt badges
|
||||
else
|
||||
git worktree add --detach badges-wt
|
||||
git -C badges-wt checkout --orphan badges
|
||||
git -C badges-wt rm -rf --quiet . >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
cp badges-in/server-conformance.json badges-in/client-conformance.json badges-wt/
|
||||
|
||||
cd badges-wt
|
||||
git add -A
|
||||
if git diff --cached --quiet; then
|
||||
echo "Conformance scores unchanged."
|
||||
else
|
||||
git commit -m "Update conformance score badges"
|
||||
git push origin badges
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue