fix(ci): bind server to 0.0.0.0 in Docker and use Python healthcheck #63
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - run: pip install -e ".[dev]" | |
| - run: ruff check src/ tests/ | |
| test: | |
| needs: lint | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - run: pip install -e ".[dev,monitoring]" | |
| - run: pytest tests/ -v --ignore=tests/test_mcp_integration.py --cov=matlab_mcp --cov-report=xml --cov-report=term-missing | |
| - uses: codecov/codecov-action@v4 | |
| if: matrix.python-version == '3.12' | |
| with: | |
| files: coverage.xml | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: false | |
| security: | |
| needs: lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - run: pip install -e ".[dev,monitoring]" | |
| - run: pip-audit | |
| continue-on-error: true | |
| build: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - run: pip install build twine | |
| - run: python -m build | |
| - run: twine check dist/* | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| test-windows: | |
| needs: lint | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-2022, windows-latest] | |
| python-version: ["3.10", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - run: pip install -e ".[dev,monitoring]" | |
| - name: Verify MCP server module loads | |
| run: python -c "from matlab_mcp.server import main; print('OK')" | |
| - name: Run tests (no MATLAB engine) | |
| run: pytest tests/ -v -k "not matlab" --ignore=tests/test_integration.py --ignore=tests/test_mcp_integration.py -W ignore::pytest.PytestUnraisableExceptionWarning | |
| test-macos: | |
| needs: lint | |
| runs-on: macos-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - run: pip install -e ".[dev,monitoring]" | |
| - run: pytest tests/ -v -k "not matlab" --ignore=tests/test_mcp_integration.py -W ignore::pytest.PytestUnraisableExceptionWarning | |
| integration-test: | |
| needs: lint | |
| runs-on: ubuntu-latest | |
| # Polls /mcp endpoint for readiness (not /health which may not be routed) | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - run: pip install -e ".[dev,monitoring]" pytest-timeout | |
| - run: pytest tests/test_mcp_integration.py -v -m integration --timeout=60 | |
| remote-integration-test: | |
| needs: lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: docker compose -f docker-compose.test.yml up --build --exit-code-from client | |
| - name: Cleanup | |
| if: always() | |
| run: docker compose -f docker-compose.test.yml down -v | |
| docker: | |
| needs: lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: docker build -t matlab-mcp:test . | |
| - name: Smoke-test container health endpoint | |
| run: | | |
| docker run -d --name mcp-test \ | |
| -e MATLAB_MCP_SERVER_TRANSPORT=sse \ | |
| -e MATLAB_MCP_MONITORING_ENABLED=true \ | |
| -p 8765:8765 \ | |
| matlab-mcp:test | |
| # The server will crash on pool start (no MATLAB engine in CI). | |
| # curl will fail; || true prevents the step from failing. | |
| # Goal: verify the image builds and the ENTRYPOINT is valid. | |
| sleep 5 | |
| curl --retry 5 --retry-delay 2 --retry-connrefused \ | |
| http://localhost:8765/health || true | |
| docker logs mcp-test | |
| docker stop mcp-test || true | |
| docker rm mcp-test || true |