name: Conformance Tests

on:
  push:
    branches: [main]
  pull_request:
  workflow_dispatch:

concurrency:
  group: conformance-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  server-conformance:
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - name: Set up Go
        uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
        with:
          go-version: "^1.26"
      - name: Start everything-server
        run: |
          go run ./conformance/everything-server/main.go -http=":3001" &
          # Wait for the server to be ready.
          timeout 30 bash -c 'until curl -s http://localhost:3001/mcp; do sleep 0.5; done'
      - name: "Run conformance tests" 
        uses: modelcontextprotocol/conformance@a2855b03582a6c0b31065ad4d9af248316ce61a3 # v0.1.15
        with:
          mode: server
          url: http://localhost:3001/mcp
          suite: active
          expected-failures: ./conformance/baseline.yml
          node-version: 22

  client-conformance:
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - name: Set up Go
        uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
        with:
          go-version: "^1.26"
      - name: "Run conformance tests" 
        uses: modelcontextprotocol/conformance@a2855b03582a6c0b31065ad4d9af248316ce61a3 # v0.1.15
        with:
          mode: client 
          command: go run ./conformance/everything-client
          suite: core
          expected-failures: ./conformance/baseline.yml
          node-version: 22
