Add syncing metagraph and remove manual script #748
Workflow file for this run
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: Test Suite | |
| on: | |
| push: | |
| branches: [ '*' ] | |
| pull_request: | |
| branches: [ '*' ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:15 | |
| env: | |
| POSTGRES_DB: postgres | |
| POSTGRES_USER: test_user | |
| POSTGRES_PASSWORD: test_pass | |
| ports: | |
| - 5432:5432 | |
| options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
| postgres-internal: | |
| image: postgres:15 | |
| env: | |
| POSTGRES_DB: internal_tools | |
| POSTGRES_USER: internal_user | |
| POSTGRES_PASSWORD: internal_pass | |
| ports: | |
| - 5433:5432 | |
| options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
| env: | |
| POSTGRES_TEST_URL: postgresql://test_user:test_pass@localhost:5432/postgres | |
| AWS_MASTER_USERNAME: test_user | |
| AWS_MASTER_PASSWORD: test_pass | |
| AWS_RDS_PLATFORM_ENDPOINT: localhost | |
| AWS_RDS_PLATFORM_DB_NAME: postgres | |
| PGPORT: 5432 | |
| DB_USER_INT: internal_user | |
| DB_PASS_INT: internal_pass | |
| DB_HOST_INT: localhost | |
| DB_PORT_INT: 5433 | |
| DB_NAME_INT: internal_tools | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - uses: astral-sh/setup-uv@v2 | |
| - name: Install dependencies | |
| run: | | |
| uv sync | |
| uv add ruff mypy requests websocket-client pytest-asyncio asyncpg httpx pytest-postgresql | |
| - name: Debug environment | |
| run: | | |
| echo "Current directory: $(pwd)" | |
| echo "Files in tests directory:" | |
| ls -la tests/ | |
| echo "Environment variables:" | |
| echo "POSTGRES_TEST_URL: $POSTGRES_TEST_URL" | |
| echo "AWS_MASTER_USERNAME: $AWS_MASTER_USERNAME" | |
| echo "DB_USER_INT: $DB_USER_INT" | |
| echo "DB_HOST_INT: $DB_HOST_INT" | |
| echo "DB_PORT_INT: $DB_PORT_INT" | |
| echo "DB_NAME_INT: $DB_NAME_INT" | |
| - name: Start the API server | |
| run: | | |
| echo "Starting API server..." | |
| uv run python -m api.src.main --host 0.0.0.0 & | |
| SERVER_PID=$! | |
| echo "Server started with PID: $SERVER_PID" | |
| sleep 15 # Wait for server to start | |
| # Check if server is running | |
| echo "Checking if server is running..." | |
| ps aux | grep python | |
| netstat -tlnp | grep 8000 || echo "Port 8000 not listening" | |
| # Test if server responds | |
| echo "Testing server response..." | |
| curl -f http://localhost:8000/healthcheck || echo "Server not responding yet" | |
| - name: Test real API endpoints | |
| run: | | |
| echo "Testing real API endpoints..." | |
| # Test healthcheck endpoint | |
| echo "Testing /healthcheck..." | |
| curl -f http://localhost:8000/healthcheck || echo "Healthcheck failed" | |
| # Test healthcheck-results endpoint | |
| echo "Testing /healthcheck-results..." | |
| curl -f http://localhost:8000/healthcheck-results | jq . || echo "Healthcheck-results failed" | |
| # Test that server is responding | |
| echo "Testing server response..." | |
| curl -f http://localhost:8000/ || echo "Root endpoint failed" | |
| echo "Real API tests completed" | |
| - name: Run unit tests that don't require database | |
| run: | | |
| cd tests | |
| uv run python -m pytest test_endpoints_unit.py::TestSystemStatusEndpointsUnit -v -W ignore::PendingDeprecationWarning | |
| - name: Run simple tests | |
| run: | | |
| cd tests | |
| uv run python -m pytest test_endpoints_simple.py::TestEndpointResponseStructure::test_healthcheck_response_structure -v -W ignore::PendingDeprecationWarning | |
| - name: Run weights function tests | |
| run: | | |
| cd tests | |
| uv run python -m pytest test_weights_setting.py -v -W ignore::PendingDeprecationWarning | |
| - name: Run miner agent flow tests | |
| run: | | |
| cd tests | |
| uv run python -m pytest test_miner_agent_flow.py -v -W ignore::PendingDeprecationWarning | |
| - name: Run real API integration tests | |
| run: | | |
| cd tests | |
| export API_BASE_URL="http://localhost:8000" | |
| uv run python -m pytest test_real_api.py -v -W ignore::PendingDeprecationWarning | |
| - name: Run comprehensive tests | |
| run: | | |
| cd tests | |
| export API_BASE_URL="http://localhost:8000" | |
| uv run python -m pytest \ | |
| test_endpoints_unit.py::TestSystemStatusEndpointsUnit \ | |
| test_endpoints_simple.py::TestEndpointResponseStructure::test_healthcheck_response_structure \ | |
| test_weights_setting.py \ | |
| test_miner_agent_flow.py \ | |
| test_real_api.py \ | |
| -v \ | |
| --tb=short \ | |
| --disable-warnings \ | |
| -W ignore::PendingDeprecationWarning | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - uses: astral-sh/setup-uv@v2 | |
| - name: Install dependencies | |
| run: | | |
| uv sync | |
| - name: Type check | |
| continue-on-error: true | |
| run: | | |
| uvx ty check | |
| deploy: | |
| needs: [test] | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Notify deployment webhook | |
| run: | | |
| echo "Tests passed successfully on main branch, notifying deployment webhook..." | |
| curl -X POST \ | |
| -H "X-Hub-Signature: ${{ secrets.DEPLOY_KEY }}" \ | |
| http://52.22.35.122:3141/hooks/update-platform |