-
Notifications
You must be signed in to change notification settings - Fork 329
84 lines (71 loc) · 2.79 KB
/
e2e.yml
File metadata and controls
84 lines (71 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: E2E Tests
on:
push:
branches: [main]
pull_request:
schedule:
- cron: "0 0 * * *"
permissions:
contents: read
jobs:
test-python-e2e:
name: Python E2E Tests (${{ matrix.transport }})
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
strategy:
matrix:
transport: [stdio, sse, streamable-http]
permissions:
id-token: write
contents: read
env:
# Set auth here so stdio transport and background process pick them up
GRAFANA_USERNAME: admin
GRAFANA_PASSWORD: admin
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install uv
uses: astral-sh/setup-uv@803947b9bd8e9f986429fa0c5a41c367cd732b41 # v7.2.1
- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with:
go-version: "1.24"
cache: true
- name: Install Python dependencies
run: |
cd tests
uv sync --all-groups
- id: get-secrets
uses: grafana/shared-workflows/actions/get-vault-secrets@f1614b210386ac420af6807a997ac7f6d96e477a # get-vault-secrets/v1.3.1
with:
# Secrets placed in the ci/repo/grafana/mcp-grafana/<path> path in Vault
repo_secrets: |
ANTHROPIC_API_KEY=anthropic:api-key
OPENAI_API_KEY=openai:api-key
- name: Start docker-compose services
uses: hoverkraft-tech/compose-action@b160464f2ea59d4c7be918e457514639ad7c7f9f
with:
compose-file: "docker-compose.yaml"
- name: Wait for Grafana server and Prometheus server to start and scrape
run: sleep 30
- name: Build mcp-grafana
run: go build -o dist/mcp-grafana ./cmd/mcp-grafana
- name: Start MCP server in background
if: matrix.transport != 'stdio'
run: |
nohup ./dist/mcp-grafana -t ${{ matrix.transport }} --enabled-tools search,datasource,incident,prometheus,loki,elasticsearch,opensearch,alerting,dashboard,folder,oncall,asserts,sift,pyroscope,navigation,proxied,annotations,rendering,admin,clickhouse,cloudwatch > mcp.log 2>&1 &
sleep 2 # Give server time to start and create log file
if [ ! -f mcp.log ]; then
echo "Warning: mcp.log was not created. Server may have failed to start."
fi
- name: Run Python e2e tests
env:
MCP_GRAFANA_PATH: ../dist/mcp-grafana
MCP_TRANSPORT: ${{ matrix.transport }}
run: |
cd tests
uv run pytest
- if: failure() && matrix.transport != 'stdio'
name: Print MCP logs
run: cat mcp.log 2>/dev/null || echo "No log file found (mcp.log)"