|
| 1 | +name: conformance (reusable) |
| 2 | + |
| 3 | +# Reusable conformance run shared by pipeline.yaml, conformance-weekly.yaml and |
| 4 | +# conformance-badges.yaml. Callers pick a mode: |
| 5 | +# expected-failures: true -> gate the run against tests/Conformance/conformance-baseline.yml |
| 6 | +# score: true -> run unfiltered and emit shields.io badge JSON as artifacts |
| 7 | +on: |
| 8 | + workflow_call: |
| 9 | + inputs: |
| 10 | + expected-failures: |
| 11 | + description: 'Gate the run against tests/Conformance/conformance-baseline.yml' |
| 12 | + type: boolean |
| 13 | + default: false |
| 14 | + score: |
| 15 | + description: 'Run unfiltered and upload conformance score badge JSON (server-badge / client-badge)' |
| 16 | + type: boolean |
| 17 | + default: false |
| 18 | + |
| 19 | +permissions: |
| 20 | + contents: read |
| 21 | + |
| 22 | +jobs: |
| 23 | + server: |
| 24 | + name: server |
| 25 | + runs-on: ubuntu-latest |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v6 |
| 28 | + - uses: actions/setup-node@v6 |
| 29 | + with: |
| 30 | + node-version: '22' |
| 31 | + - uses: "ramsey/composer-install@v4" |
| 32 | + - name: Start conformance server |
| 33 | + run: | |
| 34 | + mkdir -p tests/Conformance/sessions tests/Conformance/logs |
| 35 | + chmod -R 777 tests/Conformance/sessions tests/Conformance/logs |
| 36 | + docker compose -f tests/Conformance/Fixtures/docker-compose.yml up -d |
| 37 | + sleep 5 |
| 38 | + - name: Run conformance tests |
| 39 | + working-directory: ./tests/Conformance |
| 40 | + run: | |
| 41 | + if [ "${{ inputs.score }}" = "true" ]; then |
| 42 | + npx --yes @modelcontextprotocol/conformance@latest server --url http://localhost:8000/ --output-dir results || true |
| 43 | + php bin/score.php results "server conformance" "$GITHUB_WORKSPACE/server-conformance.json" |
| 44 | + elif [ "${{ inputs.expected-failures }}" = "true" ]; then |
| 45 | + npx --yes @modelcontextprotocol/conformance@latest server --url http://localhost:8000/ --expected-failures conformance-baseline.yml |
| 46 | + else |
| 47 | + npx --yes @modelcontextprotocol/conformance@latest server --url http://localhost:8000/ |
| 48 | + fi |
| 49 | + - name: Show logs on failure |
| 50 | + if: failure() |
| 51 | + run: | |
| 52 | + echo "=== Docker Compose Logs ===" |
| 53 | + docker compose -f tests/Conformance/Fixtures/docker-compose.yml logs |
| 54 | + echo "=== Conformance Log ===" |
| 55 | + cat tests/Conformance/logs/conformance.log 2>/dev/null || echo "No conformance log found" |
| 56 | + - name: Upload conformance results |
| 57 | + if: failure() |
| 58 | + uses: actions/upload-artifact@v4 |
| 59 | + with: |
| 60 | + name: conformance-server-results |
| 61 | + path: | |
| 62 | + tests/Conformance/logs |
| 63 | + tests/Conformance/results |
| 64 | + if-no-files-found: ignore |
| 65 | + - name: Upload score badge |
| 66 | + if: inputs.score |
| 67 | + uses: actions/upload-artifact@v4 |
| 68 | + with: |
| 69 | + name: server-badge |
| 70 | + path: server-conformance.json |
| 71 | + - name: Cleanup |
| 72 | + if: always() |
| 73 | + run: docker compose -f tests/Conformance/Fixtures/docker-compose.yml down |
| 74 | + |
| 75 | + client: |
| 76 | + name: client |
| 77 | + runs-on: ubuntu-latest |
| 78 | + steps: |
| 79 | + - uses: actions/checkout@v6 |
| 80 | + - uses: shivammathur/setup-php@v2 |
| 81 | + with: |
| 82 | + php-version: '8.4' |
| 83 | + coverage: none |
| 84 | + - uses: actions/setup-node@v6 |
| 85 | + with: |
| 86 | + node-version: '22' |
| 87 | + - uses: "ramsey/composer-install@v4" |
| 88 | + - name: Run conformance tests |
| 89 | + working-directory: ./tests/Conformance |
| 90 | + run: | |
| 91 | + mkdir -p logs |
| 92 | + CMD="php ${{ github.workspace }}/tests/Conformance/client.php" |
| 93 | + if [ "${{ inputs.score }}" = "true" ]; then |
| 94 | + npx --yes @modelcontextprotocol/conformance@latest client --command "$CMD" --suite all --output-dir results || true |
| 95 | + php bin/score.php results "client conformance" "$GITHUB_WORKSPACE/client-conformance.json" |
| 96 | + elif [ "${{ inputs.expected-failures }}" = "true" ]; then |
| 97 | + npx --yes @modelcontextprotocol/conformance@latest client --command "$CMD" --suite all --expected-failures conformance-baseline.yml |
| 98 | + else |
| 99 | + npx --yes @modelcontextprotocol/conformance@latest client --command "$CMD" --suite all |
| 100 | + fi |
| 101 | + - name: Show logs on failure |
| 102 | + if: failure() |
| 103 | + run: cat tests/Conformance/logs/client-conformance.log 2>/dev/null || echo "No client conformance log found" |
| 104 | + - name: Upload conformance results |
| 105 | + if: failure() |
| 106 | + uses: actions/upload-artifact@v4 |
| 107 | + with: |
| 108 | + name: conformance-client-results |
| 109 | + path: | |
| 110 | + tests/Conformance/logs |
| 111 | + tests/Conformance/results |
| 112 | + if-no-files-found: ignore |
| 113 | + - name: Upload score badge |
| 114 | + if: inputs.score |
| 115 | + uses: actions/upload-artifact@v4 |
| 116 | + with: |
| 117 | + name: client-badge |
| 118 | + path: client-conformance.json |
0 commit comments