@@ -2,7 +2,6 @@ name: MCP Tests
22
33on :
44 pull_request :
5-
65jobs :
76 # ##########################################################################
87 # 1 - Local integration tests (always run)
@@ -35,46 +34,55 @@ jobs:
3534 run : pytest -q
3635
3736 # ##########################################################################
38- # 2 - Remote smoke-test (skipped if ENV vars are missing)
39- #
40- # • Put MCP_SERVER_URL → “https://<app>.herokuapp.com”
41- # • Put API_KEY → same key you set as Heroku config var
42- #
43- # The fixture auto-skips the remote case if these are missing, so
37+ # 2 - Deploy this PR to a temp Heroku app and run remote tests
4438 # ##########################################################################
4539 remote :
4640 runs-on : ubuntu-latest
4741 env :
48- MCP_SERVER_URL : ${{ secrets.MCP_SERVER_URL }}
49- API_KEY : ${{ secrets.API_KEY }}
50- SHOULD_RUN_REMOTE : ${{ secrets.MCP_SERVER_URL != '' && secrets.API_KEY != '' }}
42+ HEROKU_API_KEY : ${{ secrets.HEROKU_API_KEY }}
43+ API_KEY : ci-test-key
44+ APP_NAME : mcp-toolkit-pr- ${{ github.event.number }}
5145
5246 steps :
53- - name : Skip if secrets are missing
54- if : env.SHOULD_RUN_REMOTE != 'true'
55- run : echo "Skipping remote tests due to missing secrets."
56-
5747 - uses : actions/checkout@v4
58- if : env.SHOULD_RUN_REMOTE == 'true'
48+
49+ - name : Install Heroku CLI
50+ run : |
51+ curl https://cli-assets.heroku.com/install.sh | sh
52+
53+ - name : Log in to Heroku
54+ run : |
55+ echo "$HEROKU_API_KEY" | heroku auth:token
56+
57+ - name : Create temp Heroku app for this PR
58+ run : |
59+ heroku create $APP_NAME
60+ heroku config:set API_KEY=$API_KEY --app $APP_NAME
61+
62+ - name : Deploy this branch to Heroku
63+ run : |
64+ git push https://heroku:[email protected] /$APP_NAME.git HEAD:main --force 5965
6066 - uses : actions/setup-python@v5
61- if : env.SHOULD_RUN_REMOTE == 'true'
6267 with :
6368 python-version : " 3.11"
6469
6570 - uses : actions/cache@v4
66- if : env.SHOULD_RUN_REMOTE == 'true'
6771 with :
6872 path : ~/.cache/pip
6973 key : ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
7074
71- - name : Install dependencies
72- if : env.SHOULD_RUN_REMOTE == 'true'
75+ - name : Install test dependencies
7376 run : |
7477 python -m pip install --upgrade pip
7578 pip install -r requirements.txt
7679
77- # We reuse the *same* test-suite; the fixture detects MCP_SERVER_URL
78- - name : Run pytest (remote smoke)
79- if : env.SHOULD_RUN_REMOTE == 'true'
80+ - name : Run pytest against deployed app
81+ env :
82+ MCP_SERVER_URL : https://${{ env.APP_NAME }}.herokuapp.com
8083 run : pytest -q
84+
85+ - name : Destroy Heroku app after test
86+ if : always()
87+ run : |
88+ heroku apps:destroy --app $APP_NAME --confirm $APP_NAME
0 commit comments