Merge branch 'polytope-labs:main' into main #1
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 SDK | |
| # Cancel running workflows from the same PR | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "packages/sdk/**" | |
| - "packages/indexer/**" | |
| - "packages/filler/**" | |
| - ".github/workflows/test-sdk.yml" | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - "packages/sdk/**" | |
| - "packages/indexer/**" | |
| - "packages/filler/**" | |
| - ".github/workflows/test-sdk.yml" | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: "7" | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Set up environment variables | |
| run: | | |
| # Set up environment variables from secrets | |
| cat > .env.local << EOF | |
| BSC_CHAPEL=${{ secrets.BSC_CHAPEL }} | |
| GNOSIS_CHIADO=${{ secrets.GNOSIS_CHIADO }} | |
| HYPERBRIDGE_GARGANTUA=${{ secrets.HYPERBRIDGE_GARGANTUA }} | |
| PASEO_RPC_URL=${{ secrets.PASEO_RPC_URL }} | |
| BIFROST_PASEO=${{ secrets.BIFROST_PASEO }} | |
| CERE_LOCAL=${{ secrets.CERE_RPC_URL }} | |
| INDEXER_URL=${{ secrets.INDEXER_URL }} | |
| PRIVATE_KEY=${{ secrets.PRIVATE_KEY }} | |
| SECRET_PHRASE=${{ secrets.SECRET_PHRASE }} | |
| PING_MODULE_ADDRESS: "0xFE9f23F0F2fE83b8B9576d3FC94e9a7458DdDD35" | |
| TOKEN_GATEWAY_ADDRESS: "0xFcDa26cA021d5535C3059547390E6cCd8De7acA6" | |
| EOF | |
| - name: Build packages | |
| run: pnpm build | |
| env: | |
| ENV: local | |
| - name: Install Docker Compose | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y docker-compose | |
| docker compose version | |
| - name: Start local indexer (in background) | |
| env: | |
| DB_USER: "postgres" | |
| DB_PASS: "postgres" | |
| DB_DATABASE: "postgres" | |
| DB_HOST: "postgres" | |
| DB_PORT: 5432 | |
| DB_PATH: "./.indexer" | |
| run: | | |
| cd packages/indexer | |
| nohup pnpm start:local > indexer_output.log 2>&1 & | |
| echo "Started indexer process in background" | |
| - name: Wait for GraphQL server to be available | |
| run: | | |
| echo "Waiting for GraphQL server to be available on port 3100..." | |
| timeout=300 # 5 minutes timeout | |
| elapsed=0 | |
| interval=5 | |
| while ! nc -z localhost 3100; do | |
| if [ "$elapsed" -ge "$timeout" ]; then | |
| echo "Timed out waiting for GraphQL server on port 3100" | |
| cat packages/indexer/indexer_output.log | |
| exit 1 | |
| fi | |
| echo "Waiting for GraphQL server (elapsed: ${elapsed}s)..." | |
| sleep $interval | |
| elapsed=$((elapsed + interval)) | |
| done | |
| echo "GraphQL server is available!" | |
| sleep 10 # Give it a few more seconds to fully initialize | |
| - name: Run SDK tests | |
| run: pnpm --filter="@hyperbridge/sdk" test | |
| - name: Run Intent Filler tests | |
| run: pnpm --filter="filler" test | |
| - name: Clean up | |
| if: always() | |
| run: | | |
| # Stop any containers started by the indexer | |
| docker compose -f packages/indexer/docker/docker-compose.local.yml down || true | |
| # Show logs in case of failure | |
| if [ -f packages/indexer/indexer_output.log ]; then | |
| echo "Indexer logs:" | |
| cat packages/indexer/indexer_output.log | |
| fi |