Improve SDK quality: error handling, validation, exports, tests #12
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: Integration Tests | |
| on: | |
| push: | |
| branches: [master, main] | |
| pull_request: | |
| branches: [master, main] | |
| workflow_dispatch: | |
| jobs: | |
| integration: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| services: | |
| mina: | |
| image: o1labs/mina-local-network:compatible-latest-lightnet | |
| env: | |
| NETWORK_TYPE: single-node | |
| PROOF_LEVEL: none | |
| LOG_LEVEL: Info | |
| RUN_ARCHIVE_NODE: false | |
| SLOT_TIME: 20000 | |
| ports: | |
| - 8080:8080 | |
| - 8181:8181 | |
| - 8282:8282 | |
| - 3085:3085 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install SDK | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Wait for Mina network | |
| uses: o1-labs/wait-for-mina-network-action@v1 | |
| with: | |
| mina-graphql-port: "8080" | |
| max-attempts: "60" | |
| polling-interval-ms: "10000" | |
| - name: Acquire test accounts | |
| id: accounts | |
| run: | | |
| # Helper: retry curl until we get a valid account with 'pk' field | |
| acquire_account() { | |
| local url="$1" | |
| local label="$2" | |
| for i in $(seq 1 60); do | |
| RESP=$(curl -s "$url" 2>&1 || echo "") | |
| if [ -n "$RESP" ]; then | |
| PK=$(echo "$RESP" | python -c "import sys,json; d=json.load(sys.stdin); print(d.get('pk',''))" 2>/dev/null) | |
| if [ -n "$PK" ]; then | |
| echo "$PK" | |
| return 0 | |
| fi | |
| fi | |
| echo "Attempt $i/60: $label not ready yet (response: $RESP)" >&2 | |
| sleep 5 | |
| done | |
| echo "Failed to acquire $label after 60 attempts" >&2 | |
| return 1 | |
| } | |
| # Debug: check which ports are responding | |
| echo "Checking port 8181..." && curl -sf http://127.0.0.1:8181/ 2>&1 | head -1 || echo "8181 not responding" | |
| echo "Checking port 8282..." && curl -sf http://127.0.0.1:8282/ 2>&1 | head -1 || echo "8282 not responding" | |
| SENDER_PK=$(acquire_account "http://127.0.0.1:8181/acquire-account?unlockAccount=true" "sender") | |
| RECEIVER_PK=$(acquire_account "http://127.0.0.1:8181/acquire-account" "receiver") | |
| echo "sender_pk=$SENDER_PK" >> "$GITHUB_OUTPUT" | |
| echo "receiver_pk=$RECEIVER_PK" >> "$GITHUB_OUTPUT" | |
| echo "Sender: $SENDER_PK" | |
| echo "Receiver: $RECEIVER_PK" | |
| - name: Run integration tests | |
| env: | |
| MINA_GRAPHQL_URI: http://127.0.0.1:8080/graphql | |
| MINA_TEST_SENDER_KEY: ${{ steps.accounts.outputs.sender_pk }} | |
| MINA_TEST_RECEIVER_KEY: ${{ steps.accounts.outputs.receiver_pk }} | |
| run: pytest tests/test_integration.py -v --tb=long |