From fc38d6c27869e8b90397c7caec687fa7b61ae341 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 12:25:58 +0100 Subject: [PATCH 001/117] WIP --- .github/workflows/test_SDK_snippets_v1.yml | 57 +++++++++ v1/test_SDK_snippets/.env.example | 1 + .../test_python_SDK_snippets.py | 117 ++++++++++++++++++ 3 files changed, 175 insertions(+) create mode 100644 .github/workflows/test_SDK_snippets_v1.yml create mode 100644 v1/test_SDK_snippets/.env.example create mode 100644 v1/test_SDK_snippets/test_python_SDK_snippets.py diff --git a/.github/workflows/test_SDK_snippets_v1.yml b/.github/workflows/test_SDK_snippets_v1.yml new file mode 100644 index 00000000..90bd7f4d --- /dev/null +++ b/.github/workflows/test_SDK_snippets_v1.yml @@ -0,0 +1,57 @@ +name: Run Python SDK Snippets from API Reference + +on: + pull_request: + types: [opened, ready_for_review, synchronize] + branches: + - main + paths: + - api_reference/python_sdk_snippets/* + workflow_dispatch: + inputs: + skip_tests: + description: 'Skip tests (unit + integration)' + required: false + default: false + type: boolean + +jobs: + run-python-sdk-snippets: + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + ZERODEV_RPC: ${{ secrets.ZERODEV_RPC }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Install dependencies + working-directory: api_reference/python_sdk_snippets + run: make install + + - name: Run snippets + working-directory: api_reference/python_sdk_snippets + run: make test-snippets #API_KEY=${{ secrets.COMPASS_API_KEY }} + +# - name: Run snippets +# if: ${{ github.event_name != 'workflow_dispatch' || inputs.skip_tests == false }} +# working-directory: api_reference/python_sdk_snippets§ +# run: | +# make run-snippets + + + failure_alert: + if: failure() && github.event_name == 'schedule' # Runs only if a previous job failed & triggered by cron + runs-on: ubuntu-latest + needs: [run-python-sdk-snippets] + steps: + - name: Send failure notification + run: | + curl -X POST "https://allquiet.app/api/webhook/829f846c-4dfa-4a58-ab33-eafae34a57c9" \ + -H "Content-Type: application/json" \ + -d '{"status": "Open", "severity": "Critical", "message": "GitHub workflow failed", "run_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' \ No newline at end of file diff --git a/v1/test_SDK_snippets/.env.example b/v1/test_SDK_snippets/.env.example new file mode 100644 index 00000000..e7b882f8 --- /dev/null +++ b/v1/test_SDK_snippets/.env.example @@ -0,0 +1 @@ +COMPASS_API_KEY=<> \ No newline at end of file diff --git a/v1/test_SDK_snippets/test_python_SDK_snippets.py b/v1/test_SDK_snippets/test_python_SDK_snippets.py new file mode 100644 index 00000000..d97c18ed --- /dev/null +++ b/v1/test_SDK_snippets/test_python_SDK_snippets.py @@ -0,0 +1,117 @@ +import os +import requests +from dotenv import load_dotenv +from typing import List, Dict + +def load_api_key() -> str: + """Load and validate the COMPASS_API_KEY from environment.""" + load_dotenv() + key = os.getenv("COMPASS_API_KEY") + if not key: + raise RuntimeError("COMPASS_API_KEY not set in environment") + return key + +def fetch_api_spec(url: str) -> Dict: + """Fetch the API spec and return the parsed JSON.""" + resp = requests.get(url) + resp.raise_for_status() + return resp.json() + +def get_python_code(path: str, spec: Dict) -> str: + """Return the first Python code sample for a given path.""" + for method in ("get", "post"): + samples = spec["paths"][path].get(method, {}).get("x-codeSamples") + if samples: + return samples[0]["source"] + raise ValueError(f"No Python code sample found for path: {path!r}") + +def replace_with_secret(snippet: str, api_key: str) -> str: + """Inject the real API key into a code snippet.""" + return snippet.replace("", api_key) + +def filter_paths(all_paths: List[str], broken: List[str]) -> List[str]: + """Remove any broken paths in one go.""" + broken_set = set(broken) + return [p for p in all_paths if p not in broken_set] + +def main(): + API_URL = "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" + BROKEN = [ + "/v0/aave/supply", + "/v0/aave/borrow", + "/v0/aave/repay", + "/v0/aave/withdraw", + "/v0/aave/historical_transactions/get", + "/v0/aerodrome_slipstream/swap/sell_exactly", + "/v0/aerodrome_slipstream/swap/buy_exactly", + "/v0/aerodrome_slipstream/liquidity_provision/mint", + # "/v0/aerodrome_slipstream/liquidity_provision/increase", + # "/v0/aerodrome_slipstream/liquidity_provision/withdraw", + # "/v0/morpho/markets", + # "/v0/morpho/allowance", + # "/v0/morpho/deposit", + # "/v0/morpho/withdraw", + # "/v0/morpho/supply_collateral", + # "/v0/morpho/withdraw_collateral", + # "/v0/morpho/borrow", + # "/v0/morpho/repay", + # "/v0/morpho/vault", + # "/v0/morpho/vaults", + # "/v0/morpho/user_position", + # "/v0/sky/buy", + # "/v0/sky/sell", + # "/v0/sky/deposit", + # "/v0/sky/withdraw", + # "/v0/token/balance/get", + # "/v0/token/transfer", + # "/v0/token/price/get", + # "/v0/uniswap/quote/buy_exactly/get", + # "/v0/uniswap/quote/sell_exactly/get", + # "/v0/uniswap/swap/buy_exactly", + # "/v0/uniswap/swap/sell_exactly", + # "/v0/uniswap/liquidity_provision/increase", + # "/v0/uniswap/liquidity_provision/mint", + # "/v0/uniswap/liquidity_provision/withdraw", + # "/v0/generic/portfolio/get", + # "/v0/generic/visualize_portfolio/get", + # "/v0/generic/wrap_eth", + # "/v0/generic/unwrap_weth", + # "/v0/generic/allowance/set", + # "/v0/pendle/buy_pt", + # "/v0/pendle/sell_pt", + # "/v0/pendle/buy_yt", + # "/v0/pendle/sell_yt", + # "/v0/pendle/redeem_yield", + # "/v0/pendle/add_liquidity", + # "/v0/pendle/remove_liquidity", + ] + + api_key = load_api_key() + spec = fetch_api_spec(API_URL) + + all_paths = list(spec.get("paths", {})) + new_broken = [] + + for path in all_paths: + print(f"----------------\nendpoint: {path}") + try: + code = get_python_code(path, spec) + exec(replace_with_secret(code, api_key)) + except Exception as e: + print(f"❌ Failed: {path} – {e}") + new_broken.append(path) + + print("\nFailed paths:") + for path in new_broken: + print(f"- {path}") + #good_paths = filter_paths(all_paths, BROKEN) + + # for path in good_paths: + # print(f"----------------\n" + # f"endpoint: {path}") + # code = get_python_code(path, spec) + # exec(replace_with_secret(code, api_key)) + +if __name__ == "__main__": + + main() \ No newline at end of file From 8f83aca59761e73c47ccc9ed994d3de79ab7a003 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 12:35:06 +0100 Subject: [PATCH 002/117] WIP --- v1/test_SDK_snippets/pyproject.toml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 v1/test_SDK_snippets/pyproject.toml diff --git a/v1/test_SDK_snippets/pyproject.toml b/v1/test_SDK_snippets/pyproject.toml new file mode 100644 index 00000000..7ebca0ca --- /dev/null +++ b/v1/test_SDK_snippets/pyproject.toml @@ -0,0 +1,12 @@ +[project] +name = "python" +version = "0.1.0" +description = "Add your description here" +readme = "README.md" +requires-python = ">=3.12" +dependencies = [ + "compass-api-sdk>=1.1.2", + "dotenv>=0.9.9", + "eth-account>=0.13.7", + "web3>=7.12.0", +] \ No newline at end of file From b9f6e83ca631247dbf504ccaa8726d304a60fa8f Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 12:40:37 +0100 Subject: [PATCH 003/117] WIP --- .github/workflows/test_snippets.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/test_snippets.yml diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml new file mode 100644 index 00000000..cdb67ef5 --- /dev/null +++ b/.github/workflows/test_snippets.yml @@ -0,0 +1,29 @@ +name: Smoke test code samples (parallel) + +on: + workflow_dispatch: {} + push: + paths: + - ".github/workflows/smoke-spec.yml" + +jobs: + discover: + runs-on: ubuntu-latest + outputs: + paths: ${{ steps.collect.outputs.paths }} + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Collect endpoints from spec (minus BROKEN) + id: collect + env: + API_URL: "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" + run: | + python - <<'PY' + import json, os, requests, sys + API_URL = os.environ["API_URL"] \ No newline at end of file From caac1bd632ae1a89904a2edc0215cb9c29dea388 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 12:42:03 +0100 Subject: [PATCH 004/117] WIP --- .github/workflows/test_usecases_v1.yml | 700 +------------------------ 1 file changed, 6 insertions(+), 694 deletions(-) diff --git a/.github/workflows/test_usecases_v1.yml b/.github/workflows/test_usecases_v1.yml index b0d08099..dda09811 100644 --- a/.github/workflows/test_usecases_v1.yml +++ b/.github/workflows/test_usecases_v1.yml @@ -1,711 +1,23 @@ -name: test_usecases_v_one +name: test_usecases_v_1 on: schedule: # Runs at 00:00 UTC every day - cron: "0 0 * * *" pull_request: - branches: - - main + branches: + - main workflow_dispatch: - inputs: - environment: - description: "Environment to test" - required: true - type: string - - workflow_call: - inputs: - environment: - description: "Environment to test" - required: true - type: string permissions: id-token: write contents: write -env: - AWS_ECR_STS_ROLE: arn:aws:iam::688567264391:role/DojoApiCIRole - jobs: - validate-environment: - runs-on: ubuntu-latest - outputs: - environment: ${{ steps.validate.outputs.environment }} - steps: - - name: Validate environment input - id: validate - run: | - if [[ "${{ github.event_name }}" == "workflow_dispatch" || "${{ github.event_name }}" == "workflow_call" ]]; then - ENVIRONMENT="${{ inputs.environment }}" - else - ENVIRONMENT="local" - fi - if [[ "$ENVIRONMENT" != "staging" && "$ENVIRONMENT" != "prod" && "$ENVIRONMENT" != "local" ]]; then - echo "❌ Error: Invalid environment '$ENVIRONMENT'. Must be 'staging' or 'prod' or 'local'." - exit 1 - fi - echo "✅ Environment '$ENVIRONMENT' is valid" - echo "environment=$ENVIRONMENT" >> $GITHUB_OUTPUT - - set-versions: - needs: [validate-environment] - runs-on: ubuntu-latest - outputs: - npm_package_version: ${{ steps.set-versions.outputs.npm_package_version }} - uv_package_version: ${{ steps.set-versions.outputs.uv_package_version }} - steps: - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "20" - - - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh - - - name: Set versions - id: set-versions - run: | - if [[ "${{ needs.validate-environment.outputs.environment }}" == "staging" ]]; then - NPM_PACKAGE_VERSION=$(npm view @compass-labs/api-sdk versions --json | jq -r '.[]' | grep -E 'rc|alpha|beta' | sort -V | tail -1) - UV_PACKAGE_VERSION="$(curl -s https://pypi.org/pypi/compass-api-sdk/json | jq -r '.releases | keys | .[]' | grep -E 'rc|a|b|dev' | sort -V | tail -1)" - else - NPM_PACKAGE_VERSION="latest" - UV_PACKAGE_VERSION="latest" - fi - - echo "npm_package_version=$NPM_PACKAGE_VERSION" >> $GITHUB_OUTPUT - echo "uv_package_version=$UV_PACKAGE_VERSION" >> $GITHUB_OUTPUT - - - run-pendle-typescript: - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - ARBITRUM_RPC_URL: http://localhost:8547 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "20" - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - - name: Install dependencies - working-directory: v1/pendle/typescript - run: | - npm install - if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then - npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION - fi - npm list - - - name: Build application - working-directory: v1/pendle/typescript - run: npm run build - - - name: Run application - working-directory: v1/pendle/typescript - run: npm run start - - run-pendle-python: - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - ARBITRUM_RPC_URL: http://localhost:8547 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/pendle/python - run: | - if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then - echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" - uv add compass-api-sdk==$UV_PACKAGE_VERSION - fi - uv sync - uv pip freeze - - - name: Run example - working-directory: v1/pendle/python - run: ./.venv/bin/python src/main.py - - run-typescript-basic-examples-deposit-on-morpho: # - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - BASE_RPC_URL: http://localhost:8546 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "20" - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/basic_examples/deposit_on_morpho/typescript - run: | - npm install - if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then - npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION - fi - npm list - - - name: Build application - working-directory: v1/basic_examples/deposit_on_morpho/typescript - run: npm run build - - - name: Run application - working-directory: v1/basic_examples/deposit_on_morpho/typescript - run: npm run start - - - run-python----basic-examples-deposit-on-morpho: # - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - BASE_RPC_URL: http://localhost:8546 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/basic_examples/deposit_on_morpho/python - run: | - if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then - echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" - uv add compass-api-sdk==$UV_PACKAGE_VERSION - fi - uv sync - uv pip freeze - - - name: Run example - working-directory: v1/basic_examples/deposit_on_morpho/python - run: ./.venv/bin/python main.py #src/main.py - - - run-typescript-basic-examples-deposit-on-aave: - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - BASE_RPC_URL: http://localhost:8546 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "20" - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/basic_examples/deposit_on_aave/typescript - run: | - npm install - if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then - npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION - fi - npm list - - - name: Build application - working-directory: v1/basic_examples/deposit_on_aave/typescript - run: npm run build - - - name: Run application - working-directory: v1/basic_examples/deposit_on_aave/typescript - run: npm run start - - - run-python----basic-examples-deposit-on-aave: - needs: [validate-environment, set-versions] - + do-nothing: runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - BASE_RPC_URL: http://localhost:8546 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/basic_examples/deposit_on_aave/python - run: | - if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then - echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" - uv add compass-api-sdk==$UV_PACKAGE_VERSION - fi - uv sync - uv pip freeze - - - name: Run example - working-directory: v1/basic_examples/deposit_on_aave/python - run: ./.venv/bin/python main.py #src/main.py - - run-typescript-transaction_bundler_embed_a_fee_in_tx: # - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - BASE_RPC_URL: http://localhost:8546 - #ETHEREUM_RPC_URL: http://localhost:8545 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "20" - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/typescript - run: | - npm install - if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then - npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION - fi - npm list - - - name: Build application - working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/typescript - run: npm run build - - - name: Run application - working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/typescript - run: npm run start - - run-python----transaction_bundler_embed_a_fee_in_tx: # - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - BASE_RPC_URL: http://localhost:8546 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/python - run: | - if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then - echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" - uv add compass-api-sdk==$UV_PACKAGE_VERSION - fi - uv sync - uv pip freeze - - - name: Run example - working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/python - run: ./.venv/bin/python main.py #src/main.py - - - run-transaction-bundler-typescript: - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - ETHEREUM_RPC_URL: http://localhost:8545 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "20" - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/transaction_bundler/typescript - run: | - npm install - if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then - npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION - fi - npm list - - - name: Build application - working-directory: v1/transaction_bundler/typescript - run: npm run build - - - name: Run application - working-directory: v1/transaction_bundler/typescript - run: npm run start - - run-transaction-bundler-python: - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - ETHEREUM_RPC_URL: http://localhost:8545 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/transaction_bundler/python - run: | - if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then - echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" - uv add compass-api-sdk==$UV_PACKAGE_VERSION - fi - uv sync - uv pip freeze - - - name: Run example - working-directory: v1/transaction_bundler/python - run: ./.venv/bin/python src/main.py - - run-aave-looping-typescript: - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - ETHEREUM_RPC_URL: http://localhost:8545 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "20" - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/aave_looping/typescript - run: | - npm install - if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then - npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION - fi - npm list - - - name: Build application - working-directory: v1/aave_looping/typescript - run: npm run build - - - name: Run application - working-directory: v1/aave_looping/typescript - run: npm run start - - run-aave-looping-python: - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - ETHEREUM_RPC_URL: http://localhost:8545 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/aave_looping/python - run: | - if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then - echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" - uv add compass-api-sdk==$UV_PACKAGE_VERSION - fi - uv sync - uv pip freeze - - - name: Run example - working-directory: v1/aave_looping/python - run: ./.venv/bin/python src/main.py - - failure-alert: - if: failure() && github.event_name == 'schedule' # Runs only if a previous job failed & triggered by cron - runs-on: ubuntu-latest - needs: - [ - run-pendle-typescript, - run-pendle-python, - run-transaction-bundler-typescript, - run-transaction-bundler-python, - run-aave-looping-typescript, - run-aave-looping-python, - ] - steps: - - name: Send failure notification + - name: Do nothing run: | - curl -X POST "https://allquiet.app/api/webhook/829f846c-4dfa-4a58-ab33-eafae34a57c9" \ - -H "Content-Type: application/json" \ - -d '{"status": "Open", "severity": "Critical", "message": "GitHub workflow failed", "run_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' + echo "I am doing nothing" From e147e9a56c985b9b42d42657282ce0275bd1e214 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 12:42:53 +0100 Subject: [PATCH 005/117] WIP --- .github/workflows/test_snippets.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index cdb67ef5..b91a6de8 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -1,10 +1,21 @@ name: Smoke test code samples (parallel) + + on: - workflow_dispatch: {} - push: - paths: - - ".github/workflows/smoke-spec.yml" + schedule: + # Runs at 00:00 UTC every day + - cron: "0 0 * * *" + pull_request: + branches: + - main + workflow_dispatch: + +#on: +# workflow_dispatch: {} +# push: +# paths: +# - ".github/workflows/smoke-spec.yml" jobs: discover: From e12c3e86e61fa2f8f1770f4baa8afffec198f05c Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 12:53:56 +0100 Subject: [PATCH 006/117] WIP --- .github/workflows/test_usecases_v1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_usecases_v1.yml b/.github/workflows/test_usecases_v1.yml index dda09811..55bed613 100644 --- a/.github/workflows/test_usecases_v1.yml +++ b/.github/workflows/test_usecases_v1.yml @@ -1,4 +1,4 @@ -name: test_usecases_v_1 +name: test_usecases_v_one on: schedule: From 3a3ee49177be903e1519e2cc8c8a20e13302c8de Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 15:15:39 +0100 Subject: [PATCH 007/117] WIP --- .github/workflows/test_snippets.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index b91a6de8..5a937c4c 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -30,6 +30,11 @@ jobs: with: python-version: "3.11" + - name: Install Python deps + run: | + python -m pip install --upgrade pip + pip install requests + - name: Collect endpoints from spec (minus BROKEN) id: collect env: @@ -37,4 +42,6 @@ jobs: run: | python - <<'PY' import json, os, requests, sys - API_URL = os.environ["API_URL"] \ No newline at end of file + API_URL = os.environ["API_URL"] + print("✅ Able to import requests and reach", API_URL) + PY \ No newline at end of file From 1255ced09bd243b8b258ce7aa1095433f46b8307 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 15:20:07 +0100 Subject: [PATCH 008/117] WIP --- .github/workflows/test_snippets.yml | 133 +++++++++++++++++++++++++--- 1 file changed, 119 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 5a937c4c..0b535077 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -1,27 +1,18 @@ name: Smoke test code samples (parallel) - - on: schedule: - # Runs at 00:00 UTC every day - - cron: "0 0 * * *" + - cron: "0 0 * * *" # daily at 00:00 UTC pull_request: - branches: - - main + branches: [ main ] workflow_dispatch: -#on: -# workflow_dispatch: {} -# push: -# paths: -# - ".github/workflows/smoke-spec.yml" - jobs: discover: runs-on: ubuntu-latest outputs: paths: ${{ steps.collect.outputs.paths }} + count: ${{ steps.collect.outputs.count }} steps: - uses: actions/checkout@v4 @@ -41,7 +32,121 @@ jobs: API_URL: "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" run: | python - <<'PY' - import json, os, requests, sys +import json, os, requests, sys +API_URL = os.environ["API_URL"] + +# Hard-coded BROKEN +BROKEN = { + "/v0/aave/supply", + "/v0/aave/borrow", + "/v0/aave/repay", + "/v0/aave/withdraw", + "/v0/aave/historical_transactions/get", + "/v0/aerodrome_slipstream/swap/sell_exactly", + "/v0/aerodrome_slipstream/swap/buy_exactly", + "/v0/aerodrome_slipstream/liquidity_provision/mint", +} + +def fetch_spec(url: str): + r = requests.get(url, timeout=(5,30)) + r.raise_for_status() + return r.json() + +def has_python_sample(method_obj: dict) -> bool: + samples = (method_obj or {}).get("x-codeSamples") or [] + for s in samples: + lang = (s.get("lang") or "").lower() + if lang.startswith("python"): + return True + return False + +spec = fetch_spec(API_URL) +paths = [] +for p, methods in (spec.get("paths") or {}).items(): + if p in BROKEN: + continue + if any(has_python_sample(methods.get(m, {})) for m in ("get","post")): + paths.append(p) + +# Cap to matrix limit (256 entries) +paths = paths[:256] + +matrix = {"path": paths} +print(f"Discovered {len(paths)} runnable paths") +with open(os.environ["GITHUB_OUTPUT"], "a") as fh: + fh.write(f"paths={json.dumps(matrix)}\n") + fh.write(f"count={len(paths)}\n") +PY + + - name: Echo matrix (debug) + run: | + echo "Discovered ${{ steps.collect.outputs.count }} paths" + echo '${{ steps.collect.outputs.paths }}' + + run-endpoint: + needs: discover + if: ${{ fromJson(needs.discover.outputs.paths).path && fromJson(needs.discover.outputs.paths).path[0] != '' }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + max-parallel: 20 # tune if you hit rate-limits + matrix: ${{ fromJson(needs.discover.outputs.paths) }} + env: + API_URL: "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install Python deps + run: | + python -m pip install --upgrade pip + pip install requests python-dotenv + + - name: Execute code sample for ${{ matrix.path }} + timeout-minutes: 10 + env: + path: ${{ matrix.path }} + run: | + python - <<'PY' + import os, requests, sys + API_URL = os.environ["API_URL"] - print("✅ Able to import requests and reach", API_URL) + PATH = os.environ["path"] + API_KEY = os.environ.get("COMPASS_API_KEY") + if not API_KEY: + print("Missing COMPASS_API_KEY (set as a repository secret).", file=sys.stderr) + sys.exit(1) + + def fetch_spec(url: str): + r = requests.get(url, timeout=(5,30)) + r.raise_for_status() + return r.json() + + def first_python_sample(spec, path: str) -> str: + methods = spec["paths"][path] + for m in ("get","post"): + samples = (methods.get(m, {}) or {}).get("x-codeSamples") or [] + for s in samples: + if (s.get("lang") or "").lower().startswith("python"): + return s["source"] + raise RuntimeError(f"No Python code sample for {path}") + + spec = fetch_spec(API_URL) + code = first_python_sample(spec, PATH).replace("", API_KEY) + + # Isolated globals + globs = {"__name__": "__main__"} + + print(f"--- Running sample for {PATH} ---") + try: + exec(compile(code, filename=f"", mode="exec"), globs, None) + print(f"✅ PASS: {PATH}") + except Exception as e: + print(f"❌ FAIL: {PATH} - {e}", file=sys.stderr) + raise PY \ No newline at end of file From 1d32d1381f5b2b4d6116014ec93970fcb3c4b86f Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 15:27:12 +0100 Subject: [PATCH 009/117] WIP --- .github/workflows/test_snippets.yml | 68 ----------------------------- 1 file changed, 68 deletions(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 0b535077..7f098679 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -82,71 +82,3 @@ PY run: | echo "Discovered ${{ steps.collect.outputs.count }} paths" echo '${{ steps.collect.outputs.paths }}' - - run-endpoint: - needs: discover - if: ${{ fromJson(needs.discover.outputs.paths).path && fromJson(needs.discover.outputs.paths).path[0] != '' }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - max-parallel: 20 # tune if you hit rate-limits - matrix: ${{ fromJson(needs.discover.outputs.paths) }} - env: - API_URL: "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - - name: Install Python deps - run: | - python -m pip install --upgrade pip - pip install requests python-dotenv - - - name: Execute code sample for ${{ matrix.path }} - timeout-minutes: 10 - env: - path: ${{ matrix.path }} - run: | - python - <<'PY' - import os, requests, sys - - API_URL = os.environ["API_URL"] - PATH = os.environ["path"] - API_KEY = os.environ.get("COMPASS_API_KEY") - if not API_KEY: - print("Missing COMPASS_API_KEY (set as a repository secret).", file=sys.stderr) - sys.exit(1) - - def fetch_spec(url: str): - r = requests.get(url, timeout=(5,30)) - r.raise_for_status() - return r.json() - - def first_python_sample(spec, path: str) -> str: - methods = spec["paths"][path] - for m in ("get","post"): - samples = (methods.get(m, {}) or {}).get("x-codeSamples") or [] - for s in samples: - if (s.get("lang") or "").lower().startswith("python"): - return s["source"] - raise RuntimeError(f"No Python code sample for {path}") - - spec = fetch_spec(API_URL) - code = first_python_sample(spec, PATH).replace("", API_KEY) - - # Isolated globals - globs = {"__name__": "__main__"} - - print(f"--- Running sample for {PATH} ---") - try: - exec(compile(code, filename=f"", mode="exec"), globs, None) - print(f"✅ PASS: {PATH}") - except Exception as e: - print(f"❌ FAIL: {PATH} - {e}", file=sys.stderr) - raise - PY \ No newline at end of file From 5ac6cadd1e51f0265eb7fa7942e6c2785fb3671e Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 15:28:53 +0100 Subject: [PATCH 010/117] WIP --- .github/workflows/test_snippets.yml | 84 ++++------------------------- 1 file changed, 11 insertions(+), 73 deletions(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 7f098679..168ab9ad 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -1,84 +1,22 @@ -name: Smoke test code samples (parallel) +name: Minimal matrix demo on: - schedule: - - cron: "0 0 * * *" # daily at 00:00 UTC - pull_request: - branches: [ main ] workflow_dispatch: jobs: discover: runs-on: ubuntu-latest outputs: - paths: ${{ steps.collect.outputs.paths }} - count: ${{ steps.collect.outputs.count }} + items: ${{ steps.set-output.outputs.items }} steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - - name: Install Python deps - run: | - python -m pip install --upgrade pip - pip install requests - - - name: Collect endpoints from spec (minus BROKEN) - id: collect - env: - API_URL: "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" + - id: set-output run: | - python - <<'PY' -import json, os, requests, sys -API_URL = os.environ["API_URL"] - -# Hard-coded BROKEN -BROKEN = { - "/v0/aave/supply", - "/v0/aave/borrow", - "/v0/aave/repay", - "/v0/aave/withdraw", - "/v0/aave/historical_transactions/get", - "/v0/aerodrome_slipstream/swap/sell_exactly", - "/v0/aerodrome_slipstream/swap/buy_exactly", - "/v0/aerodrome_slipstream/liquidity_provision/mint", -} - -def fetch_spec(url: str): - r = requests.get(url, timeout=(5,30)) - r.raise_for_status() - return r.json() - -def has_python_sample(method_obj: dict) -> bool: - samples = (method_obj or {}).get("x-codeSamples") or [] - for s in samples: - lang = (s.get("lang") or "").lower() - if lang.startswith("python"): - return True - return False + echo 'items={"item":["foo","bar"]}' >> $GITHUB_OUTPUT -spec = fetch_spec(API_URL) -paths = [] -for p, methods in (spec.get("paths") or {}).items(): - if p in BROKEN: - continue - if any(has_python_sample(methods.get(m, {})) for m in ("get","post")): - paths.append(p) - -# Cap to matrix limit (256 entries) -paths = paths[:256] - -matrix = {"path": paths} -print(f"Discovered {len(paths)} runnable paths") -with open(os.environ["GITHUB_OUTPUT"], "a") as fh: - fh.write(f"paths={json.dumps(matrix)}\n") - fh.write(f"count={len(paths)}\n") -PY - - - name: Echo matrix (debug) - run: | - echo "Discovered ${{ steps.collect.outputs.count }} paths" - echo '${{ steps.collect.outputs.paths }}' + echo-item: + needs: discover + runs-on: ubuntu-latest + strategy: + matrix: ${{ fromJson(needs.discover.outputs.items) }} + steps: + - run: echo "Hello from ${{ matrix.item }}" \ No newline at end of file From 4dae6a0a4fc201eae5f3e2b11eb8857eb1b3e443 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 15:30:51 +0100 Subject: [PATCH 011/117] WIP --- .github/workflows/test_snippets.yml | 35 +++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 168ab9ad..47fa86ca 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -1,10 +1,32 @@ -name: Minimal matrix demo +name: Smoke test code samples (parallel) on: + schedule: + - cron: "0 0 * * *" # daily at 00:00 UTC + pull_request: + branches: [ main ] workflow_dispatch: jobs: discover: +# runs-on: ubuntu-latest +# outputs: +# paths: ${{ steps.collect.outputs.paths }} +# count: ${{ steps.collect.outputs.count }} +# steps: +# - uses: actions/checkout@v4 +# +# - name: Set up Python +# uses: actions/setup-python@v5 +# with: +# python-version: "3.11" +# +# - name: Install Python deps +# run: | +# python -m pip install --upgrade pip +# pip install requests + + runs-on: ubuntu-latest outputs: items: ${{ steps.set-output.outputs.items }} @@ -19,4 +41,13 @@ jobs: strategy: matrix: ${{ fromJson(needs.discover.outputs.items) }} steps: - - run: echo "Hello from ${{ matrix.item }}" \ No newline at end of file + - run: echo "Hello from ${{ matrix.item }}" + +# - name: Collect endpoints from spec (minus BROKEN) +# id: collect +# env: +# API_URL: "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" +# run: | +# python - <<'PY' +#import json, os, requests, sys +#API_URL = os.environ["API_URL"] \ No newline at end of file From 1cb1fc0f3dfc4ec3b5350498cee0d452ff540bca Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 15:32:27 +0100 Subject: [PATCH 012/117] WIP --- .github/workflows/test_snippets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 47fa86ca..35c185d0 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -33,7 +33,7 @@ jobs: steps: - id: set-output run: | - echo 'items={"item":["foo","bar"]}' >> $GITHUB_OUTPUT + echo 'items={"item":["x","y", "z"]}' >> $GITHUB_OUTPUT echo-item: needs: discover From 28e8b759251f9bbb58707e35e2a7a411b9c3d06d Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 15:35:02 +0100 Subject: [PATCH 013/117] WIP --- .github/workflows/test_snippets.yml | 57 ++++++++++++++++++----------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 35c185d0..1f652958 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -9,31 +9,46 @@ on: jobs: discover: -# runs-on: ubuntu-latest -# outputs: -# paths: ${{ steps.collect.outputs.paths }} -# count: ${{ steps.collect.outputs.count }} -# steps: -# - uses: actions/checkout@v4 -# -# - name: Set up Python -# uses: actions/setup-python@v5 -# with: -# python-version: "3.11" -# -# - name: Install Python deps -# run: | -# python -m pip install --upgrade pip -# pip install requests - - runs-on: ubuntu-latest outputs: - items: ${{ steps.set-output.outputs.items }} + paths: ${{ steps.collect.outputs.paths }} + count: ${{ steps.collect.outputs.count }} steps: - - id: set-output + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install Python deps run: | - echo 'items={"item":["x","y", "z"]}' >> $GITHUB_OUTPUT + python -m pip install --upgrade pip + pip install requests + steps: + - id: collect + run: | + python - <<'PY' + import json, os + # Pretend we "discovered" two items + values = ["foo", "bar"] + matrix = {"item": values} + print("Discovered:", matrix) + + # Write to GitHub Actions output file + with open(os.environ["GITHUB_OUTPUT"], "a") as fh: + fh.write(f"items={json.dumps(matrix)}\n") + PY + + + +# runs-on: ubuntu-latest +# outputs: +# items: ${{ steps.set-output.outputs.items }} +# steps: +# - id: set-output +# run: | +# echo 'items={"item":["x","y", "z"]}' >> $GITHUB_OUTPUT echo-item: needs: discover From fbdb8dce5170bb351eb843e5179e67754215e828 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 15:40:38 +0100 Subject: [PATCH 014/117] WIP --- .github/workflows/test_snippets.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 1f652958..e5efda23 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -25,8 +25,8 @@ jobs: run: | python -m pip install --upgrade pip pip install requests - steps: - - id: collect + + - name: collect run: | python - <<'PY' import json, os @@ -34,7 +34,7 @@ jobs: values = ["foo", "bar"] matrix = {"item": values} print("Discovered:", matrix) - + # Write to GitHub Actions output file with open(os.environ["GITHUB_OUTPUT"], "a") as fh: fh.write(f"items={json.dumps(matrix)}\n") From bffa594cc1241511d38deff57ac4962be6e7c3e7 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 15:41:22 +0100 Subject: [PATCH 015/117] WIP --- .github/workflows/test_snippets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index e5efda23..8814514d 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -31,7 +31,7 @@ jobs: python - <<'PY' import json, os # Pretend we "discovered" two items - values = ["foo", "bar"] + values = ["x", "y", "z"] matrix = {"item": values} print("Discovered:", matrix) From 211bae67fabd62163fbf39981be9e9542a988af3 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 15:44:03 +0100 Subject: [PATCH 016/117] WIP --- .github/workflows/test_snippets.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 8814514d..35d24631 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -39,6 +39,13 @@ jobs: with open(os.environ["GITHUB_OUTPUT"], "a") as fh: fh.write(f"items={json.dumps(matrix)}\n") PY + echo-item: + needs: discover + runs-on: ubuntu-latest + strategy: + matrix: ${{ fromJson(needs.discover.outputs.items) }} + steps: + - run: echo "Hello from ${{ matrix.item }}" @@ -50,13 +57,7 @@ jobs: # run: | # echo 'items={"item":["x","y", "z"]}' >> $GITHUB_OUTPUT - echo-item: - needs: discover - runs-on: ubuntu-latest - strategy: - matrix: ${{ fromJson(needs.discover.outputs.items) }} - steps: - - run: echo "Hello from ${{ matrix.item }}" + # - name: Collect endpoints from spec (minus BROKEN) # id: collect From f530ae400279edc3a645c4cffac60f43aa07f275 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 15:48:13 +0100 Subject: [PATCH 017/117] WIP --- .github/workflows/test_snippets.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 35d24631..5fa209e6 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -26,7 +26,7 @@ jobs: python -m pip install --upgrade pip pip install requests - - name: collect + - id: collect run: | python - <<'PY' import json, os @@ -39,6 +39,7 @@ jobs: with open(os.environ["GITHUB_OUTPUT"], "a") as fh: fh.write(f"items={json.dumps(matrix)}\n") PY + echo-item: needs: discover runs-on: ubuntu-latest From d48e13bbc085cbc4263ae3d7f169a9f255a7edf2 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 15:51:04 +0100 Subject: [PATCH 018/117] WIP --- .github/workflows/test_SDK_snippets_v1.yml | 57 ---------------------- .github/workflows/test_usecases_v1.yml | 23 --------- 2 files changed, 80 deletions(-) delete mode 100644 .github/workflows/test_SDK_snippets_v1.yml delete mode 100644 .github/workflows/test_usecases_v1.yml diff --git a/.github/workflows/test_SDK_snippets_v1.yml b/.github/workflows/test_SDK_snippets_v1.yml deleted file mode 100644 index 90bd7f4d..00000000 --- a/.github/workflows/test_SDK_snippets_v1.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Run Python SDK Snippets from API Reference - -on: - pull_request: - types: [opened, ready_for_review, synchronize] - branches: - - main - paths: - - api_reference/python_sdk_snippets/* - workflow_dispatch: - inputs: - skip_tests: - description: 'Skip tests (unit + integration)' - required: false - default: false - type: boolean - -jobs: - run-python-sdk-snippets: - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - ZERODEV_RPC: ${{ secrets.ZERODEV_RPC }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh - - - name: Install dependencies - working-directory: api_reference/python_sdk_snippets - run: make install - - - name: Run snippets - working-directory: api_reference/python_sdk_snippets - run: make test-snippets #API_KEY=${{ secrets.COMPASS_API_KEY }} - -# - name: Run snippets -# if: ${{ github.event_name != 'workflow_dispatch' || inputs.skip_tests == false }} -# working-directory: api_reference/python_sdk_snippets§ -# run: | -# make run-snippets - - - failure_alert: - if: failure() && github.event_name == 'schedule' # Runs only if a previous job failed & triggered by cron - runs-on: ubuntu-latest - needs: [run-python-sdk-snippets] - steps: - - name: Send failure notification - run: | - curl -X POST "https://allquiet.app/api/webhook/829f846c-4dfa-4a58-ab33-eafae34a57c9" \ - -H "Content-Type: application/json" \ - -d '{"status": "Open", "severity": "Critical", "message": "GitHub workflow failed", "run_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' \ No newline at end of file diff --git a/.github/workflows/test_usecases_v1.yml b/.github/workflows/test_usecases_v1.yml deleted file mode 100644 index 55bed613..00000000 --- a/.github/workflows/test_usecases_v1.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: test_usecases_v_one - -on: - schedule: - # Runs at 00:00 UTC every day - - cron: "0 0 * * *" - pull_request: - branches: - - main - workflow_dispatch: - -permissions: - id-token: write - contents: write - -jobs: - do-nothing: - runs-on: ubuntu-latest - - steps: - - name: Do nothing - run: | - echo "I am doing nothing" From 7b4b25ddf18d828c231f77a11cf2ebcf81c8645c Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 15:51:24 +0100 Subject: [PATCH 019/117] WIP --- .github/workflows/test_snippets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 5fa209e6..a918309b 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -1,4 +1,4 @@ -name: Smoke test code samples (parallel) +name: workflow 1 on: schedule: From 5dcde5399622aac447f1e3c7e17d718e9a33db3c Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 15:51:35 +0100 Subject: [PATCH 020/117] WIP --- .github/workflows/test_snippets.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index a918309b..d83e60ed 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -1,8 +1,6 @@ name: workflow 1 on: - schedule: - - cron: "0 0 * * *" # daily at 00:00 UTC pull_request: branches: [ main ] workflow_dispatch: From c56d3960fa8ecf0702d3dafbdb566f94aa950483 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:03:06 +0100 Subject: [PATCH 021/117] WIP --- .github/workflows/test_snippets.yml | 31 ++++++++--------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index d83e60ed..27ec2a51 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -37,32 +37,17 @@ jobs: with open(os.environ["GITHUB_OUTPUT"], "a") as fh: fh.write(f"items={json.dumps(matrix)}\n") PY + - name: Echo raw output (debug) + run: echo "items = ${{ steps.collect.outputs.items }}" echo-item: needs: discover + # Only run if discover produced something JSON-ish + if: ${{ needs.discover.outputs.items != '' }} runs-on: ubuntu-latest strategy: - matrix: ${{ fromJson(needs.discover.outputs.items) }} + fail-fast: false + # Fallback to an empty matrix if items is blank (prevents fromJson('') errors) + matrix: ${{ fromJson(needs.discover.outputs.items != '' && needs.discover.outputs.items || '{"item":[]}' ) }} steps: - - run: echo "Hello from ${{ matrix.item }}" - - - -# runs-on: ubuntu-latest -# outputs: -# items: ${{ steps.set-output.outputs.items }} -# steps: -# - id: set-output -# run: | -# echo 'items={"item":["x","y", "z"]}' >> $GITHUB_OUTPUT - - - -# - name: Collect endpoints from spec (minus BROKEN) -# id: collect -# env: -# API_URL: "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" -# run: | -# python - <<'PY' -#import json, os, requests, sys -#API_URL = os.environ["API_URL"] \ No newline at end of file + - run: echo "Hello from ${{ matrix.item }}" \ No newline at end of file From 7bfafe512d60ba6d7499c0dad6fd954d377f7e1f Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:09:10 +0100 Subject: [PATCH 022/117] WIP --- .github/workflows/test_snippets.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 27ec2a51..ef26589a 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -9,8 +9,7 @@ jobs: discover: runs-on: ubuntu-latest outputs: - paths: ${{ steps.collect.outputs.paths }} - count: ${{ steps.collect.outputs.count }} + items: ${{ steps.collect.outputs.items }} # <-- expose "items" steps: - uses: actions/checkout@v4 @@ -28,7 +27,7 @@ jobs: run: | python - <<'PY' import json, os - # Pretend we "discovered" two items + # Pretend we "discovered" 3 items values = ["x", "y", "z"] matrix = {"item": values} print("Discovered:", matrix) From 95cbe3dec3ba8c1958871068f15eef87fd4c6b65 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:12:13 +0100 Subject: [PATCH 023/117] WIP --- v1/test_SDK_snippets/discover_endpoints.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 v1/test_SDK_snippets/discover_endpoints.py diff --git a/v1/test_SDK_snippets/discover_endpoints.py b/v1/test_SDK_snippets/discover_endpoints.py new file mode 100644 index 00000000..de5a6e40 --- /dev/null +++ b/v1/test_SDK_snippets/discover_endpoints.py @@ -0,0 +1,21 @@ +# scripts/discover_endpoints.py +import json, os, requests + +API_URL = "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" + +spec = requests.get(API_URL, timeout=(5,30)).json() + +# Collect all paths that have at least one Python sample +paths = [] +for p, methods in spec.get("paths", {}).items(): + for m in ("get","post"): + samples = (methods.get(m, {}) or {}).get("x-codeSamples") or [] + if any((s.get("lang") or "").lower().startswith("python") for s in samples): + paths.append(p) + break + +matrix = {"item": paths[:50]} # cap to 50 for demo +print("Discovered:", matrix) + +with open(os.environ["GITHUB_OUTPUT"], "a") as fh: + fh.write(f"items={json.dumps(matrix)}\n") \ No newline at end of file From aec58ddd771f8b99c1e1298e7a0f287753f95c3f Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:13:14 +0100 Subject: [PATCH 024/117] WIP --- .github/workflows/test_snippets.yml | 19 ++++++------------- .../.env.example | 0 .../discover_endpoints.py | 0 .../pyproject.toml | 0 .../test_python_SDK_snippets.py | 0 5 files changed, 6 insertions(+), 13 deletions(-) rename v1/{test_SDK_snippets => test_sdk_snippets}/.env.example (100%) rename v1/{test_SDK_snippets => test_sdk_snippets}/discover_endpoints.py (100%) rename v1/{test_SDK_snippets => test_sdk_snippets}/pyproject.toml (100%) rename v1/{test_SDK_snippets => test_sdk_snippets}/test_python_SDK_snippets.py (100%) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index ef26589a..4c3c9b3a 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -24,20 +24,13 @@ jobs: pip install requests - id: collect - run: | - python - <<'PY' - import json, os - # Pretend we "discovered" 3 items - values = ["x", "y", "z"] - matrix = {"item": values} - print("Discovered:", matrix) + - run: | + python -m pip install --upgrade pip + pip install requests - # Write to GitHub Actions output file - with open(os.environ["GITHUB_OUTPUT"], "a") as fh: - fh.write(f"items={json.dumps(matrix)}\n") - PY - - name: Echo raw output (debug) - run: echo "items = ${{ steps.collect.outputs.items }}" + - id: collect + run: python v1/test_sdk_snippets/discover_endpoints.py # <-- run script + - run: echo "items = ${{ steps.collect.outputs.items }}" echo-item: needs: discover diff --git a/v1/test_SDK_snippets/.env.example b/v1/test_sdk_snippets/.env.example similarity index 100% rename from v1/test_SDK_snippets/.env.example rename to v1/test_sdk_snippets/.env.example diff --git a/v1/test_SDK_snippets/discover_endpoints.py b/v1/test_sdk_snippets/discover_endpoints.py similarity index 100% rename from v1/test_SDK_snippets/discover_endpoints.py rename to v1/test_sdk_snippets/discover_endpoints.py diff --git a/v1/test_SDK_snippets/pyproject.toml b/v1/test_sdk_snippets/pyproject.toml similarity index 100% rename from v1/test_SDK_snippets/pyproject.toml rename to v1/test_sdk_snippets/pyproject.toml diff --git a/v1/test_SDK_snippets/test_python_SDK_snippets.py b/v1/test_sdk_snippets/test_python_SDK_snippets.py similarity index 100% rename from v1/test_SDK_snippets/test_python_SDK_snippets.py rename to v1/test_sdk_snippets/test_python_SDK_snippets.py From a0f8cacbe41cd7148ea84923bb6eb242dee0c4f5 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:15:36 +0100 Subject: [PATCH 025/117] WIP --- .github/workflows/test_snippets.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 4c3c9b3a..e6c123c2 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -23,11 +23,6 @@ jobs: python -m pip install --upgrade pip pip install requests - - id: collect - - run: | - python -m pip install --upgrade pip - pip install requests - - id: collect run: python v1/test_sdk_snippets/discover_endpoints.py # <-- run script - run: echo "items = ${{ steps.collect.outputs.items }}" From e4353ca9536c00a8f08ebac64eeb06c8daa8b8f3 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:26:43 +0100 Subject: [PATCH 026/117] WIP --- .github/workflows/test_snippets.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index e6c123c2..89825a2c 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -37,4 +37,6 @@ jobs: # Fallback to an empty matrix if items is blank (prevents fromJson('') errors) matrix: ${{ fromJson(needs.discover.outputs.items != '' && needs.discover.outputs.items || '{"item":[]}' ) }} steps: - - run: echo "Hello from ${{ matrix.item }}" \ No newline at end of file + - run: python v1/test_sdk_snippets/run_endpoint.py + env: + ENDPOINT: ${{ matrix.item }} \ No newline at end of file From b811f3544e2416405287e31287c8300eac4cbf79 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:28:39 +0100 Subject: [PATCH 027/117] WIP --- .github/workflows/test_snippets.yml | 2 +- v1/test_sdk_snippets/test_endpoint_snippet.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 v1/test_sdk_snippets/test_endpoint_snippet.py diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 89825a2c..01b1290f 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -37,6 +37,6 @@ jobs: # Fallback to an empty matrix if items is blank (prevents fromJson('') errors) matrix: ${{ fromJson(needs.discover.outputs.items != '' && needs.discover.outputs.items || '{"item":[]}' ) }} steps: - - run: python v1/test_sdk_snippets/run_endpoint.py + - run: python v1/test_sdk_snippets/test_endpoint_snippet.py env: ENDPOINT: ${{ matrix.item }} \ No newline at end of file diff --git a/v1/test_sdk_snippets/test_endpoint_snippet.py b/v1/test_sdk_snippets/test_endpoint_snippet.py new file mode 100644 index 00000000..7e718293 --- /dev/null +++ b/v1/test_sdk_snippets/test_endpoint_snippet.py @@ -0,0 +1,17 @@ +# v1/test_sdk_snippets/run_endpoint.py +import os, requests + +endpoint = os.environ.get("ENDPOINT") +if not endpoint: + raise SystemExit("ENDPOINT env var is missing") + +print(f"Running test for endpoint: {endpoint}") + +API_URL = "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" + +# Example: fetch spec and just confirm this endpoint exists +spec = requests.get(API_URL, timeout=(5,30)).json() +if endpoint not in spec.get("paths", {}): + raise SystemExit(f"❌ Endpoint {endpoint} not in spec") + +print(f"✅ Found {endpoint} in spec") \ No newline at end of file From c429141d305b3869d97caa08ac0faae70a2bd2c9 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:31:10 +0100 Subject: [PATCH 028/117] WIP --- .github/workflows/test_snippets.yml | 2 +- .../{test_endpoint_snippet.py => run_endpoint.py} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename v1/test_sdk_snippets/{test_endpoint_snippet.py => run_endpoint.py} (100%) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 01b1290f..89825a2c 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -37,6 +37,6 @@ jobs: # Fallback to an empty matrix if items is blank (prevents fromJson('') errors) matrix: ${{ fromJson(needs.discover.outputs.items != '' && needs.discover.outputs.items || '{"item":[]}' ) }} steps: - - run: python v1/test_sdk_snippets/test_endpoint_snippet.py + - run: python v1/test_sdk_snippets/run_endpoint.py env: ENDPOINT: ${{ matrix.item }} \ No newline at end of file diff --git a/v1/test_sdk_snippets/test_endpoint_snippet.py b/v1/test_sdk_snippets/run_endpoint.py similarity index 100% rename from v1/test_sdk_snippets/test_endpoint_snippet.py rename to v1/test_sdk_snippets/run_endpoint.py From 03d734d4864015c47de2f9ade7bfe2c443a48768 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:33:23 +0100 Subject: [PATCH 029/117] WIP --- .github/workflows/test_snippets.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 89825a2c..7d1deb0a 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -29,14 +29,20 @@ jobs: echo-item: needs: discover - # Only run if discover produced something JSON-ish if: ${{ needs.discover.outputs.items != '' }} runs-on: ubuntu-latest strategy: fail-fast: false - # Fallback to an empty matrix if items is blank (prevents fromJson('') errors) - matrix: ${{ fromJson(needs.discover.outputs.items != '' && needs.discover.outputs.items || '{"item":[]}' ) }} + matrix: ${{ fromJson(needs.discover.outputs.items) }} steps: + - uses: actions/checkout@v4 # <-- required in every job + - uses: actions/setup-python@v5 # <-- fresh VM, set up Python again + with: + python-version: "3.11" + - name: Install Python deps # <-- if your script needs them + run: | + python -m pip install --upgrade pip + pip install requests - run: python v1/test_sdk_snippets/run_endpoint.py env: ENDPOINT: ${{ matrix.item }} \ No newline at end of file From 6729e063abb4fa85d9448e239706ed6304e67fa6 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:36:56 +0100 Subject: [PATCH 030/117] WIP --- v1/test_sdk_snippets/run_endpoint.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/v1/test_sdk_snippets/run_endpoint.py b/v1/test_sdk_snippets/run_endpoint.py index 7e718293..c4038055 100644 --- a/v1/test_sdk_snippets/run_endpoint.py +++ b/v1/test_sdk_snippets/run_endpoint.py @@ -14,4 +14,6 @@ if endpoint not in spec.get("paths", {}): raise SystemExit(f"❌ Endpoint {endpoint} not in spec") -print(f"✅ Found {endpoint} in spec") \ No newline at end of file +print(f"✅ Found {endpoint} in spec") + + From 3552109f2ad8cd5e86247895254a56681be5f6d9 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:37:06 +0100 Subject: [PATCH 031/117] WIP --- v1/test_sdk_snippets/run_endpoint.py | 63 +++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/v1/test_sdk_snippets/run_endpoint.py b/v1/test_sdk_snippets/run_endpoint.py index c4038055..87284ce7 100644 --- a/v1/test_sdk_snippets/run_endpoint.py +++ b/v1/test_sdk_snippets/run_endpoint.py @@ -1,19 +1,60 @@ # v1/test_sdk_snippets/run_endpoint.py -import os, requests +import os +import sys +import requests +from dotenv import load_dotenv -endpoint = os.environ.get("ENDPOINT") -if not endpoint: - raise SystemExit("ENDPOINT env var is missing") +API_URL = "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" -print(f"Running test for endpoint: {endpoint}") +def load_api_key() -> str: + load_dotenv() + key = os.getenv("COMPASS_API_KEY") + if not key: + raise RuntimeError("COMPASS_API_KEY not set in environment") + return key -API_URL = "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" +def fetch_api_spec(url: str): + r = requests.get(url, timeout=(5, 30)) + r.raise_for_status() + return r.json() + +def get_python_code_for_path(spec, path: str) -> str: + """Return the FIRST Python code sample for the given path (checks get/post).""" + methods = spec["paths"].get(path) + if not methods: + raise ValueError(f"Path not found in spec: {path!r}") + for method in ("get", "post"): + samples = (methods.get(method, {}) or {}).get("x-codeSamples") or [] + for s in samples: + if (s.get("lang") or "").lower().startswith("python"): + return s["source"] + raise ValueError(f"No Python code sample found for path: {path!r}") + +def replace_with_secret(snippet: str, api_key: str) -> str: + return snippet.replace("", api_key) + +def main(): + # Endpoint comes from env var ENDPOINT or first CLI arg + endpoint = os.getenv("ENDPOINT") or (len(sys.argv) > 1 and sys.argv[1]) + if not endpoint: + print("Usage: run_endpoint.py (or set ENDPOINT env var)", file=sys.stderr) + sys.exit(2) -# Example: fetch spec and just confirm this endpoint exists -spec = requests.get(API_URL, timeout=(5,30)).json() -if endpoint not in spec.get("paths", {}): - raise SystemExit(f"❌ Endpoint {endpoint} not in spec") + api_key = load_api_key() + spec = fetch_api_spec(API_URL) -print(f"✅ Found {endpoint} in spec") + print(f"--- Running SDK snippet for {endpoint} ---") + code = get_python_code_for_path(spec, endpoint) + code = replace_with_secret(code, api_key) + # Execute snippet in isolated globals + globs = {"__name__": "__main__"} + try: + exec(compile(code, filename=f"", mode="exec"), globs, None) + print(f"✅ PASS: {endpoint}") + except Exception as e: + print(f"❌ FAIL: {endpoint} – {e}", file=sys.stderr) + sys.exit(1) +if __name__ == "__main__": + main() \ No newline at end of file From d4e813ca7e96920df804c0d44b69f7786336edab Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:39:08 +0100 Subject: [PATCH 032/117] WIP --- .github/workflows/test_snippets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 7d1deb0a..7aef2db7 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -42,7 +42,7 @@ jobs: - name: Install Python deps # <-- if your script needs them run: | python -m pip install --upgrade pip - pip install requests + pip install requests python-dotenv - run: python v1/test_sdk_snippets/run_endpoint.py env: ENDPOINT: ${{ matrix.item }} \ No newline at end of file From 1ccfc5cbd59b46d464e28537c95378e32f0da00e Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:43:02 +0100 Subject: [PATCH 033/117] WIP --- .github/workflows/test_snippets.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 7aef2db7..da2e44a1 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -31,6 +31,15 @@ jobs: needs: discover if: ${{ needs.discover.outputs.items != '' }} runs-on: ubuntu-latest + + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + ARBITRUM_RPC_URL: http://localhost:8547 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + strategy: fail-fast: false matrix: ${{ fromJson(needs.discover.outputs.items) }} From 7b76a8e3bf4c11eb44524e70f81f1c016410ca1d Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:43:15 +0100 Subject: [PATCH 034/117] WIP --- .github/workflows/test_snippets.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index da2e44a1..0f383e31 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -34,11 +34,11 @@ jobs: env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - ARBITRUM_RPC_URL: http://localhost:8547 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + #PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + #ARBITRUM_RPC_URL: http://localhost:8547 + #SERVER_URL: http://localhost:80 + #NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + #UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} strategy: fail-fast: false From 9ff0edd1c9b56750c83d224f7e975bebaac4f20a Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:48:12 +0100 Subject: [PATCH 035/117] WIP --- .github/workflows/test_snippets.yml | 30 ++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 0f383e31..24af25c5 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -11,21 +11,29 @@ jobs: outputs: items: ${{ steps.collect.outputs.items }} # <-- expose "items" steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.11" + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh - - name: Install Python deps + - name: Install dependencies + working-directory: v1/pendle/python run: | - python -m pip install --upgrade pip - pip install requests + if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then + echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" + uv add compass-api-sdk==$UV_PACKAGE_VERSION + fi + uv sync + uv pip freeze + + - name: collect + working-directory: v1/test_sdk_snippets + run: ./.venv/bin/python discover_endpoints.py - - id: collect - run: python v1/test_sdk_snippets/discover_endpoints.py # <-- run script - - run: echo "items = ${{ steps.collect.outputs.items }}" +# - id: collect +# run: python v1/test_sdk_snippets/discover_endpoints.py # <-- run script +# - run: echo "items = ${{ steps.collect.outputs.items }}" echo-item: needs: discover From 0996d9f21ae9867ad3ddf2f3bb3ecddcb5395903 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:49:16 +0100 Subject: [PATCH 036/117] WIP --- .github/workflows/test_snippets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 24af25c5..4d72711c 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -18,7 +18,7 @@ jobs: run: curl -LsSf https://astral.sh/uv/install.sh | sh - name: Install dependencies - working-directory: v1/pendle/python + working-directory: v1/test_sdk_snippets run: | if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" From bb50645786a037a86020e7961ad16a82ed3babb8 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:50:46 +0100 Subject: [PATCH 037/117] WIP --- .github/workflows/test_snippets.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 4d72711c..f4a7e042 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -8,6 +8,15 @@ on: jobs: discover: runs-on: ubuntu-latest + + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + #PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + #ARBITRUM_RPC_URL: http://localhost:8547 + #SERVER_URL: http://localhost:80 + #NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + outputs: items: ${{ steps.collect.outputs.items }} # <-- expose "items" steps: From 949a51e532e276309306aaa464a53673526a7151 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:52:08 +0100 Subject: [PATCH 038/117] WIP --- .github/workflows/test_snippets.yml | 30 +++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index f4a7e042..a22373da 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -55,20 +55,30 @@ jobs: #ARBITRUM_RPC_URL: http://localhost:8547 #SERVER_URL: http://localhost:80 #NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - #UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} strategy: fail-fast: false matrix: ${{ fromJson(needs.discover.outputs.items) }} steps: - - uses: actions/checkout@v4 # <-- required in every job - - uses: actions/setup-python@v5 # <-- fresh VM, set up Python again - with: - python-version: "3.11" - - name: Install Python deps # <-- if your script needs them + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Install dependencies + working-directory: v1/test_sdk_snippets run: | - python -m pip install --upgrade pip - pip install requests python-dotenv - - run: python v1/test_sdk_snippets/run_endpoint.py + if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then + echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" + uv add compass-api-sdk==$UV_PACKAGE_VERSION + fi + uv sync + uv pip freeze + + - name: collect + working-directory: v1/test_sdk_snippets + run: ./.venv/bin/python run_endpoint.py env: - ENDPOINT: ${{ matrix.item }} \ No newline at end of file + ENDPOINT: ${{ matrix.item }} +# - run: python v1/test_sdk_snippets/run_endpoint.py +# env: +# ENDPOINT: ${{ matrix.item }} \ No newline at end of file From 7426bf09327fbc9fa5b5844de750972d4e8fb687 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:54:46 +0100 Subject: [PATCH 039/117] WIP --- .github/workflows/test_snippets.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index a22373da..d2c70702 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -6,6 +6,26 @@ on: workflow_dispatch: jobs: + + validate-environment: + runs-on: ubuntu-latest + outputs: + environment: ${{ steps.validate.outputs.environment }} + steps: + - name: Validate environment input + id: validate + run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" || "${{ github.event_name }}" == "workflow_call" ]]; then + ENVIRONMENT="${{ inputs.environment }}" + else + ENVIRONMENT="local" + fi + if [[ "$ENVIRONMENT" != "staging" && "$ENVIRONMENT" != "prod" && "$ENVIRONMENT" != "local" ]]; then + echo "❌ Error: Invalid environment '$ENVIRONMENT'. Must be 'staging' or 'prod' or 'local'." + exit 1 + fi + echo "✅ Environment '$ENVIRONMENT' is valid" + echo "environment=$ENVIRONMENT" >> $GITHUB_OUTPUT discover: runs-on: ubuntu-latest From 5d5d0873ec1e3facbeac0cc3c74ad50fa8e05187 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:57:36 +0100 Subject: [PATCH 040/117] WIP --- .github/workflows/test_snippets.yml | 83 ++++++++++++++++------------- 1 file changed, 45 insertions(+), 38 deletions(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index d2c70702..7360eb7c 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -26,79 +26,86 @@ jobs: fi echo "✅ Environment '$ENVIRONMENT' is valid" echo "environment=$ENVIRONMENT" >> $GITHUB_OUTPUT + discover: runs-on: ubuntu-latest - env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - #PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - #ARBITRUM_RPC_URL: http://localhost:8547 - #SERVER_URL: http://localhost:80 - #NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - + # Provide a default if the upstream job isn't present: + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version || 'latest' }} outputs: - items: ${{ steps.collect.outputs.items }} # <-- expose "items" + items: ${{ steps.collect.outputs.items }} + steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + echo "$HOME/.local/bin" >> $GITHUB_PATH - - name: Install dependencies + - name: Install dependencies (uv) working-directory: v1/test_sdk_snippets + env: + UV_VERSION: ${{ env.UV_PACKAGE_VERSION }} run: | - if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then - echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" - uv add compass-api-sdk==$UV_PACKAGE_VERSION + # Default to latest if empty + UV_VERSION="${UV_VERSION:-latest}" + echo "UV_VERSION=$UV_VERSION" + # Create a venv and install deps needed by your scripts/snippets + uv venv .venv + source .venv/bin/activate + if [[ "$UV_VERSION" == "latest" ]]; then + uv pip install "compass-api-sdk" requests python-dotenv + else + uv pip install "compass-api-sdk==${UV_VERSION}" requests python-dotenv fi - uv sync uv pip freeze - - name: collect + - id: collect + name: Collect endpoints (writes items=... to $GITHUB_OUTPUT) working-directory: v1/test_sdk_snippets run: ./.venv/bin/python discover_endpoints.py -# - id: collect -# run: python v1/test_sdk_snippets/discover_endpoints.py # <-- run script -# - run: echo "items = ${{ steps.collect.outputs.items }}" - echo-item: needs: discover if: ${{ needs.discover.outputs.items != '' }} runs-on: ubuntu-latest - env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - #PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - #ARBITRUM_RPC_URL: http://localhost:8547 - #SERVER_URL: http://localhost:80 - #NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version || 'latest' }} strategy: fail-fast: false matrix: ${{ fromJson(needs.discover.outputs.items) }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + echo "$HOME/.local/bin" >> $GITHUB_PATH - - name: Install dependencies + - name: Install dependencies (uv) working-directory: v1/test_sdk_snippets + env: + UV_VERSION: ${{ env.UV_PACKAGE_VERSION }} run: | - if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then - echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" - uv add compass-api-sdk==$UV_PACKAGE_VERSION + UV_VERSION="${UV_VERSION:-latest}" + echo "UV_VERSION=$UV_VERSION" + uv venv .venv + source .venv/bin/activate + if [[ "$UV_VERSION" == "latest" ]]; then + uv pip install "compass-api-sdk" requests python-dotenv + else + uv pip install "compass-api-sdk==${UV_VERSION}" requests python-dotenv fi - uv sync uv pip freeze - - name: collect + - name: Run endpoint snippet working-directory: v1/test_sdk_snippets run: ./.venv/bin/python run_endpoint.py env: - ENDPOINT: ${{ matrix.item }} -# - run: python v1/test_sdk_snippets/run_endpoint.py -# env: -# ENDPOINT: ${{ matrix.item }} \ No newline at end of file + ENDPOINT: ${{ matrix.item }} \ No newline at end of file From ff2c959f76a89ce82b0c72bfafb7ee630553a81b Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:59:00 +0100 Subject: [PATCH 041/117] WIP --- .github/workflows/test_snippets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 7360eb7c..284793a0 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -68,7 +68,7 @@ jobs: working-directory: v1/test_sdk_snippets run: ./.venv/bin/python discover_endpoints.py - echo-item: + test: needs: discover if: ${{ needs.discover.outputs.items != '' }} runs-on: ubuntu-latest From 47c4d68fa87c1c941db753760abe295204c46a96 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 16:59:59 +0100 Subject: [PATCH 042/117] WIP --- v1/test_sdk_snippets/run_endpoint.py | 1 + 1 file changed, 1 insertion(+) diff --git a/v1/test_sdk_snippets/run_endpoint.py b/v1/test_sdk_snippets/run_endpoint.py index 87284ce7..497db7bf 100644 --- a/v1/test_sdk_snippets/run_endpoint.py +++ b/v1/test_sdk_snippets/run_endpoint.py @@ -46,6 +46,7 @@ def main(): print(f"--- Running SDK snippet for {endpoint} ---") code = get_python_code_for_path(spec, endpoint) code = replace_with_secret(code, api_key) + print(code) # Execute snippet in isolated globals globs = {"__name__": "__main__"} From 4c95c0e7732b216cdad194aed3f2d086ec9fe251 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 17:00:30 +0100 Subject: [PATCH 043/117] WIP --- v1/test_sdk_snippets/run_endpoint.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/v1/test_sdk_snippets/run_endpoint.py b/v1/test_sdk_snippets/run_endpoint.py index 497db7bf..b75b4190 100644 --- a/v1/test_sdk_snippets/run_endpoint.py +++ b/v1/test_sdk_snippets/run_endpoint.py @@ -46,7 +46,10 @@ def main(): print(f"--- Running SDK snippet for {endpoint} ---") code = get_python_code_for_path(spec, endpoint) code = replace_with_secret(code, api_key) - print(code) + print(f""" + ---------- +{code} +""") # Execute snippet in isolated globals globs = {"__name__": "__main__"} From 24779aafa8407b700447e437f5517ed7566b2100 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 17:01:43 +0100 Subject: [PATCH 044/117] WIP --- .github/workflows/test_snippets.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 284793a0..2dbd13e2 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -27,7 +27,7 @@ jobs: echo "✅ Environment '$ENVIRONMENT' is valid" echo "environment=$ENVIRONMENT" >> $GITHUB_OUTPUT - discover: + discover_sdk_snippets: runs-on: ubuntu-latest env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} @@ -69,15 +69,15 @@ jobs: run: ./.venv/bin/python discover_endpoints.py test: - needs: discover - if: ${{ needs.discover.outputs.items != '' }} + needs: discover_sdk_snippets + if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} runs-on: ubuntu-latest env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version || 'latest' }} strategy: fail-fast: false - matrix: ${{ fromJson(needs.discover.outputs.items) }} + matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} steps: - name: Checkout repository From dcdef7ee2b015c466e769c6605c80ba17eacee4b Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 18 Sep 2025 17:02:34 +0100 Subject: [PATCH 045/117] WIP --- .github/workflows/test_snippets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_snippets.yml index 2dbd13e2..57fe740d 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_snippets.yml @@ -69,7 +69,7 @@ jobs: run: ./.venv/bin/python discover_endpoints.py test: - needs: discover_sdk_snippets + needs: discover_sdk_snippets # if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} runs-on: ubuntu-latest env: From 87a0e167f06dca5436ba729c9983303eaf13fbb7 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Mon, 22 Sep 2025 09:09:44 +0100 Subject: [PATCH 046/117] remove redundant file --- .../test_python_SDK_snippets.py | 117 ------------------ 1 file changed, 117 deletions(-) delete mode 100644 v1/test_sdk_snippets/test_python_SDK_snippets.py diff --git a/v1/test_sdk_snippets/test_python_SDK_snippets.py b/v1/test_sdk_snippets/test_python_SDK_snippets.py deleted file mode 100644 index d97c18ed..00000000 --- a/v1/test_sdk_snippets/test_python_SDK_snippets.py +++ /dev/null @@ -1,117 +0,0 @@ -import os -import requests -from dotenv import load_dotenv -from typing import List, Dict - -def load_api_key() -> str: - """Load and validate the COMPASS_API_KEY from environment.""" - load_dotenv() - key = os.getenv("COMPASS_API_KEY") - if not key: - raise RuntimeError("COMPASS_API_KEY not set in environment") - return key - -def fetch_api_spec(url: str) -> Dict: - """Fetch the API spec and return the parsed JSON.""" - resp = requests.get(url) - resp.raise_for_status() - return resp.json() - -def get_python_code(path: str, spec: Dict) -> str: - """Return the first Python code sample for a given path.""" - for method in ("get", "post"): - samples = spec["paths"][path].get(method, {}).get("x-codeSamples") - if samples: - return samples[0]["source"] - raise ValueError(f"No Python code sample found for path: {path!r}") - -def replace_with_secret(snippet: str, api_key: str) -> str: - """Inject the real API key into a code snippet.""" - return snippet.replace("", api_key) - -def filter_paths(all_paths: List[str], broken: List[str]) -> List[str]: - """Remove any broken paths in one go.""" - broken_set = set(broken) - return [p for p in all_paths if p not in broken_set] - -def main(): - API_URL = "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" - BROKEN = [ - "/v0/aave/supply", - "/v0/aave/borrow", - "/v0/aave/repay", - "/v0/aave/withdraw", - "/v0/aave/historical_transactions/get", - "/v0/aerodrome_slipstream/swap/sell_exactly", - "/v0/aerodrome_slipstream/swap/buy_exactly", - "/v0/aerodrome_slipstream/liquidity_provision/mint", - # "/v0/aerodrome_slipstream/liquidity_provision/increase", - # "/v0/aerodrome_slipstream/liquidity_provision/withdraw", - # "/v0/morpho/markets", - # "/v0/morpho/allowance", - # "/v0/morpho/deposit", - # "/v0/morpho/withdraw", - # "/v0/morpho/supply_collateral", - # "/v0/morpho/withdraw_collateral", - # "/v0/morpho/borrow", - # "/v0/morpho/repay", - # "/v0/morpho/vault", - # "/v0/morpho/vaults", - # "/v0/morpho/user_position", - # "/v0/sky/buy", - # "/v0/sky/sell", - # "/v0/sky/deposit", - # "/v0/sky/withdraw", - # "/v0/token/balance/get", - # "/v0/token/transfer", - # "/v0/token/price/get", - # "/v0/uniswap/quote/buy_exactly/get", - # "/v0/uniswap/quote/sell_exactly/get", - # "/v0/uniswap/swap/buy_exactly", - # "/v0/uniswap/swap/sell_exactly", - # "/v0/uniswap/liquidity_provision/increase", - # "/v0/uniswap/liquidity_provision/mint", - # "/v0/uniswap/liquidity_provision/withdraw", - # "/v0/generic/portfolio/get", - # "/v0/generic/visualize_portfolio/get", - # "/v0/generic/wrap_eth", - # "/v0/generic/unwrap_weth", - # "/v0/generic/allowance/set", - # "/v0/pendle/buy_pt", - # "/v0/pendle/sell_pt", - # "/v0/pendle/buy_yt", - # "/v0/pendle/sell_yt", - # "/v0/pendle/redeem_yield", - # "/v0/pendle/add_liquidity", - # "/v0/pendle/remove_liquidity", - ] - - api_key = load_api_key() - spec = fetch_api_spec(API_URL) - - all_paths = list(spec.get("paths", {})) - new_broken = [] - - for path in all_paths: - print(f"----------------\nendpoint: {path}") - try: - code = get_python_code(path, spec) - exec(replace_with_secret(code, api_key)) - except Exception as e: - print(f"❌ Failed: {path} – {e}") - new_broken.append(path) - - print("\nFailed paths:") - for path in new_broken: - print(f"- {path}") - #good_paths = filter_paths(all_paths, BROKEN) - - # for path in good_paths: - # print(f"----------------\n" - # f"endpoint: {path}") - # code = get_python_code(path, spec) - # exec(replace_with_secret(code, api_key)) - -if __name__ == "__main__": - - main() \ No newline at end of file From 211870af5c0b321721b5171c7ad5ff672f64340e Mon Sep 17 00:00:00 2001 From: ccosnett Date: Mon, 22 Sep 2025 09:21:31 +0100 Subject: [PATCH 047/117] change filename --- ...ppets.yml => test_python_sdk_snippets.yml} | 2 +- .github/workflows/test_usecases_v0.yml | 23 + .github/workflows/test_usecases_v1.yml | 711 ++++++++++++++++++ 3 files changed, 735 insertions(+), 1 deletion(-) rename .github/workflows/{test_snippets.yml => test_python_sdk_snippets.yml} (99%) create mode 100644 .github/workflows/test_usecases_v0.yml create mode 100644 .github/workflows/test_usecases_v1.yml diff --git a/.github/workflows/test_snippets.yml b/.github/workflows/test_python_sdk_snippets.yml similarity index 99% rename from .github/workflows/test_snippets.yml rename to .github/workflows/test_python_sdk_snippets.yml index 57fe740d..b84856dc 100644 --- a/.github/workflows/test_snippets.yml +++ b/.github/workflows/test_python_sdk_snippets.yml @@ -1,4 +1,4 @@ -name: workflow 1 +name: test_python_sdk_snippets on: pull_request: diff --git a/.github/workflows/test_usecases_v0.yml b/.github/workflows/test_usecases_v0.yml new file mode 100644 index 00000000..57e35d68 --- /dev/null +++ b/.github/workflows/test_usecases_v0.yml @@ -0,0 +1,23 @@ +name: test_usecases_v_zero + +on: + schedule: + # Runs at 00:00 UTC every day + - cron: "0 0 * * *" + pull_request: + branches: + - main + workflow_dispatch: + +permissions: + id-token: write + contents: write + +jobs: + do-nothing: + runs-on: ubuntu-latest + + steps: + - name: Do nothing + run: | + echo "I am doing nothing" diff --git a/.github/workflows/test_usecases_v1.yml b/.github/workflows/test_usecases_v1.yml new file mode 100644 index 00000000..b0d08099 --- /dev/null +++ b/.github/workflows/test_usecases_v1.yml @@ -0,0 +1,711 @@ +name: test_usecases_v_one + +on: + schedule: + # Runs at 00:00 UTC every day + - cron: "0 0 * * *" + pull_request: + branches: + - main + workflow_dispatch: + inputs: + environment: + description: "Environment to test" + required: true + type: string + + workflow_call: + inputs: + environment: + description: "Environment to test" + required: true + type: string + +permissions: + id-token: write + contents: write + +env: + AWS_ECR_STS_ROLE: arn:aws:iam::688567264391:role/DojoApiCIRole + +jobs: + validate-environment: + runs-on: ubuntu-latest + outputs: + environment: ${{ steps.validate.outputs.environment }} + steps: + - name: Validate environment input + id: validate + run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" || "${{ github.event_name }}" == "workflow_call" ]]; then + ENVIRONMENT="${{ inputs.environment }}" + else + ENVIRONMENT="local" + fi + if [[ "$ENVIRONMENT" != "staging" && "$ENVIRONMENT" != "prod" && "$ENVIRONMENT" != "local" ]]; then + echo "❌ Error: Invalid environment '$ENVIRONMENT'. Must be 'staging' or 'prod' or 'local'." + exit 1 + fi + echo "✅ Environment '$ENVIRONMENT' is valid" + echo "environment=$ENVIRONMENT" >> $GITHUB_OUTPUT + + set-versions: + needs: [validate-environment] + runs-on: ubuntu-latest + outputs: + npm_package_version: ${{ steps.set-versions.outputs.npm_package_version }} + uv_package_version: ${{ steps.set-versions.outputs.uv_package_version }} + steps: + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "20" + + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Set versions + id: set-versions + run: | + if [[ "${{ needs.validate-environment.outputs.environment }}" == "staging" ]]; then + NPM_PACKAGE_VERSION=$(npm view @compass-labs/api-sdk versions --json | jq -r '.[]' | grep -E 'rc|alpha|beta' | sort -V | tail -1) + UV_PACKAGE_VERSION="$(curl -s https://pypi.org/pypi/compass-api-sdk/json | jq -r '.releases | keys | .[]' | grep -E 'rc|a|b|dev' | sort -V | tail -1)" + else + NPM_PACKAGE_VERSION="latest" + UV_PACKAGE_VERSION="latest" + fi + + echo "npm_package_version=$NPM_PACKAGE_VERSION" >> $GITHUB_OUTPUT + echo "uv_package_version=$UV_PACKAGE_VERSION" >> $GITHUB_OUTPUT + + + run-pendle-typescript: + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + ARBITRUM_RPC_URL: http://localhost:8547 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "20" + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + + - name: Install dependencies + working-directory: v1/pendle/typescript + run: | + npm install + if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then + npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION + fi + npm list + + - name: Build application + working-directory: v1/pendle/typescript + run: npm run build + + - name: Run application + working-directory: v1/pendle/typescript + run: npm run start + + run-pendle-python: + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + ARBITRUM_RPC_URL: http://localhost:8547 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/pendle/python + run: | + if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then + echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" + uv add compass-api-sdk==$UV_PACKAGE_VERSION + fi + uv sync + uv pip freeze + + - name: Run example + working-directory: v1/pendle/python + run: ./.venv/bin/python src/main.py + + run-typescript-basic-examples-deposit-on-morpho: # + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + BASE_RPC_URL: http://localhost:8546 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "20" + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/basic_examples/deposit_on_morpho/typescript + run: | + npm install + if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then + npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION + fi + npm list + + - name: Build application + working-directory: v1/basic_examples/deposit_on_morpho/typescript + run: npm run build + + - name: Run application + working-directory: v1/basic_examples/deposit_on_morpho/typescript + run: npm run start + + + run-python----basic-examples-deposit-on-morpho: # + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + BASE_RPC_URL: http://localhost:8546 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/basic_examples/deposit_on_morpho/python + run: | + if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then + echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" + uv add compass-api-sdk==$UV_PACKAGE_VERSION + fi + uv sync + uv pip freeze + + - name: Run example + working-directory: v1/basic_examples/deposit_on_morpho/python + run: ./.venv/bin/python main.py #src/main.py + + + run-typescript-basic-examples-deposit-on-aave: + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + BASE_RPC_URL: http://localhost:8546 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "20" + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/basic_examples/deposit_on_aave/typescript + run: | + npm install + if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then + npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION + fi + npm list + + - name: Build application + working-directory: v1/basic_examples/deposit_on_aave/typescript + run: npm run build + + - name: Run application + working-directory: v1/basic_examples/deposit_on_aave/typescript + run: npm run start + + + run-python----basic-examples-deposit-on-aave: + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + BASE_RPC_URL: http://localhost:8546 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/basic_examples/deposit_on_aave/python + run: | + if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then + echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" + uv add compass-api-sdk==$UV_PACKAGE_VERSION + fi + uv sync + uv pip freeze + + - name: Run example + working-directory: v1/basic_examples/deposit_on_aave/python + run: ./.venv/bin/python main.py #src/main.py + + run-typescript-transaction_bundler_embed_a_fee_in_tx: # + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + BASE_RPC_URL: http://localhost:8546 + #ETHEREUM_RPC_URL: http://localhost:8545 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "20" + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/typescript + run: | + npm install + if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then + npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION + fi + npm list + + - name: Build application + working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/typescript + run: npm run build + + - name: Run application + working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/typescript + run: npm run start + + run-python----transaction_bundler_embed_a_fee_in_tx: # + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + BASE_RPC_URL: http://localhost:8546 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/python + run: | + if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then + echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" + uv add compass-api-sdk==$UV_PACKAGE_VERSION + fi + uv sync + uv pip freeze + + - name: Run example + working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/python + run: ./.venv/bin/python main.py #src/main.py + + + run-transaction-bundler-typescript: + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + ETHEREUM_RPC_URL: http://localhost:8545 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "20" + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/transaction_bundler/typescript + run: | + npm install + if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then + npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION + fi + npm list + + - name: Build application + working-directory: v1/transaction_bundler/typescript + run: npm run build + + - name: Run application + working-directory: v1/transaction_bundler/typescript + run: npm run start + + run-transaction-bundler-python: + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + ETHEREUM_RPC_URL: http://localhost:8545 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/transaction_bundler/python + run: | + if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then + echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" + uv add compass-api-sdk==$UV_PACKAGE_VERSION + fi + uv sync + uv pip freeze + + - name: Run example + working-directory: v1/transaction_bundler/python + run: ./.venv/bin/python src/main.py + + run-aave-looping-typescript: + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + ETHEREUM_RPC_URL: http://localhost:8545 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "20" + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/aave_looping/typescript + run: | + npm install + if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then + npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION + fi + npm list + + - name: Build application + working-directory: v1/aave_looping/typescript + run: npm run build + + - name: Run application + working-directory: v1/aave_looping/typescript + run: npm run start + + run-aave-looping-python: + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + ETHEREUM_RPC_URL: http://localhost:8545 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/aave_looping/python + run: | + if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then + echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" + uv add compass-api-sdk==$UV_PACKAGE_VERSION + fi + uv sync + uv pip freeze + + - name: Run example + working-directory: v1/aave_looping/python + run: ./.venv/bin/python src/main.py + + failure-alert: + if: failure() && github.event_name == 'schedule' # Runs only if a previous job failed & triggered by cron + runs-on: ubuntu-latest + needs: + [ + run-pendle-typescript, + run-pendle-python, + run-transaction-bundler-typescript, + run-transaction-bundler-python, + run-aave-looping-typescript, + run-aave-looping-python, + ] + steps: + - name: Send failure notification + run: | + curl -X POST "https://allquiet.app/api/webhook/829f846c-4dfa-4a58-ab33-eafae34a57c9" \ + -H "Content-Type: application/json" \ + -d '{"status": "Open", "severity": "Critical", "message": "GitHub workflow failed", "run_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' From 1d60c8968ef4c19adf67ba4c98868425189d1c44 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Mon, 22 Sep 2025 10:23:49 +0100 Subject: [PATCH 048/117] simplify --- .../workflows/test_python_sdk_snippets.yml | 82 +++++-------------- 1 file changed, 21 insertions(+), 61 deletions(-) diff --git a/.github/workflows/test_python_sdk_snippets.yml b/.github/workflows/test_python_sdk_snippets.yml index b84856dc..d4a1ce4c 100644 --- a/.github/workflows/test_python_sdk_snippets.yml +++ b/.github/workflows/test_python_sdk_snippets.yml @@ -7,32 +7,11 @@ on: jobs: - validate-environment: - runs-on: ubuntu-latest - outputs: - environment: ${{ steps.validate.outputs.environment }} - steps: - - name: Validate environment input - id: validate - run: | - if [[ "${{ github.event_name }}" == "workflow_dispatch" || "${{ github.event_name }}" == "workflow_call" ]]; then - ENVIRONMENT="${{ inputs.environment }}" - else - ENVIRONMENT="local" - fi - if [[ "$ENVIRONMENT" != "staging" && "$ENVIRONMENT" != "prod" && "$ENVIRONMENT" != "local" ]]; then - echo "❌ Error: Invalid environment '$ENVIRONMENT'. Must be 'staging' or 'prod' or 'local'." - exit 1 - fi - echo "✅ Environment '$ENVIRONMENT' is valid" - echo "environment=$ENVIRONMENT" >> $GITHUB_OUTPUT - discover_sdk_snippets: runs-on: ubuntu-latest env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - # Provide a default if the upstream job isn't present: - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version || 'latest' }} + outputs: items: ${{ steps.collect.outputs.items }} @@ -40,33 +19,27 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Install uv - run: | - curl -LsSf https://astral.sh/uv/install.sh | sh - echo "$HOME/.local/bin" >> $GITHUB_PATH + - name: Setup uv and Python + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.12" - name: Install dependencies (uv) working-directory: v1/test_sdk_snippets - env: - UV_VERSION: ${{ env.UV_PACKAGE_VERSION }} - run: | - # Default to latest if empty - UV_VERSION="${UV_VERSION:-latest}" - echo "UV_VERSION=$UV_VERSION" - # Create a venv and install deps needed by your scripts/snippets - uv venv .venv - source .venv/bin/activate - if [[ "$UV_VERSION" == "latest" ]]; then - uv pip install "compass-api-sdk" requests python-dotenv - else - uv pip install "compass-api-sdk==${UV_VERSION}" requests python-dotenv - fi - uv pip freeze + run: uv sync - id: collect name: Collect endpoints (writes items=... to $GITHUB_OUTPUT) working-directory: v1/test_sdk_snippets - run: ./.venv/bin/python discover_endpoints.py + run: uv run python discover_endpoints.py + + - name: Print collected items + run: | + cat > items.json <<'JSON' + ${{ steps.collect.outputs.items }} + JSON + echo "Collected items ✅ (pretty):" + jq . items.json | tee items.pretty.json test: needs: discover_sdk_snippets # @@ -74,7 +47,6 @@ jobs: runs-on: ubuntu-latest env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version || 'latest' }} strategy: fail-fast: false matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} @@ -83,29 +55,17 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Install uv - run: | - curl -LsSf https://astral.sh/uv/install.sh | sh - echo "$HOME/.local/bin" >> $GITHUB_PATH + - name: Setup uv and Python + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.12" - name: Install dependencies (uv) working-directory: v1/test_sdk_snippets - env: - UV_VERSION: ${{ env.UV_PACKAGE_VERSION }} - run: | - UV_VERSION="${UV_VERSION:-latest}" - echo "UV_VERSION=$UV_VERSION" - uv venv .venv - source .venv/bin/activate - if [[ "$UV_VERSION" == "latest" ]]; then - uv pip install "compass-api-sdk" requests python-dotenv - else - uv pip install "compass-api-sdk==${UV_VERSION}" requests python-dotenv - fi - uv pip freeze + run: uv sync - name: Run endpoint snippet working-directory: v1/test_sdk_snippets - run: ./.venv/bin/python run_endpoint.py + run: uv run python run_endpoint.py env: ENDPOINT: ${{ matrix.item }} \ No newline at end of file From e5827c491e4aa91d4c4f5880155aaed126147a25 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Mon, 22 Sep 2025 10:46:29 +0100 Subject: [PATCH 049/117] WIP --- .github/workflows/test_python_sdk_snippets.yml | 8 ++++---- v1/test_sdk_snippets/{ => python}/.env.example | 0 v1/test_sdk_snippets/{ => python}/discover_endpoints.py | 0 v1/test_sdk_snippets/{ => python}/pyproject.toml | 0 v1/test_sdk_snippets/{ => python}/run_endpoint.py | 0 5 files changed, 4 insertions(+), 4 deletions(-) rename v1/test_sdk_snippets/{ => python}/.env.example (100%) rename v1/test_sdk_snippets/{ => python}/discover_endpoints.py (100%) rename v1/test_sdk_snippets/{ => python}/pyproject.toml (100%) rename v1/test_sdk_snippets/{ => python}/run_endpoint.py (100%) diff --git a/.github/workflows/test_python_sdk_snippets.yml b/.github/workflows/test_python_sdk_snippets.yml index d4a1ce4c..b7ca6726 100644 --- a/.github/workflows/test_python_sdk_snippets.yml +++ b/.github/workflows/test_python_sdk_snippets.yml @@ -25,12 +25,12 @@ jobs: python-version: "3.12" - name: Install dependencies (uv) - working-directory: v1/test_sdk_snippets + working-directory: v1/test_sdk_snippets/python run: uv sync - id: collect name: Collect endpoints (writes items=... to $GITHUB_OUTPUT) - working-directory: v1/test_sdk_snippets + working-directory: v1/test_sdk_snippets/python run: uv run python discover_endpoints.py - name: Print collected items @@ -61,11 +61,11 @@ jobs: python-version: "3.12" - name: Install dependencies (uv) - working-directory: v1/test_sdk_snippets + working-directory: v1/test_sdk_snippets/python run: uv sync - name: Run endpoint snippet - working-directory: v1/test_sdk_snippets + working-directory: v1/test_sdk_snippets/python run: uv run python run_endpoint.py env: ENDPOINT: ${{ matrix.item }} \ No newline at end of file diff --git a/v1/test_sdk_snippets/.env.example b/v1/test_sdk_snippets/python/.env.example similarity index 100% rename from v1/test_sdk_snippets/.env.example rename to v1/test_sdk_snippets/python/.env.example diff --git a/v1/test_sdk_snippets/discover_endpoints.py b/v1/test_sdk_snippets/python/discover_endpoints.py similarity index 100% rename from v1/test_sdk_snippets/discover_endpoints.py rename to v1/test_sdk_snippets/python/discover_endpoints.py diff --git a/v1/test_sdk_snippets/pyproject.toml b/v1/test_sdk_snippets/python/pyproject.toml similarity index 100% rename from v1/test_sdk_snippets/pyproject.toml rename to v1/test_sdk_snippets/python/pyproject.toml diff --git a/v1/test_sdk_snippets/run_endpoint.py b/v1/test_sdk_snippets/python/run_endpoint.py similarity index 100% rename from v1/test_sdk_snippets/run_endpoint.py rename to v1/test_sdk_snippets/python/run_endpoint.py From 4d24f2beba74080f2c3bf8086dab98bb2fbb9bbe Mon Sep 17 00:00:00 2001 From: ccosnett Date: Mon, 22 Sep 2025 12:31:38 +0100 Subject: [PATCH 050/117] WIP --- v1/test_sdk_snippets/python/run_endpoint.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/v1/test_sdk_snippets/python/run_endpoint.py b/v1/test_sdk_snippets/python/run_endpoint.py index b75b4190..1bb89204 100644 --- a/v1/test_sdk_snippets/python/run_endpoint.py +++ b/v1/test_sdk_snippets/python/run_endpoint.py @@ -3,6 +3,8 @@ import sys import requests from dotenv import load_dotenv +import subprocess +import shlex API_URL = "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" @@ -46,19 +48,18 @@ def main(): print(f"--- Running SDK snippet for {endpoint} ---") code = get_python_code_for_path(spec, endpoint) code = replace_with_secret(code, api_key) - print(f""" - ---------- -{code} -""") + # Write snippet to a simple file and run it + script_path = os.path.join(os.getcwd(), "snippet.py") + with open(script_path, "w", encoding="utf-8") as f: + f.write(code) - # Execute snippet in isolated globals - globs = {"__name__": "__main__"} try: - exec(compile(code, filename=f"", mode="exec"), globs, None) + cmd = f"{shlex.quote(sys.executable)} {shlex.quote(script_path)}" + subprocess.run(cmd, shell=True, check=True) print(f"✅ PASS: {endpoint}") - except Exception as e: - print(f"❌ FAIL: {endpoint} – {e}", file=sys.stderr) - sys.exit(1) + except subprocess.CalledProcessError as e: + print(f"❌ FAIL: {endpoint} – exit code {e.returncode}", file=sys.stderr) + sys.exit(e.returncode) if __name__ == "__main__": main() \ No newline at end of file From 2c52c93001c10693f4322f80eb5d084df7c108aa Mon Sep 17 00:00:00 2001 From: ccosnett Date: Mon, 22 Sep 2025 12:52:47 +0100 Subject: [PATCH 051/117] WIP --- v1/test_sdk_snippets/python/run_endpoint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v1/test_sdk_snippets/python/run_endpoint.py b/v1/test_sdk_snippets/python/run_endpoint.py index 1bb89204..bd94971c 100644 --- a/v1/test_sdk_snippets/python/run_endpoint.py +++ b/v1/test_sdk_snippets/python/run_endpoint.py @@ -45,7 +45,7 @@ def main(): api_key = load_api_key() spec = fetch_api_spec(API_URL) - print(f"--- Running SDK snippet for {endpoint} ---") + print(f"--- Running python SDK snippet for {endpoint} ---") code = get_python_code_for_path(spec, endpoint) code = replace_with_secret(code, api_key) # Write snippet to a simple file and run it From 7ca7774ed7c25abcd2f59960f9f62b6ecf580082 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Mon, 22 Sep 2025 13:24:21 +0100 Subject: [PATCH 052/117] wip --- .../test_typescript_sdk_snippets.yml | 84 +++++++++++++++++++ v1/test_sdk_snippets/typescript/.env.example | 1 + .../typescript/discover_endpoints.py | 21 +++++ .../typescript/pyproject.toml | 12 +++ .../typescript/run_endpoint_ts.py | 73 ++++++++++++++++ 5 files changed, 191 insertions(+) create mode 100644 .github/workflows/test_typescript_sdk_snippets.yml create mode 100644 v1/test_sdk_snippets/typescript/.env.example create mode 100644 v1/test_sdk_snippets/typescript/discover_endpoints.py create mode 100644 v1/test_sdk_snippets/typescript/pyproject.toml create mode 100644 v1/test_sdk_snippets/typescript/run_endpoint_ts.py diff --git a/.github/workflows/test_typescript_sdk_snippets.yml b/.github/workflows/test_typescript_sdk_snippets.yml new file mode 100644 index 00000000..ad588315 --- /dev/null +++ b/.github/workflows/test_typescript_sdk_snippets.yml @@ -0,0 +1,84 @@ +name: test_typescript_sdk_snippets + +on: + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + + discover_sdk_snippets: + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + + outputs: + items: ${{ steps.collect.outputs.items }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup uv and Python + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.12" + + - name: Install dependencies (uv) + working-directory: v1/test_sdk_snippets/typescript + run: uv sync + + - id: collect + name: Collect endpoints (writes items=... to $GITHUB_OUTPUT) + working-directory: v1/test_sdk_snippets/typescript + run: uv run python discover_endpoints.py + + - name: Print collected items + run: | + cat > items.json <<'JSON' + ${{ steps.collect.outputs.items }} + JSON + echo "Collected items ✅ (pretty):" + jq . items.json | tee items.pretty.json + + test: + needs: discover_sdk_snippets # + if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup uv and Python + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.12" + + - name: Install dependencies (uv) + working-directory: v1/test_sdk_snippets/typescript + run: uv sync + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Node deps for TS snippets + working-directory: v1/test_sdk_snippets/typescript + run: | + npm init -y >/dev/null 2>&1 || true + npm i -D tsx + # Install the TS SDK used by snippets + npm i @compass-labs/api-sdk + + - name: Run endpoint snippet + working-directory: v1/test_sdk_snippets/typescript + run: uv run python run_endpoint_ts.py + env: + ENDPOINT: ${{ matrix.item }} \ No newline at end of file diff --git a/v1/test_sdk_snippets/typescript/.env.example b/v1/test_sdk_snippets/typescript/.env.example new file mode 100644 index 00000000..e7b882f8 --- /dev/null +++ b/v1/test_sdk_snippets/typescript/.env.example @@ -0,0 +1 @@ +COMPASS_API_KEY=<> \ No newline at end of file diff --git a/v1/test_sdk_snippets/typescript/discover_endpoints.py b/v1/test_sdk_snippets/typescript/discover_endpoints.py new file mode 100644 index 00000000..de5a6e40 --- /dev/null +++ b/v1/test_sdk_snippets/typescript/discover_endpoints.py @@ -0,0 +1,21 @@ +# scripts/discover_endpoints.py +import json, os, requests + +API_URL = "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" + +spec = requests.get(API_URL, timeout=(5,30)).json() + +# Collect all paths that have at least one Python sample +paths = [] +for p, methods in spec.get("paths", {}).items(): + for m in ("get","post"): + samples = (methods.get(m, {}) or {}).get("x-codeSamples") or [] + if any((s.get("lang") or "").lower().startswith("python") for s in samples): + paths.append(p) + break + +matrix = {"item": paths[:50]} # cap to 50 for demo +print("Discovered:", matrix) + +with open(os.environ["GITHUB_OUTPUT"], "a") as fh: + fh.write(f"items={json.dumps(matrix)}\n") \ No newline at end of file diff --git a/v1/test_sdk_snippets/typescript/pyproject.toml b/v1/test_sdk_snippets/typescript/pyproject.toml new file mode 100644 index 00000000..7ebca0ca --- /dev/null +++ b/v1/test_sdk_snippets/typescript/pyproject.toml @@ -0,0 +1,12 @@ +[project] +name = "python" +version = "0.1.0" +description = "Add your description here" +readme = "README.md" +requires-python = ">=3.12" +dependencies = [ + "compass-api-sdk>=1.1.2", + "dotenv>=0.9.9", + "eth-account>=0.13.7", + "web3>=7.12.0", +] \ No newline at end of file diff --git a/v1/test_sdk_snippets/typescript/run_endpoint_ts.py b/v1/test_sdk_snippets/typescript/run_endpoint_ts.py new file mode 100644 index 00000000..98120dc4 --- /dev/null +++ b/v1/test_sdk_snippets/typescript/run_endpoint_ts.py @@ -0,0 +1,73 @@ +import os +import sys +import requests +from dotenv import load_dotenv +import subprocess +import shlex + + +API_URL = "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" + + +def load_api_key() -> str: + load_dotenv() + key = os.getenv("COMPASS_API_KEY") + if not key: + raise RuntimeError("COMPASS_API_KEY not set in environment") + return key + + +def fetch_api_spec(url: str): + r = requests.get(url, timeout=(5, 30)) + r.raise_for_status() + return r.json() + + +def get_typescript_code_for_path(spec, path: str) -> str: + methods = spec["paths"].get(path) + if not methods: + raise ValueError(f"Path not found in spec: {path!r}") + for method in ("get", "post"): + samples = (methods.get(method, {}) or {}).get("x-codeSamples") or [] + for s in samples: + lang = (s.get("lang") or "").lower() + if lang.startswith("typescript") or lang == "ts": + return s["source"] + raise ValueError(f"No TypeScript code sample found for path: {path!r}") + + +def replace_with_secret(snippet: str, api_key: str) -> str: + return snippet.replace("", api_key) + + +def main(): + endpoint = os.getenv("ENDPOINT") or (len(sys.argv) > 1 and sys.argv[1]) + if not endpoint: + print("Usage: run_endpoint_ts.py (or set ENDPOINT env var)", file=sys.stderr) + sys.exit(2) + + api_key = load_api_key() + spec = fetch_api_spec(API_URL) + + print(f"--- Running TS snippet for {endpoint} ---") + code = get_typescript_code_for_path(spec, endpoint) + code = replace_with_secret(code, api_key) + + script_path = os.path.join(os.getcwd(), "snippet.ts") + with open(script_path, "w", encoding="utf-8") as f: + f.write(code) + + try: + # Use tsx to run TS without config; -y auto-installs if needed in CI + cmd = f"npx -y tsx {shlex.quote(script_path)}" + subprocess.run(cmd, shell=True, check=True) + print(f"✅ PASS: {endpoint}") + except subprocess.CalledProcessError as e: + print(f"❌ FAIL: {endpoint} – exit code {e.returncode}", file=sys.stderr) + sys.exit(e.returncode) + + +if __name__ == "__main__": + main() + + From 5f9f72a5c2a757938b2ade5a07b95b21fae373c6 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Mon, 22 Sep 2025 13:26:46 +0100 Subject: [PATCH 053/117] wip --- .../workflows/test_python_sdk_snippets.yml | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_python_sdk_snippets.yml b/.github/workflows/test_python_sdk_snippets.yml index b7ca6726..c0b42aee 100644 --- a/.github/workflows/test_python_sdk_snippets.yml +++ b/.github/workflows/test_python_sdk_snippets.yml @@ -41,7 +41,7 @@ jobs: echo "Collected items ✅ (pretty):" jq . items.json | tee items.pretty.json - test: + python: needs: discover_sdk_snippets # if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} runs-on: ubuntu-latest @@ -67,5 +67,47 @@ jobs: - name: Run endpoint snippet working-directory: v1/test_sdk_snippets/python run: uv run python run_endpoint.py + env: + ENDPOINT: ${{ matrix.item }} + + typescript: + needs: discover_sdk_snippets # + if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup uv and Python + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.12" + + - name: Install dependencies (uv) + working-directory: v1/test_sdk_snippets/typescript + run: uv sync + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Node deps for TS snippets + working-directory: v1/test_sdk_snippets/typescript + run: | + npm init -y >/dev/null 2>&1 || true + npm i -D tsx + # Install the TS SDK used by snippets + npm i @compass-labs/api-sdk + + - name: Run endpoint snippet + working-directory: v1/test_sdk_snippets/typescript + run: uv run python run_endpoint_ts.py env: ENDPOINT: ${{ matrix.item }} \ No newline at end of file From b65694ab5d07ff93a1766564ef0a6ccde8fc1670 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Mon, 22 Sep 2025 13:28:06 +0100 Subject: [PATCH 054/117] wip --- ...sdk_snippets.yml => test_sdk_snippets.yml} | 2 +- .../test_typescript_sdk_snippets.yml | 84 ------------------- 2 files changed, 1 insertion(+), 85 deletions(-) rename .github/workflows/{test_python_sdk_snippets.yml => test_sdk_snippets.yml} (98%) delete mode 100644 .github/workflows/test_typescript_sdk_snippets.yml diff --git a/.github/workflows/test_python_sdk_snippets.yml b/.github/workflows/test_sdk_snippets.yml similarity index 98% rename from .github/workflows/test_python_sdk_snippets.yml rename to .github/workflows/test_sdk_snippets.yml index c0b42aee..ff6a6b5d 100644 --- a/.github/workflows/test_python_sdk_snippets.yml +++ b/.github/workflows/test_sdk_snippets.yml @@ -1,4 +1,4 @@ -name: test_python_sdk_snippets +name: test_sdk_snippets on: pull_request: diff --git a/.github/workflows/test_typescript_sdk_snippets.yml b/.github/workflows/test_typescript_sdk_snippets.yml deleted file mode 100644 index ad588315..00000000 --- a/.github/workflows/test_typescript_sdk_snippets.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: test_typescript_sdk_snippets - -on: - pull_request: - branches: [ main ] - workflow_dispatch: - -jobs: - - discover_sdk_snippets: - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - - outputs: - items: ${{ steps.collect.outputs.items }} - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup uv and Python - uses: astral-sh/setup-uv@v5 - with: - python-version: "3.12" - - - name: Install dependencies (uv) - working-directory: v1/test_sdk_snippets/typescript - run: uv sync - - - id: collect - name: Collect endpoints (writes items=... to $GITHUB_OUTPUT) - working-directory: v1/test_sdk_snippets/typescript - run: uv run python discover_endpoints.py - - - name: Print collected items - run: | - cat > items.json <<'JSON' - ${{ steps.collect.outputs.items }} - JSON - echo "Collected items ✅ (pretty):" - jq . items.json | tee items.pretty.json - - test: - needs: discover_sdk_snippets # - if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - strategy: - fail-fast: false - matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup uv and Python - uses: astral-sh/setup-uv@v5 - with: - python-version: "3.12" - - - name: Install dependencies (uv) - working-directory: v1/test_sdk_snippets/typescript - run: uv sync - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - - - name: Install Node deps for TS snippets - working-directory: v1/test_sdk_snippets/typescript - run: | - npm init -y >/dev/null 2>&1 || true - npm i -D tsx - # Install the TS SDK used by snippets - npm i @compass-labs/api-sdk - - - name: Run endpoint snippet - working-directory: v1/test_sdk_snippets/typescript - run: uv run python run_endpoint_ts.py - env: - ENDPOINT: ${{ matrix.item }} \ No newline at end of file From e4ed66b8c17b5388c7600d0ad978fc3004253ef8 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Mon, 22 Sep 2025 13:28:46 +0100 Subject: [PATCH 055/117] wip --- .github/workflows/test_usecases_v0.yml | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 .github/workflows/test_usecases_v0.yml diff --git a/.github/workflows/test_usecases_v0.yml b/.github/workflows/test_usecases_v0.yml deleted file mode 100644 index 57e35d68..00000000 --- a/.github/workflows/test_usecases_v0.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: test_usecases_v_zero - -on: - schedule: - # Runs at 00:00 UTC every day - - cron: "0 0 * * *" - pull_request: - branches: - - main - workflow_dispatch: - -permissions: - id-token: write - contents: write - -jobs: - do-nothing: - runs-on: ubuntu-latest - - steps: - - name: Do nothing - run: | - echo "I am doing nothing" From f7258cdb670b60a26270af32d8e5b7a885186485 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Mon, 22 Sep 2025 13:33:53 +0100 Subject: [PATCH 056/117] WIP --- .github/workflows/test_sdk_snippets.yml | 12 +++++------ .../{python => }/.env.example | 0 .../{python => }/discover_endpoints.py | 0 .../{python => }/pyproject.toml | 0 ...run_endpoint.py => run_endpoint_python.py} | 0 ...point_ts.py => run_endpoint_typescript.py} | 0 v1/test_sdk_snippets/typescript/.env.example | 1 - .../typescript/discover_endpoints.py | 21 ------------------- .../typescript/pyproject.toml | 12 ----------- 9 files changed, 6 insertions(+), 40 deletions(-) rename v1/test_sdk_snippets/{python => }/.env.example (100%) rename v1/test_sdk_snippets/{python => }/discover_endpoints.py (100%) rename v1/test_sdk_snippets/{python => }/pyproject.toml (100%) rename v1/test_sdk_snippets/{python/run_endpoint.py => run_endpoint_python.py} (100%) rename v1/test_sdk_snippets/{typescript/run_endpoint_ts.py => run_endpoint_typescript.py} (100%) delete mode 100644 v1/test_sdk_snippets/typescript/.env.example delete mode 100644 v1/test_sdk_snippets/typescript/discover_endpoints.py delete mode 100644 v1/test_sdk_snippets/typescript/pyproject.toml diff --git a/.github/workflows/test_sdk_snippets.yml b/.github/workflows/test_sdk_snippets.yml index ff6a6b5d..8eb15594 100644 --- a/.github/workflows/test_sdk_snippets.yml +++ b/.github/workflows/test_sdk_snippets.yml @@ -30,7 +30,7 @@ jobs: - id: collect name: Collect endpoints (writes items=... to $GITHUB_OUTPUT) - working-directory: v1/test_sdk_snippets/python + working-directory: v1/test_sdk_snippets run: uv run python discover_endpoints.py - name: Print collected items @@ -61,11 +61,11 @@ jobs: python-version: "3.12" - name: Install dependencies (uv) - working-directory: v1/test_sdk_snippets/python + working-directory: v1/test_sdk_snippets run: uv sync - name: Run endpoint snippet - working-directory: v1/test_sdk_snippets/python + working-directory: v1/test_sdk_snippets run: uv run python run_endpoint.py env: ENDPOINT: ${{ matrix.item }} @@ -90,7 +90,7 @@ jobs: python-version: "3.12" - name: Install dependencies (uv) - working-directory: v1/test_sdk_snippets/typescript + working-directory: v1/test_sdk_snippets run: uv sync - name: Setup Node.js @@ -99,7 +99,7 @@ jobs: node-version: '20' - name: Install Node deps for TS snippets - working-directory: v1/test_sdk_snippets/typescript + working-directory: v1/test_sdk_snippets run: | npm init -y >/dev/null 2>&1 || true npm i -D tsx @@ -107,7 +107,7 @@ jobs: npm i @compass-labs/api-sdk - name: Run endpoint snippet - working-directory: v1/test_sdk_snippets/typescript + working-directory: v1/test_sdk_snippets run: uv run python run_endpoint_ts.py env: ENDPOINT: ${{ matrix.item }} \ No newline at end of file diff --git a/v1/test_sdk_snippets/python/.env.example b/v1/test_sdk_snippets/.env.example similarity index 100% rename from v1/test_sdk_snippets/python/.env.example rename to v1/test_sdk_snippets/.env.example diff --git a/v1/test_sdk_snippets/python/discover_endpoints.py b/v1/test_sdk_snippets/discover_endpoints.py similarity index 100% rename from v1/test_sdk_snippets/python/discover_endpoints.py rename to v1/test_sdk_snippets/discover_endpoints.py diff --git a/v1/test_sdk_snippets/python/pyproject.toml b/v1/test_sdk_snippets/pyproject.toml similarity index 100% rename from v1/test_sdk_snippets/python/pyproject.toml rename to v1/test_sdk_snippets/pyproject.toml diff --git a/v1/test_sdk_snippets/python/run_endpoint.py b/v1/test_sdk_snippets/run_endpoint_python.py similarity index 100% rename from v1/test_sdk_snippets/python/run_endpoint.py rename to v1/test_sdk_snippets/run_endpoint_python.py diff --git a/v1/test_sdk_snippets/typescript/run_endpoint_ts.py b/v1/test_sdk_snippets/run_endpoint_typescript.py similarity index 100% rename from v1/test_sdk_snippets/typescript/run_endpoint_ts.py rename to v1/test_sdk_snippets/run_endpoint_typescript.py diff --git a/v1/test_sdk_snippets/typescript/.env.example b/v1/test_sdk_snippets/typescript/.env.example deleted file mode 100644 index e7b882f8..00000000 --- a/v1/test_sdk_snippets/typescript/.env.example +++ /dev/null @@ -1 +0,0 @@ -COMPASS_API_KEY=<> \ No newline at end of file diff --git a/v1/test_sdk_snippets/typescript/discover_endpoints.py b/v1/test_sdk_snippets/typescript/discover_endpoints.py deleted file mode 100644 index de5a6e40..00000000 --- a/v1/test_sdk_snippets/typescript/discover_endpoints.py +++ /dev/null @@ -1,21 +0,0 @@ -# scripts/discover_endpoints.py -import json, os, requests - -API_URL = "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" - -spec = requests.get(API_URL, timeout=(5,30)).json() - -# Collect all paths that have at least one Python sample -paths = [] -for p, methods in spec.get("paths", {}).items(): - for m in ("get","post"): - samples = (methods.get(m, {}) or {}).get("x-codeSamples") or [] - if any((s.get("lang") or "").lower().startswith("python") for s in samples): - paths.append(p) - break - -matrix = {"item": paths[:50]} # cap to 50 for demo -print("Discovered:", matrix) - -with open(os.environ["GITHUB_OUTPUT"], "a") as fh: - fh.write(f"items={json.dumps(matrix)}\n") \ No newline at end of file diff --git a/v1/test_sdk_snippets/typescript/pyproject.toml b/v1/test_sdk_snippets/typescript/pyproject.toml deleted file mode 100644 index 7ebca0ca..00000000 --- a/v1/test_sdk_snippets/typescript/pyproject.toml +++ /dev/null @@ -1,12 +0,0 @@ -[project] -name = "python" -version = "0.1.0" -description = "Add your description here" -readme = "README.md" -requires-python = ">=3.12" -dependencies = [ - "compass-api-sdk>=1.1.2", - "dotenv>=0.9.9", - "eth-account>=0.13.7", - "web3>=7.12.0", -] \ No newline at end of file From ba97419b7c5befbb6751570488747fa215f738aa Mon Sep 17 00:00:00 2001 From: ccosnett Date: Mon, 22 Sep 2025 13:34:35 +0100 Subject: [PATCH 057/117] WIP --- .github/workflows/test_sdk_snippets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_sdk_snippets.yml b/.github/workflows/test_sdk_snippets.yml index 8eb15594..6d58015d 100644 --- a/.github/workflows/test_sdk_snippets.yml +++ b/.github/workflows/test_sdk_snippets.yml @@ -25,7 +25,7 @@ jobs: python-version: "3.12" - name: Install dependencies (uv) - working-directory: v1/test_sdk_snippets/python + working-directory: v1/test_sdk_snippets run: uv sync - id: collect From 28799c5283e50332a5489294e9f7fab739f77ae5 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Mon, 22 Sep 2025 13:36:13 +0100 Subject: [PATCH 058/117] WIP --- .github/workflows/test_sdk_snippets.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_sdk_snippets.yml b/.github/workflows/test_sdk_snippets.yml index 6d58015d..48aba5a7 100644 --- a/.github/workflows/test_sdk_snippets.yml +++ b/.github/workflows/test_sdk_snippets.yml @@ -66,7 +66,7 @@ jobs: - name: Run endpoint snippet working-directory: v1/test_sdk_snippets - run: uv run python run_endpoint.py + run: uv run python run_endpoint_python.py env: ENDPOINT: ${{ matrix.item }} @@ -108,6 +108,6 @@ jobs: - name: Run endpoint snippet working-directory: v1/test_sdk_snippets - run: uv run python run_endpoint_ts.py + run: uv run python run_endpoint_typescript.py env: ENDPOINT: ${{ matrix.item }} \ No newline at end of file From 7c77ce3b4ad3562b9e7efcd422ca7c414c35239f Mon Sep 17 00:00:00 2001 From: ccosnett Date: Tue, 23 Sep 2025 14:07:55 +0100 Subject: [PATCH 059/117] WIP --- v1/test_sdk_snippets/discover_endpoints.py | 8 +- v1/test_sdk_snippets/pyproject.toml | 4 +- v1/test_sdk_snippets/run_endpoint_python.py | 97 +++++++++------------ 3 files changed, 48 insertions(+), 61 deletions(-) diff --git a/v1/test_sdk_snippets/discover_endpoints.py b/v1/test_sdk_snippets/discover_endpoints.py index de5a6e40..f643aac6 100644 --- a/v1/test_sdk_snippets/discover_endpoints.py +++ b/v1/test_sdk_snippets/discover_endpoints.py @@ -3,19 +3,19 @@ API_URL = "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" -spec = requests.get(API_URL, timeout=(5,30)).json() +spec = requests.get(API_URL, timeout=(5, 30)).json() # Collect all paths that have at least one Python sample paths = [] for p, methods in spec.get("paths", {}).items(): - for m in ("get","post"): + for m in ("get", "post"): samples = (methods.get(m, {}) or {}).get("x-codeSamples") or [] if any((s.get("lang") or "").lower().startswith("python") for s in samples): paths.append(p) break -matrix = {"item": paths[:50]} # cap to 50 for demo +matrix = {"item": paths} print("Discovered:", matrix) with open(os.environ["GITHUB_OUTPUT"], "a") as fh: - fh.write(f"items={json.dumps(matrix)}\n") \ No newline at end of file + fh.write(f"items={json.dumps(matrix)}\n") diff --git a/v1/test_sdk_snippets/pyproject.toml b/v1/test_sdk_snippets/pyproject.toml index 7ebca0ca..7ea74b78 100644 --- a/v1/test_sdk_snippets/pyproject.toml +++ b/v1/test_sdk_snippets/pyproject.toml @@ -8,5 +8,7 @@ dependencies = [ "compass-api-sdk>=1.1.2", "dotenv>=0.9.9", "eth-account>=0.13.7", + "pyright>=1.1.405", + "ruff>=0.13.1", "web3>=7.12.0", -] \ No newline at end of file +] diff --git a/v1/test_sdk_snippets/run_endpoint_python.py b/v1/test_sdk_snippets/run_endpoint_python.py index bd94971c..dd6919b0 100644 --- a/v1/test_sdk_snippets/run_endpoint_python.py +++ b/v1/test_sdk_snippets/run_endpoint_python.py @@ -6,60 +6,45 @@ import subprocess import shlex -API_URL = "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" - -def load_api_key() -> str: - load_dotenv() - key = os.getenv("COMPASS_API_KEY") - if not key: - raise RuntimeError("COMPASS_API_KEY not set in environment") - return key - -def fetch_api_spec(url: str): - r = requests.get(url, timeout=(5, 30)) - r.raise_for_status() - return r.json() - -def get_python_code_for_path(spec, path: str) -> str: - """Return the FIRST Python code sample for the given path (checks get/post).""" - methods = spec["paths"].get(path) - if not methods: - raise ValueError(f"Path not found in spec: {path!r}") - for method in ("get", "post"): - samples = (methods.get(method, {}) or {}).get("x-codeSamples") or [] - for s in samples: - if (s.get("lang") or "").lower().startswith("python"): - return s["source"] - raise ValueError(f"No Python code sample found for path: {path!r}") - -def replace_with_secret(snippet: str, api_key: str) -> str: - return snippet.replace("", api_key) +load_dotenv() -def main(): - # Endpoint comes from env var ENDPOINT or first CLI arg - endpoint = os.getenv("ENDPOINT") or (len(sys.argv) > 1 and sys.argv[1]) - if not endpoint: - print("Usage: run_endpoint.py (or set ENDPOINT env var)", file=sys.stderr) - sys.exit(2) - - api_key = load_api_key() - spec = fetch_api_spec(API_URL) - - print(f"--- Running python SDK snippet for {endpoint} ---") - code = get_python_code_for_path(spec, endpoint) - code = replace_with_secret(code, api_key) - # Write snippet to a simple file and run it - script_path = os.path.join(os.getcwd(), "snippet.py") - with open(script_path, "w", encoding="utf-8") as f: - f.write(code) - - try: - cmd = f"{shlex.quote(sys.executable)} {shlex.quote(script_path)}" - subprocess.run(cmd, shell=True, check=True) - print(f"✅ PASS: {endpoint}") - except subprocess.CalledProcessError as e: - print(f"❌ FAIL: {endpoint} – exit code {e.returncode}", file=sys.stderr) - sys.exit(e.returncode) - -if __name__ == "__main__": - main() \ No newline at end of file +COMPASS_API_KEY = os.getenv("COMPASS_API_KEY") +ENDPOINT = os.getenv("ENDPOINT") +print([ENDPOINT]) +API_URL = "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" +SPEC = requests.get(API_URL).json() + +# get python code sample for given path +methods = SPEC["paths"].get(ENDPOINT) +if not methods: + raise ValueError(f"Endpoint not found in spec: {ENDPOINT!r}") + +SNIPPET = None +for method in ("get", "post"): + samples = (methods.get(method, {}) or {}).get("x-codeSamples") or [] + for s in samples: + if (s.get("lang") or "").lower().startswith("python"): + SNIPPET = s["source"] + break + if SNIPPET: + break + +if not SNIPPET: + raise ValueError(f"No Python code sample found for endpoint: {ENDPOINT!r}") + + +print(f"--- Running python SDK snippet for {ENDPOINT} ---") + +SNIPPET = SNIPPET.replace("", COMPASS_API_KEY) +# Write snippet to a simple file and run it +script_path = os.path.join(os.getcwd(), "snippet.py") +with open(script_path, "w", encoding="utf-8") as f: + f.write(SNIPPET) + +try: + cmd = f"{shlex.quote(sys.executable)} {shlex.quote(script_path)}" + subprocess.run(cmd, shell=True, check=True) + print(f"✅ PASS: {ENDPOINT}") +except subprocess.CalledProcessError as e: + print(f"❌ FAIL: {ENDPOINT} – exit code {e.returncode}", file=sys.stderr) + sys.exit(e.returncode) From 5cf10523f43205aea98bbe3b03ffadb5dfb6ace2 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Tue, 23 Sep 2025 14:11:22 +0100 Subject: [PATCH 060/117] WIP --- .../run_endpoint_typescript.py | 106 +++++++----------- 1 file changed, 42 insertions(+), 64 deletions(-) diff --git a/v1/test_sdk_snippets/run_endpoint_typescript.py b/v1/test_sdk_snippets/run_endpoint_typescript.py index 98120dc4..c775c1b2 100644 --- a/v1/test_sdk_snippets/run_endpoint_typescript.py +++ b/v1/test_sdk_snippets/run_endpoint_typescript.py @@ -1,3 +1,4 @@ +# v1/test_sdk_snippets/run_endpoint.py import os import sys import requests @@ -5,69 +6,46 @@ import subprocess import shlex +load_dotenv() +COMPASS_API_KEY = os.getenv("COMPASS_API_KEY") +ENDPOINT = os.getenv("ENDPOINT") +print([ENDPOINT]) API_URL = "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" - - -def load_api_key() -> str: - load_dotenv() - key = os.getenv("COMPASS_API_KEY") - if not key: - raise RuntimeError("COMPASS_API_KEY not set in environment") - return key - - -def fetch_api_spec(url: str): - r = requests.get(url, timeout=(5, 30)) - r.raise_for_status() - return r.json() - - -def get_typescript_code_for_path(spec, path: str) -> str: - methods = spec["paths"].get(path) - if not methods: - raise ValueError(f"Path not found in spec: {path!r}") - for method in ("get", "post"): - samples = (methods.get(method, {}) or {}).get("x-codeSamples") or [] - for s in samples: - lang = (s.get("lang") or "").lower() - if lang.startswith("typescript") or lang == "ts": - return s["source"] - raise ValueError(f"No TypeScript code sample found for path: {path!r}") - - -def replace_with_secret(snippet: str, api_key: str) -> str: - return snippet.replace("", api_key) - - -def main(): - endpoint = os.getenv("ENDPOINT") or (len(sys.argv) > 1 and sys.argv[1]) - if not endpoint: - print("Usage: run_endpoint_ts.py (or set ENDPOINT env var)", file=sys.stderr) - sys.exit(2) - - api_key = load_api_key() - spec = fetch_api_spec(API_URL) - - print(f"--- Running TS snippet for {endpoint} ---") - code = get_typescript_code_for_path(spec, endpoint) - code = replace_with_secret(code, api_key) - - script_path = os.path.join(os.getcwd(), "snippet.ts") - with open(script_path, "w", encoding="utf-8") as f: - f.write(code) - - try: - # Use tsx to run TS without config; -y auto-installs if needed in CI - cmd = f"npx -y tsx {shlex.quote(script_path)}" - subprocess.run(cmd, shell=True, check=True) - print(f"✅ PASS: {endpoint}") - except subprocess.CalledProcessError as e: - print(f"❌ FAIL: {endpoint} – exit code {e.returncode}", file=sys.stderr) - sys.exit(e.returncode) - - -if __name__ == "__main__": - main() - - +SPEC = requests.get(API_URL).json() + +# get python code sample for given path +methods = SPEC["paths"].get(ENDPOINT) +if not methods: + raise ValueError(f"Endpoint not found in spec: {ENDPOINT!r}") + +SNIPPET = None +for method in ("get", "post"): + samples = (methods.get(method, {}) or {}).get("x-codeSamples") or [] + for s in samples: + if (s.get("lang") or "").lower().startswith("python"): + SNIPPET = s["source"] + break + if SNIPPET: + break + +if not SNIPPET: + raise ValueError(f"No Python code sample found for endpoint: {ENDPOINT!r}") + + +print(f"--- Running typescript SDK snippet for {ENDPOINT} ---") + +SNIPPET = SNIPPET.replace("", COMPASS_API_KEY) +# Write snippet to a simple file and run it +script_path = os.path.join(os.getcwd(), "snippet.ts") +with open(script_path, "w", encoding="utf-8") as f: + f.write(SNIPPET) + +try: + # Use tsx to run TS without config; -y auto-installs if needed in CI + cmd = f"npx -y tsx {shlex.quote(script_path)}" + subprocess.run(cmd, shell=True, check=True) + print(f":white_check_mark: PASS: {ENDPOINT}") +except subprocess.CalledProcessError as e: + print(f":x: FAIL: {ENDPOINT} – exit code {e.returncode}", file=sys.stderr) + sys.exit(e.returncode) From f3ff314b659677d0bb56edf177f384bdac9d1970 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Wed, 24 Sep 2025 17:11:40 +0100 Subject: [PATCH 061/117] =?UTF-8?q?=E2=9C=A8=20Add=20SDK=20snippets=20jobs?= =?UTF-8?q?=20to=20main=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🚀 Integrate discover_sdk_snippets, run-sdk-snippets-python, and run-sdk-snippets-typescript jobs 🔧 Add environment validation and version management 📦 Support staging/prod/latest package versions ⚡ Matrix strategy for parallel endpoint testing 🎯 Conditional execution based on discovered endpoints --- .github/workflows/test_usecases_v1.yml | 122 ++++++++++++++++++++++++- 1 file changed, 117 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_usecases_v1.yml b/.github/workflows/test_usecases_v1.yml index b0d08099..443b4923 100644 --- a/.github/workflows/test_usecases_v1.yml +++ b/.github/workflows/test_usecases_v1.yml @@ -1,12 +1,12 @@ name: test_usecases_v_one on: - schedule: + # schedule: # Runs at 00:00 UTC every day - - cron: "0 0 * * *" - pull_request: - branches: - - main + # - cron: "0 0 * * *" + # pull_request: + # branches: + # - main workflow_dispatch: inputs: environment: @@ -709,3 +709,115 @@ jobs: curl -X POST "https://allquiet.app/api/webhook/829f846c-4dfa-4a58-ab33-eafae34a57c9" \ -H "Content-Type: application/json" \ -d '{"status": "Open", "severity": "Critical", "message": "GitHub workflow failed", "run_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' + + discover_sdk_snippets: + needs: [validate-environment, set-versions] + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + outputs: + items: ${{ steps.collect.outputs.items }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup uv and Python + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.12" + + - name: Install dependencies (uv) + working-directory: v1/test_sdk_snippets + run: uv sync + + - id: collect + name: Collect endpoints (writes items=... to $GITHUB_OUTPUT) + working-directory: v1/test_sdk_snippets + run: uv run python discover_endpoints.py + + - name: Print collected items + run: | + cat > items.json <<'JSON' + ${{ steps.collect.outputs.items }} + JSON + echo "Collected items ✅ (pretty):" + jq . items.json | tee items.pretty.json + + run-sdk-snippets-python: + needs: [validate-environment, set-versions, discover_sdk_snippets] + if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup uv and Python + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.12" + + - name: Install dependencies (uv) + working-directory: v1/test_sdk_snippets + run: uv sync + + - name: Run endpoint snippet + working-directory: v1/test_sdk_snippets + run: uv run python run_endpoint_python.py + env: + ENDPOINT: ${{ matrix.item }} + + run-sdk-snippets-typescript: + needs: [validate-environment, set-versions, discover_sdk_snippets] + if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup uv and Python + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.12" + + - name: Install dependencies (uv) + working-directory: v1/test_sdk_snippets + run: uv sync + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Node deps for TS snippets + working-directory: v1/test_sdk_snippets + run: | + npm init -y >/dev/null 2>&1 || true + npm i -D tsx + # Install the TS SDK used by snippets + npm i @compass-labs/api-sdk@${{ env.NPM_PACKAGE_VERSION }} + + - name: Run endpoint snippet + working-directory: v1/test_sdk_snippets + run: uv run python run_endpoint_typescript.py + env: + ENDPOINT: ${{ matrix.item }} From 6cd300cfd93d034dc34efbc6037a391537cac4ae Mon Sep 17 00:00:00 2001 From: ccosnett Date: Wed, 24 Sep 2025 17:19:41 +0100 Subject: [PATCH 062/117] COMMENT OUT JOBS --- .github/workflows/test_usecases_v1.yml | 1260 ++++++++++++------------ 1 file changed, 630 insertions(+), 630 deletions(-) diff --git a/.github/workflows/test_usecases_v1.yml b/.github/workflows/test_usecases_v1.yml index 443b4923..66aa5725 100644 --- a/.github/workflows/test_usecases_v1.yml +++ b/.github/workflows/test_usecases_v1.yml @@ -79,636 +79,636 @@ jobs: echo "uv_package_version=$UV_PACKAGE_VERSION" >> $GITHUB_OUTPUT - run-pendle-typescript: - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - ARBITRUM_RPC_URL: http://localhost:8547 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "20" - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - - name: Install dependencies - working-directory: v1/pendle/typescript - run: | - npm install - if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then - npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION - fi - npm list - - - name: Build application - working-directory: v1/pendle/typescript - run: npm run build - - - name: Run application - working-directory: v1/pendle/typescript - run: npm run start - - run-pendle-python: - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - ARBITRUM_RPC_URL: http://localhost:8547 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/pendle/python - run: | - if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then - echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" - uv add compass-api-sdk==$UV_PACKAGE_VERSION - fi - uv sync - uv pip freeze - - - name: Run example - working-directory: v1/pendle/python - run: ./.venv/bin/python src/main.py - - run-typescript-basic-examples-deposit-on-morpho: # - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - BASE_RPC_URL: http://localhost:8546 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "20" - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/basic_examples/deposit_on_morpho/typescript - run: | - npm install - if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then - npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION - fi - npm list - - - name: Build application - working-directory: v1/basic_examples/deposit_on_morpho/typescript - run: npm run build - - - name: Run application - working-directory: v1/basic_examples/deposit_on_morpho/typescript - run: npm run start - - - run-python----basic-examples-deposit-on-morpho: # - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - BASE_RPC_URL: http://localhost:8546 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/basic_examples/deposit_on_morpho/python - run: | - if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then - echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" - uv add compass-api-sdk==$UV_PACKAGE_VERSION - fi - uv sync - uv pip freeze - - - name: Run example - working-directory: v1/basic_examples/deposit_on_morpho/python - run: ./.venv/bin/python main.py #src/main.py - - - run-typescript-basic-examples-deposit-on-aave: - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - BASE_RPC_URL: http://localhost:8546 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "20" - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/basic_examples/deposit_on_aave/typescript - run: | - npm install - if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then - npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION - fi - npm list - - - name: Build application - working-directory: v1/basic_examples/deposit_on_aave/typescript - run: npm run build - - - name: Run application - working-directory: v1/basic_examples/deposit_on_aave/typescript - run: npm run start - - - run-python----basic-examples-deposit-on-aave: - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - BASE_RPC_URL: http://localhost:8546 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/basic_examples/deposit_on_aave/python - run: | - if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then - echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" - uv add compass-api-sdk==$UV_PACKAGE_VERSION - fi - uv sync - uv pip freeze - - - name: Run example - working-directory: v1/basic_examples/deposit_on_aave/python - run: ./.venv/bin/python main.py #src/main.py - - run-typescript-transaction_bundler_embed_a_fee_in_tx: # - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - BASE_RPC_URL: http://localhost:8546 - #ETHEREUM_RPC_URL: http://localhost:8545 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "20" - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/typescript - run: | - npm install - if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then - npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION - fi - npm list - - - name: Build application - working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/typescript - run: npm run build - - - name: Run application - working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/typescript - run: npm run start - - run-python----transaction_bundler_embed_a_fee_in_tx: # - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - BASE_RPC_URL: http://localhost:8546 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/python - run: | - if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then - echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" - uv add compass-api-sdk==$UV_PACKAGE_VERSION - fi - uv sync - uv pip freeze - - - name: Run example - working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/python - run: ./.venv/bin/python main.py #src/main.py - - - run-transaction-bundler-typescript: - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - ETHEREUM_RPC_URL: http://localhost:8545 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "20" - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/transaction_bundler/typescript - run: | - npm install - if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then - npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION - fi - npm list - - - name: Build application - working-directory: v1/transaction_bundler/typescript - run: npm run build - - - name: Run application - working-directory: v1/transaction_bundler/typescript - run: npm run start - - run-transaction-bundler-python: - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - ETHEREUM_RPC_URL: http://localhost:8545 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/transaction_bundler/python - run: | - if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then - echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" - uv add compass-api-sdk==$UV_PACKAGE_VERSION - fi - uv sync - uv pip freeze - - - name: Run example - working-directory: v1/transaction_bundler/python - run: ./.venv/bin/python src/main.py - - run-aave-looping-typescript: - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - ETHEREUM_RPC_URL: http://localhost:8545 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "20" - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/aave_looping/typescript - run: | - npm install - if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then - npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION - fi - npm list - - - name: Build application - working-directory: v1/aave_looping/typescript - run: npm run build - - - name: Run application - working-directory: v1/aave_looping/typescript - run: npm run start - - run-aave-looping-python: - needs: [validate-environment, set-versions] - - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - ETHEREUM_RPC_URL: http://localhost:8545 - SERVER_URL: http://localhost:80 - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh - - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - - name: Install dependencies - working-directory: v1/aave_looping/python - run: | - if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then - echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" - uv add compass-api-sdk==$UV_PACKAGE_VERSION - fi - uv sync - uv pip freeze - - - name: Run example - working-directory: v1/aave_looping/python - run: ./.venv/bin/python src/main.py - - failure-alert: - if: failure() && github.event_name == 'schedule' # Runs only if a previous job failed & triggered by cron - runs-on: ubuntu-latest - needs: - [ - run-pendle-typescript, - run-pendle-python, - run-transaction-bundler-typescript, - run-transaction-bundler-python, - run-aave-looping-typescript, - run-aave-looping-python, - ] - steps: - - name: Send failure notification - run: | - curl -X POST "https://allquiet.app/api/webhook/829f846c-4dfa-4a58-ab33-eafae34a57c9" \ - -H "Content-Type: application/json" \ - -d '{"status": "Open", "severity": "Critical", "message": "GitHub workflow failed", "run_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' +# run-pendle-typescript: +# needs: [validate-environment, set-versions] +# +# runs-on: ubuntu-latest +# env: +# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} +# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} +# ARBITRUM_RPC_URL: http://localhost:8547 +# SERVER_URL: http://localhost:80 +# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} +# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} +# +# steps: +# - name: Checkout repository +# uses: actions/checkout@v3 +# +# - name: Set up Node.js +# uses: actions/setup-node@v3 +# with: +# node-version: "20" +# +# - name: Start up full local API and anvil +# uses: ./.github/actions/local_anvil_and_api +# id: local_anvil_and_api +# with: +# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} +# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} +# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} +# private_key: ${{ secrets.PRIVATE_KEY }} +# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} +# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} +# fund_amount_eth: "10" +# environment: ${{ needs.validate-environment.outputs.environment }} +# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} +# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api +# +# +# - name: Install dependencies +# working-directory: v1/pendle/typescript +# run: | +# npm install +# if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then +# npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION +# fi +# npm list +# +# - name: Build application +# working-directory: v1/pendle/typescript +# run: npm run build +# +# - name: Run application +# working-directory: v1/pendle/typescript +# run: npm run start +# +# run-pendle-python: +# needs: [validate-environment, set-versions] +# +# runs-on: ubuntu-latest +# env: +# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} +# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} +# ARBITRUM_RPC_URL: http://localhost:8547 +# SERVER_URL: http://localhost:80 +# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} +# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} +# +# steps: +# - name: Checkout repository +# uses: actions/checkout@v3 +# +# - name: Install uv +# run: curl -LsSf https://astral.sh/uv/install.sh | sh +# +# - name: Start up full local API and anvil +# uses: ./.github/actions/local_anvil_and_api +# id: local_anvil_and_api +# with: +# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} +# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} +# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} +# private_key: ${{ secrets.PRIVATE_KEY }} +# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} +# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} +# fund_amount_eth: "10" +# environment: ${{ needs.validate-environment.outputs.environment }} +# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} +# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api +# +# - name: Install dependencies +# working-directory: v1/pendle/python +# run: | +# if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then +# echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" +# uv add compass-api-sdk==$UV_PACKAGE_VERSION +# fi +# uv sync +# uv pip freeze +# +# - name: Run example +# working-directory: v1/pendle/python +# run: ./.venv/bin/python src/main.py +# +# run-typescript-basic-examples-deposit-on-morpho: # +# needs: [validate-environment, set-versions] +# +# runs-on: ubuntu-latest +# env: +# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} +# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} +# BASE_RPC_URL: http://localhost:8546 +# SERVER_URL: http://localhost:80 +# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} +# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} +# +# steps: +# - name: Checkout repository +# uses: actions/checkout@v3 +# +# - name: Set up Node.js +# uses: actions/setup-node@v3 +# with: +# node-version: "20" +# +# - name: Start up full local API and anvil +# uses: ./.github/actions/local_anvil_and_api +# id: local_anvil_and_api +# with: +# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} +# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} +# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} +# private_key: ${{ secrets.PRIVATE_KEY }} +# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} +# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} +# fund_amount_eth: "10" +# environment: ${{ needs.validate-environment.outputs.environment }} +# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} +# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api +# +# - name: Install dependencies +# working-directory: v1/basic_examples/deposit_on_morpho/typescript +# run: | +# npm install +# if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then +# npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION +# fi +# npm list +# +# - name: Build application +# working-directory: v1/basic_examples/deposit_on_morpho/typescript +# run: npm run build +# +# - name: Run application +# working-directory: v1/basic_examples/deposit_on_morpho/typescript +# run: npm run start +# +# +# run-python----basic-examples-deposit-on-morpho: # +# needs: [validate-environment, set-versions] +# +# runs-on: ubuntu-latest +# env: +# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} +# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} +# BASE_RPC_URL: http://localhost:8546 +# SERVER_URL: http://localhost:80 +# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} +# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} +# +# steps: +# - name: Checkout repository +# uses: actions/checkout@v3 +# +# - name: Install uv +# run: curl -LsSf https://astral.sh/uv/install.sh | sh +# +# - name: Start up full local API and anvil +# uses: ./.github/actions/local_anvil_and_api +# id: local_anvil_and_api +# with: +# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} +# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} +# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} +# private_key: ${{ secrets.PRIVATE_KEY }} +# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} +# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} +# fund_amount_eth: "10" +# environment: ${{ needs.validate-environment.outputs.environment }} +# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} +# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api +# +# - name: Install dependencies +# working-directory: v1/basic_examples/deposit_on_morpho/python +# run: | +# if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then +# echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" +# uv add compass-api-sdk==$UV_PACKAGE_VERSION +# fi +# uv sync +# uv pip freeze +# +# - name: Run example +# working-directory: v1/basic_examples/deposit_on_morpho/python +# run: ./.venv/bin/python main.py #src/main.py +# +# +# run-typescript-basic-examples-deposit-on-aave: +# needs: [validate-environment, set-versions] +# +# runs-on: ubuntu-latest +# env: +# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} +# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} +# BASE_RPC_URL: http://localhost:8546 +# SERVER_URL: http://localhost:80 +# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} +# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} +# +# steps: +# - name: Checkout repository +# uses: actions/checkout@v3 +# +# - name: Set up Node.js +# uses: actions/setup-node@v3 +# with: +# node-version: "20" +# +# - name: Start up full local API and anvil +# uses: ./.github/actions/local_anvil_and_api +# id: local_anvil_and_api +# with: +# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} +# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} +# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} +# private_key: ${{ secrets.PRIVATE_KEY }} +# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} +# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} +# fund_amount_eth: "10" +# environment: ${{ needs.validate-environment.outputs.environment }} +# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} +# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api +# +# - name: Install dependencies +# working-directory: v1/basic_examples/deposit_on_aave/typescript +# run: | +# npm install +# if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then +# npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION +# fi +# npm list +# +# - name: Build application +# working-directory: v1/basic_examples/deposit_on_aave/typescript +# run: npm run build +# +# - name: Run application +# working-directory: v1/basic_examples/deposit_on_aave/typescript +# run: npm run start +# +# +# run-python----basic-examples-deposit-on-aave: +# needs: [validate-environment, set-versions] +# +# runs-on: ubuntu-latest +# env: +# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} +# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} +# BASE_RPC_URL: http://localhost:8546 +# SERVER_URL: http://localhost:80 +# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} +# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} +# +# steps: +# - name: Checkout repository +# uses: actions/checkout@v3 +# +# - name: Install uv +# run: curl -LsSf https://astral.sh/uv/install.sh | sh +# +# - name: Start up full local API and anvil +# uses: ./.github/actions/local_anvil_and_api +# id: local_anvil_and_api +# with: +# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} +# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} +# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} +# private_key: ${{ secrets.PRIVATE_KEY }} +# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} +# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} +# fund_amount_eth: "10" +# environment: ${{ needs.validate-environment.outputs.environment }} +# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} +# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api +# +# - name: Install dependencies +# working-directory: v1/basic_examples/deposit_on_aave/python +# run: | +# if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then +# echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" +# uv add compass-api-sdk==$UV_PACKAGE_VERSION +# fi +# uv sync +# uv pip freeze +# +# - name: Run example +# working-directory: v1/basic_examples/deposit_on_aave/python +# run: ./.venv/bin/python main.py #src/main.py +# +# run-typescript-transaction_bundler_embed_a_fee_in_tx: # +# needs: [validate-environment, set-versions] +# +# runs-on: ubuntu-latest +# env: +# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} +# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} +# BASE_RPC_URL: http://localhost:8546 +# #ETHEREUM_RPC_URL: http://localhost:8545 +# SERVER_URL: http://localhost:80 +# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} +# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} +# +# steps: +# - name: Checkout repository +# uses: actions/checkout@v3 +# +# - name: Set up Node.js +# uses: actions/setup-node@v3 +# with: +# node-version: "20" +# +# - name: Start up full local API and anvil +# uses: ./.github/actions/local_anvil_and_api +# id: local_anvil_and_api +# with: +# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} +# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} +# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} +# private_key: ${{ secrets.PRIVATE_KEY }} +# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} +# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} +# fund_amount_eth: "10" +# environment: ${{ needs.validate-environment.outputs.environment }} +# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} +# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api +# +# - name: Install dependencies +# working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/typescript +# run: | +# npm install +# if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then +# npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION +# fi +# npm list +# +# - name: Build application +# working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/typescript +# run: npm run build +# +# - name: Run application +# working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/typescript +# run: npm run start +# +# run-python----transaction_bundler_embed_a_fee_in_tx: # +# needs: [validate-environment, set-versions] +# +# runs-on: ubuntu-latest +# env: +# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} +# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} +# BASE_RPC_URL: http://localhost:8546 +# SERVER_URL: http://localhost:80 +# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} +# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} +# +# steps: +# - name: Checkout repository +# uses: actions/checkout@v3 +# +# - name: Install uv +# run: curl -LsSf https://astral.sh/uv/install.sh | sh +# +# - name: Start up full local API and anvil +# uses: ./.github/actions/local_anvil_and_api +# id: local_anvil_and_api +# with: +# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} +# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} +# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} +# private_key: ${{ secrets.PRIVATE_KEY }} +# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} +# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} +# fund_amount_eth: "10" +# environment: ${{ needs.validate-environment.outputs.environment }} +# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} +# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api +# +# - name: Install dependencies +# working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/python +# run: | +# if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then +# echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" +# uv add compass-api-sdk==$UV_PACKAGE_VERSION +# fi +# uv sync +# uv pip freeze +# +# - name: Run example +# working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/python +# run: ./.venv/bin/python main.py #src/main.py +# +# +# run-transaction-bundler-typescript: +# needs: [validate-environment, set-versions] +# +# runs-on: ubuntu-latest +# env: +# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} +# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} +# ETHEREUM_RPC_URL: http://localhost:8545 +# SERVER_URL: http://localhost:80 +# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} +# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} +# +# steps: +# - name: Checkout repository +# uses: actions/checkout@v3 +# +# - name: Set up Node.js +# uses: actions/setup-node@v3 +# with: +# node-version: "20" +# +# - name: Start up full local API and anvil +# uses: ./.github/actions/local_anvil_and_api +# id: local_anvil_and_api +# with: +# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} +# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} +# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} +# private_key: ${{ secrets.PRIVATE_KEY }} +# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} +# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} +# fund_amount_eth: "10" +# environment: ${{ needs.validate-environment.outputs.environment }} +# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} +# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api +# +# - name: Install dependencies +# working-directory: v1/transaction_bundler/typescript +# run: | +# npm install +# if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then +# npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION +# fi +# npm list +# +# - name: Build application +# working-directory: v1/transaction_bundler/typescript +# run: npm run build +# +# - name: Run application +# working-directory: v1/transaction_bundler/typescript +# run: npm run start +# +# run-transaction-bundler-python: +# needs: [validate-environment, set-versions] +# +# runs-on: ubuntu-latest +# env: +# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} +# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} +# ETHEREUM_RPC_URL: http://localhost:8545 +# SERVER_URL: http://localhost:80 +# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} +# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} +# +# steps: +# - name: Checkout repository +# uses: actions/checkout@v3 +# +# - name: Install uv +# run: curl -LsSf https://astral.sh/uv/install.sh | sh +# +# - name: Start up full local API and anvil +# uses: ./.github/actions/local_anvil_and_api +# id: local_anvil_and_api +# with: +# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} +# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} +# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} +# private_key: ${{ secrets.PRIVATE_KEY }} +# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} +# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} +# fund_amount_eth: "10" +# environment: ${{ needs.validate-environment.outputs.environment }} +# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} +# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api +# +# - name: Install dependencies +# working-directory: v1/transaction_bundler/python +# run: | +# if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then +# echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" +# uv add compass-api-sdk==$UV_PACKAGE_VERSION +# fi +# uv sync +# uv pip freeze +# +# - name: Run example +# working-directory: v1/transaction_bundler/python +# run: ./.venv/bin/python src/main.py +# +# run-aave-looping-typescript: +# needs: [validate-environment, set-versions] +# +# runs-on: ubuntu-latest +# env: +# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} +# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} +# ETHEREUM_RPC_URL: http://localhost:8545 +# SERVER_URL: http://localhost:80 +# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} +# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} +# +# steps: +# - name: Checkout repository +# uses: actions/checkout@v3 +# +# - name: Set up Node.js +# uses: actions/setup-node@v3 +# with: +# node-version: "20" +# +# - name: Start up full local API and anvil +# uses: ./.github/actions/local_anvil_and_api +# id: local_anvil_and_api +# with: +# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} +# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} +# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} +# private_key: ${{ secrets.PRIVATE_KEY }} +# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} +# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} +# fund_amount_eth: "10" +# environment: ${{ needs.validate-environment.outputs.environment }} +# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} +# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api +# +# - name: Install dependencies +# working-directory: v1/aave_looping/typescript +# run: | +# npm install +# if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then +# npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION +# fi +# npm list +# +# - name: Build application +# working-directory: v1/aave_looping/typescript +# run: npm run build +# +# - name: Run application +# working-directory: v1/aave_looping/typescript +# run: npm run start +# +# run-aave-looping-python: +# needs: [validate-environment, set-versions] +# +# runs-on: ubuntu-latest +# env: +# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} +# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} +# ETHEREUM_RPC_URL: http://localhost:8545 +# SERVER_URL: http://localhost:80 +# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} +# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} +# +# steps: +# - name: Checkout repository +# uses: actions/checkout@v3 +# +# - name: Install uv +# run: curl -LsSf https://astral.sh/uv/install.sh | sh +# +# - name: Start up full local API and anvil +# uses: ./.github/actions/local_anvil_and_api +# id: local_anvil_and_api +# with: +# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} +# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} +# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} +# private_key: ${{ secrets.PRIVATE_KEY }} +# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} +# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} +# fund_amount_eth: "10" +# environment: ${{ needs.validate-environment.outputs.environment }} +# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} +# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api +# +# - name: Install dependencies +# working-directory: v1/aave_looping/python +# run: | +# if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then +# echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" +# uv add compass-api-sdk==$UV_PACKAGE_VERSION +# fi +# uv sync +# uv pip freeze +# +# - name: Run example +# working-directory: v1/aave_looping/python +# run: ./.venv/bin/python src/main.py +# +# failure-alert: +# if: failure() && github.event_name == 'schedule' # Runs only if a previous job failed & triggered by cron +# runs-on: ubuntu-latest +# needs: +# [ +# run-pendle-typescript, +# run-pendle-python, +# run-transaction-bundler-typescript, +# run-transaction-bundler-python, +# run-aave-looping-typescript, +# run-aave-looping-python, +# ] +# steps: +# - name: Send failure notification +# run: | +# curl -X POST "https://allquiet.app/api/webhook/829f846c-4dfa-4a58-ab33-eafae34a57c9" \ +# -H "Content-Type: application/json" \ +# -d '{"status": "Open", "severity": "Critical", "message": "GitHub workflow failed", "run_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' discover_sdk_snippets: needs: [validate-environment, set-versions] From 13827834695c9a0d9a198718050da99ab8cd7ff7 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Wed, 24 Sep 2025 17:22:51 +0100 Subject: [PATCH 063/117] =?UTF-8?q?=F0=9F=94=A2=20Limit=20SDK=20snippets?= =?UTF-8?q?=20to=20first=2010=20endpoints=20for=20faster=20testing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- v1/test_sdk_snippets/discover_endpoints.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v1/test_sdk_snippets/discover_endpoints.py b/v1/test_sdk_snippets/discover_endpoints.py index f643aac6..d7344b3f 100644 --- a/v1/test_sdk_snippets/discover_endpoints.py +++ b/v1/test_sdk_snippets/discover_endpoints.py @@ -14,7 +14,7 @@ paths.append(p) break -matrix = {"item": paths} +matrix = {"item": paths[:10]} print("Discovered:", matrix) with open(os.environ["GITHUB_OUTPUT"], "a") as fh: From 6914ac5e30fb313cea62543c628d0e5c3cb741de Mon Sep 17 00:00:00 2001 From: Lukas Scheucher Date: Wed, 24 Sep 2025 17:42:05 +0100 Subject: [PATCH 064/117] Debug --- .github/workflows/test_sdk_snippets.yml | 82 ++++++++++----------- v1/test_sdk_snippets/run_endpoint_python.py | 4 +- 2 files changed, 44 insertions(+), 42 deletions(-) diff --git a/.github/workflows/test_sdk_snippets.yml b/.github/workflows/test_sdk_snippets.yml index 48aba5a7..1892665b 100644 --- a/.github/workflows/test_sdk_snippets.yml +++ b/.github/workflows/test_sdk_snippets.yml @@ -70,44 +70,44 @@ jobs: env: ENDPOINT: ${{ matrix.item }} - typescript: - needs: discover_sdk_snippets # - if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} - runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - strategy: - fail-fast: false - matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup uv and Python - uses: astral-sh/setup-uv@v5 - with: - python-version: "3.12" - - - name: Install dependencies (uv) - working-directory: v1/test_sdk_snippets - run: uv sync - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - - - name: Install Node deps for TS snippets - working-directory: v1/test_sdk_snippets - run: | - npm init -y >/dev/null 2>&1 || true - npm i -D tsx - # Install the TS SDK used by snippets - npm i @compass-labs/api-sdk - - - name: Run endpoint snippet - working-directory: v1/test_sdk_snippets - run: uv run python run_endpoint_typescript.py - env: - ENDPOINT: ${{ matrix.item }} \ No newline at end of file +# typescript: +# needs: discover_sdk_snippets # +# if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} +# runs-on: ubuntu-latest +# env: +# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} +# strategy: +# fail-fast: false +# matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} +# +# steps: +# - name: Checkout repository +# uses: actions/checkout@v4 +# +# - name: Setup uv and Python +# uses: astral-sh/setup-uv@v5 +# with: +# python-version: "3.12" +# +# - name: Install dependencies (uv) +# working-directory: v1/test_sdk_snippets +# run: uv sync +# +# - name: Setup Node.js +# uses: actions/setup-node@v4 +# with: +# node-version: '20' +# +# - name: Install Node deps for TS snippets +# working-directory: v1/test_sdk_snippets +# run: | +# npm init -y >/dev/null 2>&1 || true +# npm i -D tsx +# # Install the TS SDK used by snippets +# npm i @compass-labs/api-sdk +# +# - name: Run endpoint snippet +# working-directory: v1/test_sdk_snippets +# run: uv run python run_endpoint_typescript.py +# env: +# ENDPOINT: ${{ matrix.item }} \ No newline at end of file diff --git a/v1/test_sdk_snippets/run_endpoint_python.py b/v1/test_sdk_snippets/run_endpoint_python.py index dd6919b0..aeed02bc 100644 --- a/v1/test_sdk_snippets/run_endpoint_python.py +++ b/v1/test_sdk_snippets/run_endpoint_python.py @@ -36,6 +36,7 @@ print(f"--- Running python SDK snippet for {ENDPOINT} ---") SNIPPET = SNIPPET.replace("", COMPASS_API_KEY) +print(SNIPPET) # Write snippet to a simple file and run it script_path = os.path.join(os.getcwd(), "snippet.py") with open(script_path, "w", encoding="utf-8") as f: @@ -43,7 +44,8 @@ try: cmd = f"{shlex.quote(sys.executable)} {shlex.quote(script_path)}" - subprocess.run(cmd, shell=True, check=True) + print(cmd) + # subprocess.run(cmd, shell=True, check=True) print(f"✅ PASS: {ENDPOINT}") except subprocess.CalledProcessError as e: print(f"❌ FAIL: {ENDPOINT} – exit code {e.returncode}", file=sys.stderr) From 3e1ac7df234e95adfca351f88ab7860c9e908d42 Mon Sep 17 00:00:00 2001 From: Lukas Scheucher Date: Wed, 24 Sep 2025 17:44:48 +0100 Subject: [PATCH 065/117] Debug --- .github/workflows/test_sdk_snippets.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_sdk_snippets.yml b/.github/workflows/test_sdk_snippets.yml index 1892665b..e7ed7aad 100644 --- a/.github/workflows/test_sdk_snippets.yml +++ b/.github/workflows/test_sdk_snippets.yml @@ -49,6 +49,7 @@ jobs: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} strategy: fail-fast: false + max-parallel: 1 # limit concurrency matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} steps: From d2e8c6fc6645fd709e57ba90e20e0b3f03ddce1a Mon Sep 17 00:00:00 2001 From: Lukas Scheucher Date: Wed, 24 Sep 2025 17:45:26 +0100 Subject: [PATCH 066/117] Debug --- v1/test_sdk_snippets/run_endpoint_python.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v1/test_sdk_snippets/run_endpoint_python.py b/v1/test_sdk_snippets/run_endpoint_python.py index aeed02bc..a4465c3a 100644 --- a/v1/test_sdk_snippets/run_endpoint_python.py +++ b/v1/test_sdk_snippets/run_endpoint_python.py @@ -45,7 +45,7 @@ try: cmd = f"{shlex.quote(sys.executable)} {shlex.quote(script_path)}" print(cmd) - # subprocess.run(cmd, shell=True, check=True) + subprocess.run(cmd, shell=True, check=True) print(f"✅ PASS: {ENDPOINT}") except subprocess.CalledProcessError as e: print(f"❌ FAIL: {ENDPOINT} – exit code {e.returncode}", file=sys.stderr) From 6f318cae867584e6615ab6843986afe59fca70e2 Mon Sep 17 00:00:00 2001 From: Lukas Scheucher Date: Wed, 24 Sep 2025 17:49:06 +0100 Subject: [PATCH 067/117] Debug --- .github/workflows/test_sdk_snippets.yml | 2 +- v1/test_sdk_snippets/discover_endpoints.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_sdk_snippets.yml b/.github/workflows/test_sdk_snippets.yml index e7ed7aad..6ad1a1ee 100644 --- a/.github/workflows/test_sdk_snippets.yml +++ b/.github/workflows/test_sdk_snippets.yml @@ -49,7 +49,7 @@ jobs: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} strategy: fail-fast: false - max-parallel: 1 # limit concurrency + max-parallel: 3 # limit concurrency matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} steps: diff --git a/v1/test_sdk_snippets/discover_endpoints.py b/v1/test_sdk_snippets/discover_endpoints.py index d7344b3f..f643aac6 100644 --- a/v1/test_sdk_snippets/discover_endpoints.py +++ b/v1/test_sdk_snippets/discover_endpoints.py @@ -14,7 +14,7 @@ paths.append(p) break -matrix = {"item": paths[:10]} +matrix = {"item": paths} print("Discovered:", matrix) with open(os.environ["GITHUB_OUTPUT"], "a") as fh: From 3ae49e79d2657a3bc0b38205192c207fd926ca59 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 10:04:35 +0100 Subject: [PATCH 068/117] STAGING --- .../workflows/test_sdk_snippets__staging.yml | 142 ++ .github/workflows/test_usecases_v1.yml | 1296 ++++++++--------- 2 files changed, 734 insertions(+), 704 deletions(-) create mode 100644 .github/workflows/test_sdk_snippets__staging.yml diff --git a/.github/workflows/test_sdk_snippets__staging.yml b/.github/workflows/test_sdk_snippets__staging.yml new file mode 100644 index 00000000..64340844 --- /dev/null +++ b/.github/workflows/test_sdk_snippets__staging.yml @@ -0,0 +1,142 @@ +name: test_usecases_v_one + +on: + schedule: + # Runs at 00:00 UTC every day + - cron: "0 0 * * *" + pull_request: + branches: + - main + workflow_dispatch: + inputs: + environment: + description: "Environment to test" + required: true + type: string + + workflow_call: + inputs: + environment: + description: "Environment to test" + required: true + type: string + +permissions: + id-token: write + contents: write + +env: + AWS_ECR_STS_ROLE: arn:aws:iam::688567264391:role/DojoApiCIRole + +jobs: + validate-environment: + runs-on: ubuntu-latest + outputs: + environment: ${{ steps.validate.outputs.environment }} + steps: + - name: Validate environment input + id: validate + run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" || "${{ github.event_name }}" == "workflow_call" ]]; then + ENVIRONMENT="${{ inputs.environment }}" + else + ENVIRONMENT="local" + fi + if [[ "$ENVIRONMENT" != "staging" && "$ENVIRONMENT" != "prod" && "$ENVIRONMENT" != "local" ]]; then + echo "❌ Error: Invalid environment '$ENVIRONMENT'. Must be 'staging' or 'prod' or 'local'." + exit 1 + fi + echo "✅ Environment '$ENVIRONMENT' is valid" + echo "environment=$ENVIRONMENT" >> $GITHUB_OUTPUT + + set-versions: + needs: [validate-environment] + runs-on: ubuntu-latest + outputs: + npm_package_version: ${{ steps.set-versions.outputs.npm_package_version }} + uv_package_version: ${{ steps.set-versions.outputs.uv_package_version }} + steps: + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "20" + + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Set versions + id: set-versions + run: | + if [[ "${{ needs.validate-environment.outputs.environment }}" == "staging" ]]; then + NPM_PACKAGE_VERSION=$(npm view @compass-labs/api-sdk versions --json | jq -r '.[]' | grep -E 'rc|alpha|beta' | sort -V | tail -1) + UV_PACKAGE_VERSION="$(curl -s https://pypi.org/pypi/compass-api-sdk/json | jq -r '.releases | keys | .[]' | grep -E 'rc|a|b|dev' | sort -V | tail -1)" + else + NPM_PACKAGE_VERSION="latest" + UV_PACKAGE_VERSION="latest" + fi + + echo "npm_package_version=$NPM_PACKAGE_VERSION" >> $GITHUB_OUTPUT + echo "uv_package_version=$UV_PACKAGE_VERSION" >> $GITHUB_OUTPUT + + + discover_sdk_snippets: + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + SERVER_URL: http://localhost:80 # local server + BASE_RPC_URL: http://localhost:8546 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + outputs: + items: ${{ steps.collect.outputs.items }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup uv and Python + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.12" + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/python + run: | + if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then + echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" + uv add compass-api-sdk==$UV_PACKAGE_VERSION + fi + uv sync + uv pip freeze + + - id: collect + name: Collect endpoints (writes items=... to $GITHUB_OUTPUT) + working-directory: v1/test_sdk_snippets + run: uv run python discover_endpoints.py + + - name: Print collected items + run: | + cat > items.json <<'JSON' + ${{ steps.collect.outputs.items }} + JSON + echo "Collected items ✅ (pretty):" + jq . items.json | tee items.pretty.json \ No newline at end of file diff --git a/.github/workflows/test_usecases_v1.yml b/.github/workflows/test_usecases_v1.yml index 66aa5725..060a6891 100644 --- a/.github/workflows/test_usecases_v1.yml +++ b/.github/workflows/test_usecases_v1.yml @@ -1,12 +1,12 @@ name: test_usecases_v_one on: - # schedule: + schedule: # Runs at 00:00 UTC every day - # - cron: "0 0 * * *" - # pull_request: - # branches: - # - main + - cron: "0 0 * * *" + pull_request: + branches: + - main workflow_dispatch: inputs: environment: @@ -48,7 +48,7 @@ jobs: fi echo "✅ Environment '$ENVIRONMENT' is valid" echo "environment=$ENVIRONMENT" >> $GITHUB_OUTPUT - + set-versions: needs: [validate-environment] runs-on: ubuntu-latest @@ -79,745 +79,633 @@ jobs: echo "uv_package_version=$UV_PACKAGE_VERSION" >> $GITHUB_OUTPUT -# run-pendle-typescript: -# needs: [validate-environment, set-versions] -# -# runs-on: ubuntu-latest -# env: -# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} -# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} -# ARBITRUM_RPC_URL: http://localhost:8547 -# SERVER_URL: http://localhost:80 -# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} -# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} -# -# steps: -# - name: Checkout repository -# uses: actions/checkout@v3 -# -# - name: Set up Node.js -# uses: actions/setup-node@v3 -# with: -# node-version: "20" -# -# - name: Start up full local API and anvil -# uses: ./.github/actions/local_anvil_and_api -# id: local_anvil_and_api -# with: -# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} -# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} -# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} -# private_key: ${{ secrets.PRIVATE_KEY }} -# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} -# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} -# fund_amount_eth: "10" -# environment: ${{ needs.validate-environment.outputs.environment }} -# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} -# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api -# -# -# - name: Install dependencies -# working-directory: v1/pendle/typescript -# run: | -# npm install -# if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then -# npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION -# fi -# npm list -# -# - name: Build application -# working-directory: v1/pendle/typescript -# run: npm run build -# -# - name: Run application -# working-directory: v1/pendle/typescript -# run: npm run start -# -# run-pendle-python: -# needs: [validate-environment, set-versions] -# -# runs-on: ubuntu-latest -# env: -# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} -# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} -# ARBITRUM_RPC_URL: http://localhost:8547 -# SERVER_URL: http://localhost:80 -# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} -# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} -# -# steps: -# - name: Checkout repository -# uses: actions/checkout@v3 -# -# - name: Install uv -# run: curl -LsSf https://astral.sh/uv/install.sh | sh -# -# - name: Start up full local API and anvil -# uses: ./.github/actions/local_anvil_and_api -# id: local_anvil_and_api -# with: -# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} -# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} -# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} -# private_key: ${{ secrets.PRIVATE_KEY }} -# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} -# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} -# fund_amount_eth: "10" -# environment: ${{ needs.validate-environment.outputs.environment }} -# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} -# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api -# -# - name: Install dependencies -# working-directory: v1/pendle/python -# run: | -# if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then -# echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" -# uv add compass-api-sdk==$UV_PACKAGE_VERSION -# fi -# uv sync -# uv pip freeze -# -# - name: Run example -# working-directory: v1/pendle/python -# run: ./.venv/bin/python src/main.py -# -# run-typescript-basic-examples-deposit-on-morpho: # -# needs: [validate-environment, set-versions] -# -# runs-on: ubuntu-latest -# env: -# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} -# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} -# BASE_RPC_URL: http://localhost:8546 -# SERVER_URL: http://localhost:80 -# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} -# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} -# -# steps: -# - name: Checkout repository -# uses: actions/checkout@v3 -# -# - name: Set up Node.js -# uses: actions/setup-node@v3 -# with: -# node-version: "20" -# -# - name: Start up full local API and anvil -# uses: ./.github/actions/local_anvil_and_api -# id: local_anvil_and_api -# with: -# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} -# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} -# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} -# private_key: ${{ secrets.PRIVATE_KEY }} -# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} -# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} -# fund_amount_eth: "10" -# environment: ${{ needs.validate-environment.outputs.environment }} -# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} -# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api -# -# - name: Install dependencies -# working-directory: v1/basic_examples/deposit_on_morpho/typescript -# run: | -# npm install -# if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then -# npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION -# fi -# npm list -# -# - name: Build application -# working-directory: v1/basic_examples/deposit_on_morpho/typescript -# run: npm run build -# -# - name: Run application -# working-directory: v1/basic_examples/deposit_on_morpho/typescript -# run: npm run start -# -# -# run-python----basic-examples-deposit-on-morpho: # -# needs: [validate-environment, set-versions] -# -# runs-on: ubuntu-latest -# env: -# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} -# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} -# BASE_RPC_URL: http://localhost:8546 -# SERVER_URL: http://localhost:80 -# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} -# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} -# -# steps: -# - name: Checkout repository -# uses: actions/checkout@v3 -# -# - name: Install uv -# run: curl -LsSf https://astral.sh/uv/install.sh | sh -# -# - name: Start up full local API and anvil -# uses: ./.github/actions/local_anvil_and_api -# id: local_anvil_and_api -# with: -# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} -# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} -# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} -# private_key: ${{ secrets.PRIVATE_KEY }} -# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} -# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} -# fund_amount_eth: "10" -# environment: ${{ needs.validate-environment.outputs.environment }} -# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} -# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api -# -# - name: Install dependencies -# working-directory: v1/basic_examples/deposit_on_morpho/python -# run: | -# if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then -# echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" -# uv add compass-api-sdk==$UV_PACKAGE_VERSION -# fi -# uv sync -# uv pip freeze -# -# - name: Run example -# working-directory: v1/basic_examples/deposit_on_morpho/python -# run: ./.venv/bin/python main.py #src/main.py -# -# -# run-typescript-basic-examples-deposit-on-aave: -# needs: [validate-environment, set-versions] -# -# runs-on: ubuntu-latest -# env: -# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} -# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} -# BASE_RPC_URL: http://localhost:8546 -# SERVER_URL: http://localhost:80 -# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} -# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} -# -# steps: -# - name: Checkout repository -# uses: actions/checkout@v3 -# -# - name: Set up Node.js -# uses: actions/setup-node@v3 -# with: -# node-version: "20" -# -# - name: Start up full local API and anvil -# uses: ./.github/actions/local_anvil_and_api -# id: local_anvil_and_api -# with: -# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} -# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} -# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} -# private_key: ${{ secrets.PRIVATE_KEY }} -# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} -# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} -# fund_amount_eth: "10" -# environment: ${{ needs.validate-environment.outputs.environment }} -# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} -# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api -# -# - name: Install dependencies -# working-directory: v1/basic_examples/deposit_on_aave/typescript -# run: | -# npm install -# if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then -# npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION -# fi -# npm list -# -# - name: Build application -# working-directory: v1/basic_examples/deposit_on_aave/typescript -# run: npm run build -# -# - name: Run application -# working-directory: v1/basic_examples/deposit_on_aave/typescript -# run: npm run start -# -# -# run-python----basic-examples-deposit-on-aave: -# needs: [validate-environment, set-versions] -# -# runs-on: ubuntu-latest -# env: -# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} -# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} -# BASE_RPC_URL: http://localhost:8546 -# SERVER_URL: http://localhost:80 -# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} -# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} -# -# steps: -# - name: Checkout repository -# uses: actions/checkout@v3 -# -# - name: Install uv -# run: curl -LsSf https://astral.sh/uv/install.sh | sh -# -# - name: Start up full local API and anvil -# uses: ./.github/actions/local_anvil_and_api -# id: local_anvil_and_api -# with: -# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} -# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} -# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} -# private_key: ${{ secrets.PRIVATE_KEY }} -# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} -# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} -# fund_amount_eth: "10" -# environment: ${{ needs.validate-environment.outputs.environment }} -# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} -# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api -# -# - name: Install dependencies -# working-directory: v1/basic_examples/deposit_on_aave/python -# run: | -# if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then -# echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" -# uv add compass-api-sdk==$UV_PACKAGE_VERSION -# fi -# uv sync -# uv pip freeze -# -# - name: Run example -# working-directory: v1/basic_examples/deposit_on_aave/python -# run: ./.venv/bin/python main.py #src/main.py -# -# run-typescript-transaction_bundler_embed_a_fee_in_tx: # -# needs: [validate-environment, set-versions] -# -# runs-on: ubuntu-latest -# env: -# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} -# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} -# BASE_RPC_URL: http://localhost:8546 -# #ETHEREUM_RPC_URL: http://localhost:8545 -# SERVER_URL: http://localhost:80 -# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} -# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} -# -# steps: -# - name: Checkout repository -# uses: actions/checkout@v3 -# -# - name: Set up Node.js -# uses: actions/setup-node@v3 -# with: -# node-version: "20" -# -# - name: Start up full local API and anvil -# uses: ./.github/actions/local_anvil_and_api -# id: local_anvil_and_api -# with: -# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} -# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} -# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} -# private_key: ${{ secrets.PRIVATE_KEY }} -# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} -# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} -# fund_amount_eth: "10" -# environment: ${{ needs.validate-environment.outputs.environment }} -# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} -# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api -# -# - name: Install dependencies -# working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/typescript -# run: | -# npm install -# if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then -# npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION -# fi -# npm list -# -# - name: Build application -# working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/typescript -# run: npm run build -# -# - name: Run application -# working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/typescript -# run: npm run start -# -# run-python----transaction_bundler_embed_a_fee_in_tx: # -# needs: [validate-environment, set-versions] -# -# runs-on: ubuntu-latest -# env: -# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} -# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} -# BASE_RPC_URL: http://localhost:8546 -# SERVER_URL: http://localhost:80 -# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} -# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} -# -# steps: -# - name: Checkout repository -# uses: actions/checkout@v3 -# -# - name: Install uv -# run: curl -LsSf https://astral.sh/uv/install.sh | sh -# -# - name: Start up full local API and anvil -# uses: ./.github/actions/local_anvil_and_api -# id: local_anvil_and_api -# with: -# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} -# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} -# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} -# private_key: ${{ secrets.PRIVATE_KEY }} -# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} -# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} -# fund_amount_eth: "10" -# environment: ${{ needs.validate-environment.outputs.environment }} -# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} -# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api -# -# - name: Install dependencies -# working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/python -# run: | -# if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then -# echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" -# uv add compass-api-sdk==$UV_PACKAGE_VERSION -# fi -# uv sync -# uv pip freeze -# -# - name: Run example -# working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/python -# run: ./.venv/bin/python main.py #src/main.py -# -# -# run-transaction-bundler-typescript: -# needs: [validate-environment, set-versions] -# -# runs-on: ubuntu-latest -# env: -# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} -# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} -# ETHEREUM_RPC_URL: http://localhost:8545 -# SERVER_URL: http://localhost:80 -# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} -# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} -# -# steps: -# - name: Checkout repository -# uses: actions/checkout@v3 -# -# - name: Set up Node.js -# uses: actions/setup-node@v3 -# with: -# node-version: "20" -# -# - name: Start up full local API and anvil -# uses: ./.github/actions/local_anvil_and_api -# id: local_anvil_and_api -# with: -# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} -# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} -# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} -# private_key: ${{ secrets.PRIVATE_KEY }} -# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} -# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} -# fund_amount_eth: "10" -# environment: ${{ needs.validate-environment.outputs.environment }} -# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} -# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api -# -# - name: Install dependencies -# working-directory: v1/transaction_bundler/typescript -# run: | -# npm install -# if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then -# npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION -# fi -# npm list -# -# - name: Build application -# working-directory: v1/transaction_bundler/typescript -# run: npm run build -# -# - name: Run application -# working-directory: v1/transaction_bundler/typescript -# run: npm run start -# -# run-transaction-bundler-python: -# needs: [validate-environment, set-versions] -# -# runs-on: ubuntu-latest -# env: -# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} -# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} -# ETHEREUM_RPC_URL: http://localhost:8545 -# SERVER_URL: http://localhost:80 -# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} -# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} -# -# steps: -# - name: Checkout repository -# uses: actions/checkout@v3 -# -# - name: Install uv -# run: curl -LsSf https://astral.sh/uv/install.sh | sh -# -# - name: Start up full local API and anvil -# uses: ./.github/actions/local_anvil_and_api -# id: local_anvil_and_api -# with: -# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} -# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} -# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} -# private_key: ${{ secrets.PRIVATE_KEY }} -# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} -# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} -# fund_amount_eth: "10" -# environment: ${{ needs.validate-environment.outputs.environment }} -# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} -# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api -# -# - name: Install dependencies -# working-directory: v1/transaction_bundler/python -# run: | -# if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then -# echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" -# uv add compass-api-sdk==$UV_PACKAGE_VERSION -# fi -# uv sync -# uv pip freeze -# -# - name: Run example -# working-directory: v1/transaction_bundler/python -# run: ./.venv/bin/python src/main.py -# -# run-aave-looping-typescript: -# needs: [validate-environment, set-versions] -# -# runs-on: ubuntu-latest -# env: -# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} -# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} -# ETHEREUM_RPC_URL: http://localhost:8545 -# SERVER_URL: http://localhost:80 -# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} -# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} -# -# steps: -# - name: Checkout repository -# uses: actions/checkout@v3 -# -# - name: Set up Node.js -# uses: actions/setup-node@v3 -# with: -# node-version: "20" -# -# - name: Start up full local API and anvil -# uses: ./.github/actions/local_anvil_and_api -# id: local_anvil_and_api -# with: -# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} -# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} -# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} -# private_key: ${{ secrets.PRIVATE_KEY }} -# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} -# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} -# fund_amount_eth: "10" -# environment: ${{ needs.validate-environment.outputs.environment }} -# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} -# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api -# -# - name: Install dependencies -# working-directory: v1/aave_looping/typescript -# run: | -# npm install -# if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then -# npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION -# fi -# npm list -# -# - name: Build application -# working-directory: v1/aave_looping/typescript -# run: npm run build -# -# - name: Run application -# working-directory: v1/aave_looping/typescript -# run: npm run start -# -# run-aave-looping-python: -# needs: [validate-environment, set-versions] -# -# runs-on: ubuntu-latest -# env: -# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} -# PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} -# ETHEREUM_RPC_URL: http://localhost:8545 -# SERVER_URL: http://localhost:80 -# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} -# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} -# -# steps: -# - name: Checkout repository -# uses: actions/checkout@v3 -# -# - name: Install uv -# run: curl -LsSf https://astral.sh/uv/install.sh | sh -# -# - name: Start up full local API and anvil -# uses: ./.github/actions/local_anvil_and_api -# id: local_anvil_and_api -# with: -# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} -# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} -# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} -# private_key: ${{ secrets.PRIVATE_KEY }} -# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} -# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} -# fund_amount_eth: "10" -# environment: ${{ needs.validate-environment.outputs.environment }} -# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} -# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api -# -# - name: Install dependencies -# working-directory: v1/aave_looping/python -# run: | -# if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then -# echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" -# uv add compass-api-sdk==$UV_PACKAGE_VERSION -# fi -# uv sync -# uv pip freeze -# -# - name: Run example -# working-directory: v1/aave_looping/python -# run: ./.venv/bin/python src/main.py -# -# failure-alert: -# if: failure() && github.event_name == 'schedule' # Runs only if a previous job failed & triggered by cron -# runs-on: ubuntu-latest -# needs: -# [ -# run-pendle-typescript, -# run-pendle-python, -# run-transaction-bundler-typescript, -# run-transaction-bundler-python, -# run-aave-looping-typescript, -# run-aave-looping-python, -# ] -# steps: -# - name: Send failure notification -# run: | -# curl -X POST "https://allquiet.app/api/webhook/829f846c-4dfa-4a58-ab33-eafae34a57c9" \ -# -H "Content-Type: application/json" \ -# -d '{"status": "Open", "severity": "Critical", "message": "GitHub workflow failed", "run_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' - - discover_sdk_snippets: + run-pendle-typescript: needs: [validate-environment, set-versions] + runs-on: ubuntu-latest env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + ARBITRUM_RPC_URL: http://localhost:8547 + SERVER_URL: http://localhost:80 NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - outputs: - items: ${{ steps.collect.outputs.items }} + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "20" + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + + - name: Install dependencies + working-directory: v1/pendle/typescript + run: | + npm install + if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then + npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION + fi + npm list + + - name: Build application + working-directory: v1/pendle/typescript + run: npm run build + + - name: Run application + working-directory: v1/pendle/typescript + run: npm run start + + run-pendle-python: + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + ARBITRUM_RPC_URL: http://localhost:8547 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/pendle/python + run: | + if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then + echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" + uv add compass-api-sdk==$UV_PACKAGE_VERSION + fi + uv sync + uv pip freeze + + - name: Run example + working-directory: v1/pendle/python + run: ./.venv/bin/python src/main.py + + run-typescript-basic-examples-deposit-on-morpho: # + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + BASE_RPC_URL: http://localhost:8546 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "20" - - name: Setup uv and Python - uses: astral-sh/setup-uv@v5 + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api with: - python-version: "3.12" + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/basic_examples/deposit_on_morpho/typescript + run: | + npm install + if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then + npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION + fi + npm list + + - name: Build application + working-directory: v1/basic_examples/deposit_on_morpho/typescript + run: npm run build + + - name: Run application + working-directory: v1/basic_examples/deposit_on_morpho/typescript + run: npm run start - - name: Install dependencies (uv) - working-directory: v1/test_sdk_snippets - run: uv sync - - id: collect - name: Collect endpoints (writes items=... to $GITHUB_OUTPUT) - working-directory: v1/test_sdk_snippets - run: uv run python discover_endpoints.py + run-python----basic-examples-deposit-on-morpho: # + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + BASE_RPC_URL: http://localhost:8546 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - name: Print collected items + - name: Install dependencies + working-directory: v1/basic_examples/deposit_on_morpho/python run: | - cat > items.json <<'JSON' - ${{ steps.collect.outputs.items }} - JSON - echo "Collected items ✅ (pretty):" - jq . items.json | tee items.pretty.json - - run-sdk-snippets-python: - needs: [validate-environment, set-versions, discover_sdk_snippets] - if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} + if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then + echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" + uv add compass-api-sdk==$UV_PACKAGE_VERSION + fi + uv sync + uv pip freeze + + - name: Run example + working-directory: v1/basic_examples/deposit_on_morpho/python + run: ./.venv/bin/python main.py #src/main.py + + + run-typescript-basic-examples-deposit-on-aave: + needs: [validate-environment, set-versions] + runs-on: ubuntu-latest env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + BASE_RPC_URL: http://localhost:8546 + SERVER_URL: http://localhost:80 NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - strategy: - fail-fast: false - matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v3 - - name: Setup uv and Python - uses: astral-sh/setup-uv@v5 + - name: Set up Node.js + uses: actions/setup-node@v3 with: - python-version: "3.12" + node-version: "20" + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/basic_examples/deposit_on_aave/typescript + run: | + npm install + if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then + npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION + fi + npm list + + - name: Build application + working-directory: v1/basic_examples/deposit_on_aave/typescript + run: npm run build - - name: Install dependencies (uv) - working-directory: v1/test_sdk_snippets - run: uv sync + - name: Run application + working-directory: v1/basic_examples/deposit_on_aave/typescript + run: npm run start - - name: Run endpoint snippet - working-directory: v1/test_sdk_snippets - run: uv run python run_endpoint_python.py - env: - ENDPOINT: ${{ matrix.item }} - run-sdk-snippets-typescript: - needs: [validate-environment, set-versions, discover_sdk_snippets] - if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} + run-python----basic-examples-deposit-on-aave: + needs: [validate-environment, set-versions] + runs-on: ubuntu-latest env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + BASE_RPC_URL: http://localhost:8546 + SERVER_URL: http://localhost:80 NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - strategy: - fail-fast: false - matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v3 + + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh - - name: Setup uv and Python - uses: astral-sh/setup-uv@v5 + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api with: - python-version: "3.12" + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/basic_examples/deposit_on_aave/python + run: | + if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then + echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" + uv add compass-api-sdk==$UV_PACKAGE_VERSION + fi + uv sync + uv pip freeze + + - name: Run example + working-directory: v1/basic_examples/deposit_on_aave/python + run: ./.venv/bin/python main.py #src/main.py + + run-typescript-transaction_bundler_embed_a_fee_in_tx: # + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + BASE_RPC_URL: http://localhost:8546 + #ETHEREUM_RPC_URL: http://localhost:8545 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 - - name: Install dependencies (uv) - working-directory: v1/test_sdk_snippets - run: uv sync + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "20" - - name: Setup Node.js - uses: actions/setup-node@v4 + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api with: - node-version: '20' + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - name: Install Node deps for TS snippets - working-directory: v1/test_sdk_snippets + - name: Install dependencies + working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/typescript + run: | + npm install + if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then + npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION + fi + npm list + + - name: Build application + working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/typescript + run: npm run build + + - name: Run application + working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/typescript + run: npm run start + + run-python----transaction_bundler_embed_a_fee_in_tx: # + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + BASE_RPC_URL: http://localhost:8546 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/python + run: | + if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then + echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" + uv add compass-api-sdk==$UV_PACKAGE_VERSION + fi + uv sync + uv pip freeze + + - name: Run example + working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/python + run: ./.venv/bin/python main.py #src/main.py + + + run-transaction-bundler-typescript: + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + ETHEREUM_RPC_URL: http://localhost:8545 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "20" + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/transaction_bundler/typescript + run: | + npm install + if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then + npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION + fi + npm list + + - name: Build application + working-directory: v1/transaction_bundler/typescript + run: npm run build + + - name: Run application + working-directory: v1/transaction_bundler/typescript + run: npm run start + + run-transaction-bundler-python: + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + ETHEREUM_RPC_URL: http://localhost:8545 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/transaction_bundler/python + run: | + if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then + echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" + uv add compass-api-sdk==$UV_PACKAGE_VERSION + fi + uv sync + uv pip freeze + + - name: Run example + working-directory: v1/transaction_bundler/python + run: ./.venv/bin/python src/main.py + + run-aave-looping-typescript: + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + ETHEREUM_RPC_URL: http://localhost:8545 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "20" + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/aave_looping/typescript + run: | + npm install + if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then + npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION + fi + npm list + + - name: Build application + working-directory: v1/aave_looping/typescript + run: npm run build + + - name: Run application + working-directory: v1/aave_looping/typescript + run: npm run start + + run-aave-looping-python: + needs: [validate-environment, set-versions] + + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + ETHEREUM_RPC_URL: http://localhost:8545 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/aave_looping/python + run: | + if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then + echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" + uv add compass-api-sdk==$UV_PACKAGE_VERSION + fi + uv sync + uv pip freeze + + - name: Run example + working-directory: v1/aave_looping/python + run: ./.venv/bin/python src/main.py + + failure-alert: + if: failure() && github.event_name == 'schedule' # Runs only if a previous job failed & triggered by cron + runs-on: ubuntu-latest + needs: + [ + run-pendle-typescript, + run-pendle-python, + run-transaction-bundler-typescript, + run-transaction-bundler-python, + run-aave-looping-typescript, + run-aave-looping-python, + ] + steps: + - name: Send failure notification run: | - npm init -y >/dev/null 2>&1 || true - npm i -D tsx - # Install the TS SDK used by snippets - npm i @compass-labs/api-sdk@${{ env.NPM_PACKAGE_VERSION }} - - - name: Run endpoint snippet - working-directory: v1/test_sdk_snippets - run: uv run python run_endpoint_typescript.py - env: - ENDPOINT: ${{ matrix.item }} + curl -X POST "https://allquiet.app/api/webhook/829f846c-4dfa-4a58-ab33-eafae34a57c9" \ + -H "Content-Type: application/json" \ + -d '{"status": "Open", "severity": "Critical", "message": "GitHub workflow failed", "run_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' \ No newline at end of file From c3dea46f5f6ea0fd7af4766b9db73e841286bc75 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 10:07:49 +0100 Subject: [PATCH 069/117] STAGING --- .github/workflows/test_sdk_snippets__staging.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_sdk_snippets__staging.yml b/.github/workflows/test_sdk_snippets__staging.yml index 64340844..fa3da30a 100644 --- a/.github/workflows/test_sdk_snippets__staging.yml +++ b/.github/workflows/test_sdk_snippets__staging.yml @@ -1,4 +1,4 @@ -name: test_usecases_v_one +name: test_sdk_snippets_against_staging on: schedule: From 164e5728c9961cff39714e7c1a35266e651a9e44 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 10:16:29 +0100 Subject: [PATCH 070/117] WIP --- .github/workflows/test_sdk_snippets__staging.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_sdk_snippets__staging.yml b/.github/workflows/test_sdk_snippets__staging.yml index fa3da30a..ab4c628a 100644 --- a/.github/workflows/test_sdk_snippets__staging.yml +++ b/.github/workflows/test_sdk_snippets__staging.yml @@ -119,7 +119,7 @@ jobs: ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - name: Install dependencies - working-directory: v1/transaction_bundler/embed_a_fee_in_bundle/python + working-directory: v1/test_sdk_snippets run: | if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" From 4383ebabc90484e26d8a216391ca941a2045003c Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 10:22:10 +0100 Subject: [PATCH 071/117] STAGING --- .../workflows/test_sdk_snippets__staging.yml | 61 ++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_sdk_snippets__staging.yml b/.github/workflows/test_sdk_snippets__staging.yml index ab4c628a..54d57735 100644 --- a/.github/workflows/test_sdk_snippets__staging.yml +++ b/.github/workflows/test_sdk_snippets__staging.yml @@ -139,4 +139,63 @@ jobs: ${{ steps.collect.outputs.items }} JSON echo "Collected items ✅ (pretty):" - jq . items.json | tee items.pretty.json \ No newline at end of file + jq . items.json | tee items.pretty.json + + + python: # Job is called `python` so that subjobs are called python() + # to distinguish them from typescript() + needs: [validate-environment, set-versions, discover_sdk_snippets ] + if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + ETHEREUM_RPC_URL: http://localhost:8545 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + strategy: + fail-fast: false + max-parallel: 3 # limit concurrency + matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup uv and Python + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.12" + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + - name: Install dependencies + working-directory: v1/test_sdk_snippets + run: | + if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then + echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" + uv add compass-api-sdk==$UV_PACKAGE_VERSION + fi + uv sync + uv pip freeze + + - name: Run endpoint snippet + working-directory: v1/test_sdk_snippets + run: uv run python run_endpoint_python.py + env: + ENDPOINT: ${{ matrix.item }} \ No newline at end of file From a4e266c813b01c021c343344186ebfc10be6a57f Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 12:02:01 +0100 Subject: [PATCH 072/117] STAGING --- ...test_sdk_snippets.yml => test_sdk_snippets__production.yml} | 0 v1/test_sdk_snippets/run_endpoint_python.py | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) rename .github/workflows/{test_sdk_snippets.yml => test_sdk_snippets__production.yml} (100%) diff --git a/.github/workflows/test_sdk_snippets.yml b/.github/workflows/test_sdk_snippets__production.yml similarity index 100% rename from .github/workflows/test_sdk_snippets.yml rename to .github/workflows/test_sdk_snippets__production.yml diff --git a/v1/test_sdk_snippets/run_endpoint_python.py b/v1/test_sdk_snippets/run_endpoint_python.py index a4465c3a..9ec90454 100644 --- a/v1/test_sdk_snippets/run_endpoint_python.py +++ b/v1/test_sdk_snippets/run_endpoint_python.py @@ -9,6 +9,7 @@ load_dotenv() COMPASS_API_KEY = os.getenv("COMPASS_API_KEY") +SERVER_URL = os.getenv("SERVER_URL") ENDPOINT = os.getenv("ENDPOINT") print([ENDPOINT]) API_URL = "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" @@ -35,7 +36,7 @@ print(f"--- Running python SDK snippet for {ENDPOINT} ---") -SNIPPET = SNIPPET.replace("", COMPASS_API_KEY) +SNIPPET = SNIPPET.replace("api_key_auth=\"\",", f"api_key_auth='{COMPASS_API_KEY}', server_url='{SERVER_URL}'") print(SNIPPET) # Write snippet to a simple file and run it script_path = os.path.join(os.getcwd(), "snippet.py") From edce7ddf320be86b930ac4b8e7f566db2b4acb22 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 12:02:49 +0100 Subject: [PATCH 073/117] STAGING --- .github/workflows/test_sdk_snippets__production.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_sdk_snippets__production.yml b/.github/workflows/test_sdk_snippets__production.yml index 6ad1a1ee..8981014a 100644 --- a/.github/workflows/test_sdk_snippets__production.yml +++ b/.github/workflows/test_sdk_snippets__production.yml @@ -1,4 +1,4 @@ -name: test_sdk_snippets +name: test_sdk_snippets_against_production on: pull_request: From 2f441e09d67d9d1bd59de15cab1973b989fe2bc4 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 12:43:25 +0100 Subject: [PATCH 074/117] STAGING --- .../test_sdk_snippets__production.yml | 85 ++++++++++--------- .../workflows/test_sdk_snippets__staging.yml | 73 ++++++++++++++++ .../run_endpoint_typescript.py | 6 +- 3 files changed, 122 insertions(+), 42 deletions(-) diff --git a/.github/workflows/test_sdk_snippets__production.yml b/.github/workflows/test_sdk_snippets__production.yml index 8981014a..d49cf9ae 100644 --- a/.github/workflows/test_sdk_snippets__production.yml +++ b/.github/workflows/test_sdk_snippets__production.yml @@ -47,6 +47,7 @@ jobs: runs-on: ubuntu-latest env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + SERVER_URL: https://api.compasslabs.ai/ strategy: fail-fast: false max-parallel: 3 # limit concurrency @@ -71,44 +72,46 @@ jobs: env: ENDPOINT: ${{ matrix.item }} -# typescript: -# needs: discover_sdk_snippets # -# if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} -# runs-on: ubuntu-latest -# env: -# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} -# strategy: -# fail-fast: false -# matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} -# -# steps: -# - name: Checkout repository -# uses: actions/checkout@v4 -# -# - name: Setup uv and Python -# uses: astral-sh/setup-uv@v5 -# with: -# python-version: "3.12" -# -# - name: Install dependencies (uv) -# working-directory: v1/test_sdk_snippets -# run: uv sync -# -# - name: Setup Node.js -# uses: actions/setup-node@v4 -# with: -# node-version: '20' -# -# - name: Install Node deps for TS snippets -# working-directory: v1/test_sdk_snippets -# run: | -# npm init -y >/dev/null 2>&1 || true -# npm i -D tsx -# # Install the TS SDK used by snippets -# npm i @compass-labs/api-sdk -# -# - name: Run endpoint snippet -# working-directory: v1/test_sdk_snippets -# run: uv run python run_endpoint_typescript.py -# env: -# ENDPOINT: ${{ matrix.item }} \ No newline at end of file + typescript: + needs: discover_sdk_snippets # + if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + SERVER_URL: https://api.compasslabs.ai/ + strategy: + fail-fast: false + max-parallel: 3 # limit concurrency + matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup uv and Python + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.12" + + - name: Install dependencies (uv) + working-directory: v1/test_sdk_snippets + run: uv sync + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Node deps for TS snippets + working-directory: v1/test_sdk_snippets + run: | + npm init -y >/dev/null 2>&1 || true + npm i -D tsx + # Install the TS SDK used by snippets + npm i @compass-labs/api-sdk + + - name: Run endpoint snippet + working-directory: v1/test_sdk_snippets + run: uv run python run_endpoint_typescript.py + env: + ENDPOINT: ${{ matrix.item }} \ No newline at end of file diff --git a/.github/workflows/test_sdk_snippets__staging.yml b/.github/workflows/test_sdk_snippets__staging.yml index 54d57735..11414148 100644 --- a/.github/workflows/test_sdk_snippets__staging.yml +++ b/.github/workflows/test_sdk_snippets__staging.yml @@ -197,5 +197,78 @@ jobs: - name: Run endpoint snippet working-directory: v1/test_sdk_snippets run: uv run python run_endpoint_python.py + env: + ENDPOINT: ${{ matrix.item }} + + typescript: + needs: [validate-environment, set-versions, discover_sdk_snippets] + # + if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + ETHEREUM_RPC_URL: http://localhost:8545 + SERVER_URL: http://localhost:80 + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} + UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} + + strategy: + fail-fast: false + max-parallel: 3 # limit concurrency + matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup uv and Python + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.12" + + - name: Start up full local API and anvil + uses: ./.github/actions/local_anvil_and_api + id: local_anvil_and_api + with: + ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} + arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} + base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} + private_key: ${{ secrets.PRIVATE_KEY }} + mono_app_id: ${{ secrets.MONOREPOAPP_ID }} + mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} + fund_amount_eth: "10" + environment: ${{ needs.validate-environment.outputs.environment }} + aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} + ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api + + + - name: Install dependencies (uv) + working-directory: v1/test_sdk_snippets + run: | + if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then + echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" + uv add compass-api-sdk==$UV_PACKAGE_VERSION + fi + uv sync + uv pip freeze + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "20" + + - name: Install Node deps for TS snippets + working-directory: v1/aave_looping/typescript + run: | + npm install + if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then + npm install @compass-labs/api-sdk@$NPM_PACKAGE_VERSION + fi + npm list + + - name: Run endpoint snippet + working-directory: v1/test_sdk_snippets + run: uv run python run_endpoint_typescript.py env: ENDPOINT: ${{ matrix.item }} \ No newline at end of file diff --git a/v1/test_sdk_snippets/run_endpoint_typescript.py b/v1/test_sdk_snippets/run_endpoint_typescript.py index c775c1b2..ad3f0eaf 100644 --- a/v1/test_sdk_snippets/run_endpoint_typescript.py +++ b/v1/test_sdk_snippets/run_endpoint_typescript.py @@ -9,6 +9,7 @@ load_dotenv() COMPASS_API_KEY = os.getenv("COMPASS_API_KEY") +SERVER_URL = os.getenv("SERVER_URL") ENDPOINT = os.getenv("ENDPOINT") print([ENDPOINT]) API_URL = "https://spec.speakeasy.com/compasslabs/api/compass-api-with-code-samples" @@ -35,7 +36,10 @@ print(f"--- Running typescript SDK snippet for {ENDPOINT} ---") -SNIPPET = SNIPPET.replace("", COMPASS_API_KEY) +SNIPPET = SNIPPET.replace( + 'apiKeyAuth: "",', + f'apiKeyAuth: "{COMPASS_API_KEY}",\n serverURL: "{SERVER_URL}",' +) # Write snippet to a simple file and run it script_path = os.path.join(os.getcwd(), "snippet.ts") with open(script_path, "w", encoding="utf-8") as f: From f463db3b0dfda325cc2dc21fb91426bf195b12f3 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 13:45:00 +0100 Subject: [PATCH 075/117] STAGING --- .github/workflows/test_sdk_snippets__production.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_sdk_snippets__production.yml b/.github/workflows/test_sdk_snippets__production.yml index d49cf9ae..94fa8b00 100644 --- a/.github/workflows/test_sdk_snippets__production.yml +++ b/.github/workflows/test_sdk_snippets__production.yml @@ -47,7 +47,7 @@ jobs: runs-on: ubuntu-latest env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - SERVER_URL: https://api.compasslabs.ai/ + SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ strategy: fail-fast: false max-parallel: 3 # limit concurrency @@ -78,7 +78,7 @@ jobs: runs-on: ubuntu-latest env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - SERVER_URL: https://api.compasslabs.ai/ + SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ strategy: fail-fast: false max-parallel: 3 # limit concurrency From d0c013876c1327fae46e0743b26a991443b3f729 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 13:54:09 +0100 Subject: [PATCH 076/117] STAGING --- .github/workflows/test_sdk_snippets__staging.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_sdk_snippets__staging.yml b/.github/workflows/test_sdk_snippets__staging.yml index 11414148..42597d29 100644 --- a/.github/workflows/test_sdk_snippets__staging.yml +++ b/.github/workflows/test_sdk_snippets__staging.yml @@ -86,7 +86,9 @@ jobs: env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - SERVER_URL: http://localhost:80 # local server + #SERVER_URL: http://localhost:80 # local server + SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ + BASE_RPC_URL: http://localhost:8546 NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} @@ -151,7 +153,8 @@ jobs: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} ETHEREUM_RPC_URL: http://localhost:8545 - SERVER_URL: http://localhost:80 + #SERVER_URL: http://localhost:80 + SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} @@ -209,7 +212,9 @@ jobs: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} ETHEREUM_RPC_URL: http://localhost:8545 - SERVER_URL: http://localhost:80 + #SERVER_URL: http://localhost:80 + SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ + NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} From e251bf6ba3b1a0f51b0af891e929d2f51d9be77d Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:13:54 +0100 Subject: [PATCH 077/117] STAGING --- .github/workflows/test_sdk_snippets__production.yml | 4 ++-- .github/workflows/test_sdk_snippets__staging.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_sdk_snippets__production.yml b/.github/workflows/test_sdk_snippets__production.yml index 94fa8b00..49395670 100644 --- a/.github/workflows/test_sdk_snippets__production.yml +++ b/.github/workflows/test_sdk_snippets__production.yml @@ -50,7 +50,7 @@ jobs: SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ strategy: fail-fast: false - max-parallel: 3 # limit concurrency + max-parallel: 30000000 # limit concurrency matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} steps: @@ -81,7 +81,7 @@ jobs: SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ strategy: fail-fast: false - max-parallel: 3 # limit concurrency + max-parallel: 30000000 # limit concurrency matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} steps: diff --git a/.github/workflows/test_sdk_snippets__staging.yml b/.github/workflows/test_sdk_snippets__staging.yml index 42597d29..738ba6b6 100644 --- a/.github/workflows/test_sdk_snippets__staging.yml +++ b/.github/workflows/test_sdk_snippets__staging.yml @@ -160,7 +160,7 @@ jobs: strategy: fail-fast: false - max-parallel: 3 # limit concurrency + max-parallel: 30000000 # limit concurrency matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} steps: @@ -220,7 +220,7 @@ jobs: strategy: fail-fast: false - max-parallel: 3 # limit concurrency + max-parallel: 300000000 # limit concurrency matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} steps: From 4e6566edf7536b290f33caa6cc64d9adfebc17f2 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:16:45 +0100 Subject: [PATCH 078/117] STAGING --- .github/workflows/test_sdk_snippets__staging.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_sdk_snippets__staging.yml b/.github/workflows/test_sdk_snippets__staging.yml index 738ba6b6..b51d0f11 100644 --- a/.github/workflows/test_sdk_snippets__staging.yml +++ b/.github/workflows/test_sdk_snippets__staging.yml @@ -160,7 +160,7 @@ jobs: strategy: fail-fast: false - max-parallel: 30000000 # limit concurrency + #max-parallel: 30000000 # limit concurrency matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} steps: @@ -220,7 +220,7 @@ jobs: strategy: fail-fast: false - max-parallel: 300000000 # limit concurrency + #max-parallel: 300000000 # limit concurrency matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} steps: From c5278bb5857e5b2c11485529f18e12fd2718b98b Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:19:56 +0100 Subject: [PATCH 079/117] STAGING --- .github/workflows/test_sdk_snippets__production.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_sdk_snippets__production.yml b/.github/workflows/test_sdk_snippets__production.yml index 49395670..93bb4d66 100644 --- a/.github/workflows/test_sdk_snippets__production.yml +++ b/.github/workflows/test_sdk_snippets__production.yml @@ -50,7 +50,7 @@ jobs: SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ strategy: fail-fast: false - max-parallel: 30000000 # limit concurrency + #max-parallel: 30000000 # limit concurrency matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} steps: @@ -81,7 +81,7 @@ jobs: SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ strategy: fail-fast: false - max-parallel: 30000000 # limit concurrency + #max-parallel: 30000000 # limit concurrency matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} steps: From b39f50f68cb7cda1c99bdc9addf4267c689ecb62 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:22:11 +0100 Subject: [PATCH 080/117] STAGING --- .../workflows/test_sdk_snippets__staging.yml | 36 +++++++++---------- ..._staging_api_with_production_snippets.yml} | 0 2 files changed, 18 insertions(+), 18 deletions(-) rename .github/workflows/{test_sdk_snippets__production.yml => test_sdk_snippets__staging_api_with_production_snippets.yml} (100%) diff --git a/.github/workflows/test_sdk_snippets__staging.yml b/.github/workflows/test_sdk_snippets__staging.yml index b51d0f11..e42024a6 100644 --- a/.github/workflows/test_sdk_snippets__staging.yml +++ b/.github/workflows/test_sdk_snippets__staging.yml @@ -151,8 +151,8 @@ jobs: runs-on: ubuntu-latest env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - ETHEREUM_RPC_URL: http://localhost:8545 + #PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + #ETHEREUM_RPC_URL: http://localhost:8545 #SERVER_URL: http://localhost:80 SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} @@ -172,20 +172,20 @@ jobs: with: python-version: "3.12" - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api +# - name: Start up full local API and anvil +# uses: ./.github/actions/local_anvil_and_api +# id: local_anvil_and_api +# with: +# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} +# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} +# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} +# #private_key: ${{ secrets.PRIVATE_KEY }} +# #mono_app_id: ${{ secrets.MONOREPOAPP_ID }} +# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} +# fund_amount_eth: "10" +# environment: ${{ needs.validate-environment.outputs.environment }} +# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} +# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - name: Install dependencies working-directory: v1/test_sdk_snippets @@ -210,8 +210,8 @@ jobs: runs-on: ubuntu-latest env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - ETHEREUM_RPC_URL: http://localhost:8545 + #PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + #ETHEREUM_RPC_URL: http://localhost:8545 #SERVER_URL: http://localhost:80 SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ diff --git a/.github/workflows/test_sdk_snippets__production.yml b/.github/workflows/test_sdk_snippets__staging_api_with_production_snippets.yml similarity index 100% rename from .github/workflows/test_sdk_snippets__production.yml rename to .github/workflows/test_sdk_snippets__staging_api_with_production_snippets.yml From 05829930c839f6961ac288e7550b1b02ee53c556 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:22:50 +0100 Subject: [PATCH 081/117] STAGING --- ...taging.yml => test_sdk_snippets__staging_api__rc_snippets.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{test_sdk_snippets__staging.yml => test_sdk_snippets__staging_api__rc_snippets.yml} (100%) diff --git a/.github/workflows/test_sdk_snippets__staging.yml b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml similarity index 100% rename from .github/workflows/test_sdk_snippets__staging.yml rename to .github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml From 5a3a61906e1cc09ffca4d1537f6b011847c4dcd3 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:23:18 +0100 Subject: [PATCH 082/117] STAGING --- ...sdk_snippets__staging_api__rc_snippets.yml | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml index e42024a6..4b47aff0 100644 --- a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml +++ b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml @@ -232,20 +232,20 @@ jobs: with: python-version: "3.12" - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api +# - name: Start up full local API and anvil +# uses: ./.github/actions/local_anvil_and_api +# id: local_anvil_and_api +# with: +# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} +# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} +# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} +# private_key: ${{ secrets.PRIVATE_KEY }} +# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} +# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} +# fund_amount_eth: "10" +# environment: ${{ needs.validate-environment.outputs.environment }} +# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} +# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - name: Install dependencies (uv) From ed96c64214d2852c0573982c4b5c87dc3d7f76ce Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:31:49 +0100 Subject: [PATCH 083/117] WIP --- ...test_sdk_snippets__staging_api__rc_snippets.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml index 4b47aff0..1cdf59a2 100644 --- a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml +++ b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml @@ -78,6 +78,20 @@ jobs: echo "npm_package_version=$NPM_PACKAGE_VERSION" >> $GITHUB_OUTPUT echo "uv_package_version=$UV_PACKAGE_VERSION" >> $GITHUB_OUTPUT + # Print environment parameter with emojis + print-environment-and-package-versions: + needs: [validate-environment, set-versions] + runs-on: ubuntu-latest + steps: + - name: Print environment parameter + run: | + echo "🚀 Starting workflow..." + echo "📋 Workflow input environment: ${{ github.event.inputs.environment }}" + echo "⚙️ Active environment: ${{ needs.validate-environment.outputs.environment }}" + echo "📦 npm package version: ${{ needs.set-versions.outputs.npm_package_version }}" + echo "🐍 uv package version: ${{ needs.set-versions.outputs.uv_package_version }}" + echo "✅ Environment validation complete!" + discover_sdk_snippets: needs: [validate-environment, set-versions] From c8535fa00bb8fb440ce033fe5589c5a68abf71dc Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:32:23 +0100 Subject: [PATCH 084/117] WIP --- .../workflows/test_sdk_snippets__staging_api__rc_snippets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml index 1cdf59a2..5b2845cc 100644 --- a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml +++ b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml @@ -103,7 +103,7 @@ jobs: #SERVER_URL: http://localhost:80 # local server SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ - BASE_RPC_URL: http://localhost:8546 +# BASE_RPC_URL: http://localhost:8546 NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} From f1379ce399b97d9c6f72ed96fdd1391a84212fe3 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:33:40 +0100 Subject: [PATCH 085/117] STAGING --- .../workflows/test_sdk_snippets__staging_api__rc_snippets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml index 5b2845cc..bd652d05 100644 --- a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml +++ b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml @@ -1,4 +1,4 @@ -name: test_sdk_snippets_against_staging +name: test_release_candidate_sdk_snippets_against_staging_api__ on: schedule: From e384603c4ea8b3cf6b5068a2c33bca64fb98aab3 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:34:09 +0100 Subject: [PATCH 086/117] STAGING --- .../test_sdk_snippets__staging_api_with_production_snippets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_sdk_snippets__staging_api_with_production_snippets.yml b/.github/workflows/test_sdk_snippets__staging_api_with_production_snippets.yml index 93bb4d66..0370adb3 100644 --- a/.github/workflows/test_sdk_snippets__staging_api_with_production_snippets.yml +++ b/.github/workflows/test_sdk_snippets__staging_api_with_production_snippets.yml @@ -1,4 +1,4 @@ -name: test_sdk_snippets_against_production +name: test_production_sdk_snippets_against_staging_api_server on: pull_request: From bfc05396a317279f6ddcd6a97458913ee902eeba Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:34:46 +0100 Subject: [PATCH 087/117] STAGING --- .../workflows/test_sdk_snippets__staging_api__rc_snippets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml index bd652d05..8fe8cbec 100644 --- a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml +++ b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml @@ -1,4 +1,4 @@ -name: test_release_candidate_sdk_snippets_against_staging_api__ +name: test_release_candidate_sdk_snippets_against_staging_api_server on: schedule: From 747746d55b80669d4d7c155c9ad72db73f6a9e89 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:35:57 +0100 Subject: [PATCH 088/117] STAGING --- .../workflows/test_sdk_snippets__staging_api__rc_snippets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml index 8fe8cbec..74d0d1f8 100644 --- a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml +++ b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml @@ -67,7 +67,7 @@ jobs: - name: Set versions id: set-versions run: | - if [[ "${{ needs.validate-environment.outputs.environment }}" == "staging" ]]; then + if [[ "${{ needs.validate-environment.outputs.environment }}" == "local" ]]; then NPM_PACKAGE_VERSION=$(npm view @compass-labs/api-sdk versions --json | jq -r '.[]' | grep -E 'rc|alpha|beta' | sort -V | tail -1) UV_PACKAGE_VERSION="$(curl -s https://pypi.org/pypi/compass-api-sdk/json | jq -r '.releases | keys | .[]' | grep -E 'rc|a|b|dev' | sort -V | tail -1)" else From 59c41e90fa0dcfa174d09b549756d3bfc79e9c84 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:37:30 +0100 Subject: [PATCH 089/117] STAGING --- ...sdk_snippets__staging_api__rc_snippets.yml | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml index 74d0d1f8..cebff215 100644 --- a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml +++ b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml @@ -119,20 +119,20 @@ jobs: with: python-version: "3.12" - - name: Start up full local API and anvil - uses: ./.github/actions/local_anvil_and_api - id: local_anvil_and_api - with: - ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} - arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} - base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} - private_key: ${{ secrets.PRIVATE_KEY }} - mono_app_id: ${{ secrets.MONOREPOAPP_ID }} - mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} - fund_amount_eth: "10" - environment: ${{ needs.validate-environment.outputs.environment }} - aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} - ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api +# - name: Start up full local API and anvil +# uses: ./.github/actions/local_anvil_and_api +# id: local_anvil_and_api +# with: +# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} +# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} +# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} +# private_key: ${{ secrets.PRIVATE_KEY }} +# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} +# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} +# fund_amount_eth: "10" +# environment: ${{ needs.validate-environment.outputs.environment }} +# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} +# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - name: Install dependencies working-directory: v1/test_sdk_snippets From 6fbf198337c4c6e7a5a9a49cc96d2ef4a386be88 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:43:28 +0100 Subject: [PATCH 090/117] STAGING --- .../workflows/test_sdk_snippets__staging_api__rc_snippets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml index cebff215..934d8f1a 100644 --- a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml +++ b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml @@ -1,4 +1,4 @@ -name: test_release_candidate_sdk_snippets_against_staging_api_server +name: test_production_snippets___staging_api_server___release_candidate_sdk on: schedule: From 2def586296813d6c913dbcb4e45a169c077754cd Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:47:40 +0100 Subject: [PATCH 091/117] STAGING --- ...test_sdk_snippets__staging_api_with_production_snippets.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_sdk_snippets__staging_api_with_production_snippets.yml b/.github/workflows/test_sdk_snippets__staging_api_with_production_snippets.yml index 0370adb3..714abbba 100644 --- a/.github/workflows/test_sdk_snippets__staging_api_with_production_snippets.yml +++ b/.github/workflows/test_sdk_snippets__staging_api_with_production_snippets.yml @@ -1,4 +1,5 @@ -name: test_production_sdk_snippets_against_staging_api_server +name: test_production_snippets___staging_api_server___latest_sdk +# not sure how to test release candidate snippets on: pull_request: From 9782cd78e6987ea67fde1a02f9988e7cc792445f Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:47:58 +0100 Subject: [PATCH 092/117] STAGING --- ...est_sdk_snippets__staging_api_with_production_snippets.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_sdk_snippets__staging_api_with_production_snippets.yml b/.github/workflows/test_sdk_snippets__staging_api_with_production_snippets.yml index 714abbba..11575a46 100644 --- a/.github/workflows/test_sdk_snippets__staging_api_with_production_snippets.yml +++ b/.github/workflows/test_sdk_snippets__staging_api_with_production_snippets.yml @@ -51,7 +51,7 @@ jobs: SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ strategy: fail-fast: false - #max-parallel: 30000000 # limit concurrency + #max-parallel: 3 # limit concurrency matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} steps: @@ -82,7 +82,7 @@ jobs: SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ strategy: fail-fast: false - #max-parallel: 30000000 # limit concurrency + #max-parallel: 3 # limit concurrency matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} steps: From 1a3db67493487a1ede854618ede41fc96ed5b784 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:48:19 +0100 Subject: [PATCH 093/117] STAGING --- .../workflows/test_sdk_snippets__staging_api__rc_snippets.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml index 934d8f1a..be561aeb 100644 --- a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml +++ b/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml @@ -174,7 +174,7 @@ jobs: strategy: fail-fast: false - #max-parallel: 30000000 # limit concurrency + #max-parallel: 3 # limit concurrency matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} steps: @@ -234,7 +234,7 @@ jobs: strategy: fail-fast: false - #max-parallel: 300000000 # limit concurrency + #max-parallel: 3 # limit concurrency matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} steps: From a28a2cef54db8e5fd61401ce5d8587c3eac40f52 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:51:10 +0100 Subject: [PATCH 094/117] WIP --- ...est_production_snippets___staging_api_server___latest_sdk.yml} | 0 ...ion_snippets___staging_api_server___release_candidate_sdk.yml} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{test_sdk_snippets__staging_api_with_production_snippets.yml => test_production_snippets___staging_api_server___latest_sdk.yml} (100%) rename .github/workflows/{test_sdk_snippets__staging_api__rc_snippets.yml => test_production_snippets___staging_api_server___release_candidate_sdk.yml} (100%) diff --git a/.github/workflows/test_sdk_snippets__staging_api_with_production_snippets.yml b/.github/workflows/test_production_snippets___staging_api_server___latest_sdk.yml similarity index 100% rename from .github/workflows/test_sdk_snippets__staging_api_with_production_snippets.yml rename to .github/workflows/test_production_snippets___staging_api_server___latest_sdk.yml diff --git a/.github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml similarity index 100% rename from .github/workflows/test_sdk_snippets__staging_api__rc_snippets.yml rename to .github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml From a2abbe07fee9ad487aecafb326bf764fa5b1b043 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 14:54:34 +0100 Subject: [PATCH 095/117] WIP --- v1/test_sdk_snippets/run_endpoint_typescript.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v1/test_sdk_snippets/run_endpoint_typescript.py b/v1/test_sdk_snippets/run_endpoint_typescript.py index ad3f0eaf..f18fbd80 100644 --- a/v1/test_sdk_snippets/run_endpoint_typescript.py +++ b/v1/test_sdk_snippets/run_endpoint_typescript.py @@ -24,14 +24,14 @@ for method in ("get", "post"): samples = (methods.get(method, {}) or {}).get("x-codeSamples") or [] for s in samples: - if (s.get("lang") or "").lower().startswith("python"): + if (s.get("lang") or "").lower().startswith("typescript"): SNIPPET = s["source"] break if SNIPPET: break if not SNIPPET: - raise ValueError(f"No Python code sample found for endpoint: {ENDPOINT!r}") + raise ValueError(f"No Typescript code sample found for endpoint: {ENDPOINT!r}") print(f"--- Running typescript SDK snippet for {ENDPOINT} ---") From e5aa5d52ba25c34ceb179c16c9d353005161478f Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 15:02:08 +0100 Subject: [PATCH 096/117] WIP --- ..._production_snippets___staging_api_server___latest_sdk.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test_production_snippets___staging_api_server___latest_sdk.yml b/.github/workflows/test_production_snippets___staging_api_server___latest_sdk.yml index 11575a46..910d6b35 100644 --- a/.github/workflows/test_production_snippets___staging_api_server___latest_sdk.yml +++ b/.github/workflows/test_production_snippets___staging_api_server___latest_sdk.yml @@ -111,6 +111,10 @@ jobs: # Install the TS SDK used by snippets npm i @compass-labs/api-sdk + - name: List installed @compass-labs/api-sdk + working-directory: v1/test_sdk_snippets + run: npm ls @compass-labs/api-sdk || true + - name: Run endpoint snippet working-directory: v1/test_sdk_snippets run: uv run python run_endpoint_typescript.py From 031fdb2df51f5fb937e70435dc7e6ed7d6180d39 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 15:05:55 +0100 Subject: [PATCH 097/117] WIP --- ...on_snippets___staging_api_server___release_candidate_sdk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml index be561aeb..ee2a79e7 100644 --- a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml +++ b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml @@ -278,7 +278,7 @@ jobs: node-version: "20" - name: Install Node deps for TS snippets - working-directory: v1/aave_looping/typescript + working-directory: v1/test_sdk_snippets run: | npm install if [[ "$NPM_PACKAGE_VERSION" != "latest" ]]; then From 190a64bc2c700709fcf9d8edad55f1fbcd073775 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 15:15:47 +0100 Subject: [PATCH 098/117] WIP --- v1/test_sdk_snippets/package.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 v1/test_sdk_snippets/package.json diff --git a/v1/test_sdk_snippets/package.json b/v1/test_sdk_snippets/package.json new file mode 100644 index 00000000..9017f354 --- /dev/null +++ b/v1/test_sdk_snippets/package.json @@ -0,0 +1,13 @@ +{ + "name": "test-sdk-snippets", + "version": "0.0.0", + "private": true, + "type": "module", + "dependencies": { + "@compass-labs/api-sdk": "latest" + }, + "devDependencies": { + "tsx": "^4.19.1" + } +} + From deb6c950f83f5d07cbb055253d4128bd29ff34bf Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 15:17:24 +0100 Subject: [PATCH 099/117] WIP --- ...ppets___staging_api_server___release_candidate_sdk.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml index ee2a79e7..f5ce2c37 100644 --- a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml +++ b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml @@ -277,6 +277,10 @@ jobs: with: node-version: "20" + - name: Print package.json + working-directory: v1/test_sdk_snippets + run: cat package.json + - name: Install Node deps for TS snippets working-directory: v1/test_sdk_snippets run: | @@ -286,6 +290,10 @@ jobs: fi npm list + - name: Print package.json after installing dependencies + working-directory: v1/test_sdk_snippets + run: cat package.json + - name: Run endpoint snippet working-directory: v1/test_sdk_snippets run: uv run python run_endpoint_typescript.py From fc0c4cd998c62554a2864ebf79ae1423b3e3e095 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 15:22:55 +0100 Subject: [PATCH 100/117] WIP --- v1/test_sdk_snippets/.env.example | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/v1/test_sdk_snippets/.env.example b/v1/test_sdk_snippets/.env.example index e7b882f8..b523d3c5 100644 --- a/v1/test_sdk_snippets/.env.example +++ b/v1/test_sdk_snippets/.env.example @@ -1 +1,3 @@ -COMPASS_API_KEY=<> \ No newline at end of file +SERVER_URL=<> # set to staging or prod or local +COMPASS_API_KEY=<> +ENDPOINT=<> \ No newline at end of file From b08518b81e46e38a2f77e029d7b178e24b674e00 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 15:27:25 +0100 Subject: [PATCH 101/117] WIP --- ...ing_api_server___release_candidate_sdk.yml | 39 +------------------ 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml index f5ce2c37..d2c2ac23 100644 --- a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml +++ b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml @@ -165,10 +165,8 @@ jobs: runs-on: ubuntu-latest env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - #PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - #ETHEREUM_RPC_URL: http://localhost:8545 - #SERVER_URL: http://localhost:80 - SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ + #SERVER_URL: https://api.compasslabs.ai/ # production server + SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} @@ -186,21 +184,6 @@ jobs: with: python-version: "3.12" -# - name: Start up full local API and anvil -# uses: ./.github/actions/local_anvil_and_api -# id: local_anvil_and_api -# with: -# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} -# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} -# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} -# #private_key: ${{ secrets.PRIVATE_KEY }} -# #mono_app_id: ${{ secrets.MONOREPOAPP_ID }} -# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} -# fund_amount_eth: "10" -# environment: ${{ needs.validate-environment.outputs.environment }} -# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} -# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - name: Install dependencies working-directory: v1/test_sdk_snippets run: | @@ -224,9 +207,6 @@ jobs: runs-on: ubuntu-latest env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - #PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - #ETHEREUM_RPC_URL: http://localhost:8545 - #SERVER_URL: http://localhost:80 SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} @@ -246,21 +226,6 @@ jobs: with: python-version: "3.12" -# - name: Start up full local API and anvil -# uses: ./.github/actions/local_anvil_and_api -# id: local_anvil_and_api -# with: -# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} -# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} -# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} -# private_key: ${{ secrets.PRIVATE_KEY }} -# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} -# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} -# fund_amount_eth: "10" -# environment: ${{ needs.validate-environment.outputs.environment }} -# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} -# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - name: Install dependencies (uv) working-directory: v1/test_sdk_snippets From ea308d79b95f01eb5dd00529d294334b3626e177 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 15:29:23 +0100 Subject: [PATCH 102/117] WIP --- ...ing_api_server___release_candidate_sdk.yml | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml index d2c2ac23..d5db91e0 100644 --- a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml +++ b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml @@ -100,10 +100,9 @@ jobs: env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - #SERVER_URL: http://localhost:80 # local server - SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ + #SERVER_URL: https://api.compasslabs.ai/ # production server + SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} -# BASE_RPC_URL: http://localhost:8546 NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} @@ -119,21 +118,6 @@ jobs: with: python-version: "3.12" -# - name: Start up full local API and anvil -# uses: ./.github/actions/local_anvil_and_api -# id: local_anvil_and_api -# with: -# ethereum_rpc_url: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} -# arbitrum_rpc_url: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }} -# base_rpc_url: ${{ secrets.BASE_MAINNET_RPC_URL }} -# private_key: ${{ secrets.PRIVATE_KEY }} -# mono_app_id: ${{ secrets.MONOREPOAPP_ID }} -# mono_app_private_key: ${{ secrets.MONOREPOAPP_PRIVATE_KEY }} -# fund_amount_eth: "10" -# environment: ${{ needs.validate-environment.outputs.environment }} -# aws_ecr_sts_role: ${{ env.AWS_ECR_STS_ROLE }} -# ecr_image_uri: 688567264391.dkr.ecr.eu-west-2.amazonaws.com/dojo_api - - name: Install dependencies working-directory: v1/test_sdk_snippets run: | From d4a3a397307476dbba63d89c05856a196ce37d80 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 15:30:25 +0100 Subject: [PATCH 103/117] WIP --- ...ging_api_server___release_candidate_sdk.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml index d5db91e0..e83ff5a5 100644 --- a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml +++ b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml @@ -118,15 +118,15 @@ jobs: with: python-version: "3.12" - - name: Install dependencies - working-directory: v1/test_sdk_snippets - run: | - if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then - echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" - uv add compass-api-sdk==$UV_PACKAGE_VERSION - fi - uv sync - uv pip freeze + # - name: Install dependencies + # working-directory: v1/test_sdk_snippets + # run: | + # if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then + # echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" + # uv add compass-api-sdk==$UV_PACKAGE_VERSION + # fi + # uv sync + # uv pip freeze - id: collect name: Collect endpoints (writes items=... to $GITHUB_OUTPUT) From c1e36b192867b62d5816ae5f8b493356faf7fbdb Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 15:32:09 +0100 Subject: [PATCH 104/117] WIP --- ...ing_api_server___release_candidate_sdk.yml | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml index e83ff5a5..daf66bc7 100644 --- a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml +++ b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml @@ -98,13 +98,13 @@ jobs: runs-on: ubuntu-latest - env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} - #SERVER_URL: https://api.compasslabs.ai/ # production server - SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} - - NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} - UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} +# env: +# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} +# #SERVER_URL: https://api.compasslabs.ai/ # production server +# SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} +# +# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} +# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} outputs: items: ${{ steps.collect.outputs.items }} @@ -118,16 +118,6 @@ jobs: with: python-version: "3.12" - # - name: Install dependencies - # working-directory: v1/test_sdk_snippets - # run: | - # if [[ "$UV_PACKAGE_VERSION" != "latest" ]]; then - # echo "Installing compass-api-sdk==$UV_PACKAGE_VERSION" - # uv add compass-api-sdk==$UV_PACKAGE_VERSION - # fi - # uv sync - # uv pip freeze - - id: collect name: Collect endpoints (writes items=... to $GITHUB_OUTPUT) working-directory: v1/test_sdk_snippets From 7415806e3eefc2d0e1e38d66cfb5049b0bebc0b5 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 15:32:20 +0100 Subject: [PATCH 105/117] WIP --- ...on_snippets___staging_api_server___release_candidate_sdk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml index daf66bc7..2df8d9a4 100644 --- a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml +++ b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml @@ -94,7 +94,7 @@ jobs: discover_sdk_snippets: - needs: [validate-environment, set-versions] + #needs: [validate-environment, set-versions] runs-on: ubuntu-latest From 7e03da3cc9e96cb7c1723a1f12720ee6db4ffaf6 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 15:35:36 +0100 Subject: [PATCH 106/117] WIP --- ...ts___staging_api_server___release_candidate_sdk.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml index 2df8d9a4..f1399a7e 100644 --- a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml +++ b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml @@ -94,18 +94,8 @@ jobs: discover_sdk_snippets: - #needs: [validate-environment, set-versions] - runs-on: ubuntu-latest -# env: -# COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} -# #SERVER_URL: https://api.compasslabs.ai/ # production server -# SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} -# -# NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} -# UV_PACKAGE_VERSION: ${{ needs.set-versions.outputs.uv_package_version }} - outputs: items: ${{ steps.collect.outputs.items }} From 363dfba52e07fe4eeb34ac93e744a03736db87ee Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 15:37:29 +0100 Subject: [PATCH 107/117] WIP --- ...ppets___staging_api_server___release_candidate_sdk.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml index f1399a7e..9a7f4f3b 100644 --- a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml +++ b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml @@ -122,8 +122,8 @@ jobs: jq . items.json | tee items.pretty.json - python: # Job is called `python` so that subjobs are called python() - # to distinguish them from typescript() + python: # Job is called `python` so that subjobs are called `python()` + # to distinguish them from `typescript()` needs: [validate-environment, set-versions, discover_sdk_snippets ] if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} runs-on: ubuntu-latest @@ -158,6 +158,10 @@ jobs: uv sync uv pip freeze + - name: Print pyproject.toml after installing dependencies + working-directory: v1/test_sdk_snippets + run: cat pyproject.toml + - name: Run endpoint snippet working-directory: v1/test_sdk_snippets run: uv run python run_endpoint_python.py From 17a07c225bf1d75e133096f24b1c28ebb5530d92 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 15:41:13 +0100 Subject: [PATCH 108/117] WIP --- v1/test_sdk_snippets/pyproject.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/v1/test_sdk_snippets/pyproject.toml b/v1/test_sdk_snippets/pyproject.toml index 7ea74b78..3ec91e71 100644 --- a/v1/test_sdk_snippets/pyproject.toml +++ b/v1/test_sdk_snippets/pyproject.toml @@ -5,10 +5,10 @@ description = "Add your description here" readme = "README.md" requires-python = ">=3.12" dependencies = [ - "compass-api-sdk>=1.1.2", - "dotenv>=0.9.9", - "eth-account>=0.13.7", - "pyright>=1.1.405", - "ruff>=0.13.1", - "web3>=7.12.0", + "compass-api-sdk", + "dotenv", + "eth-account", + "pyright", + "ruff", + "web3", ] From c607864e36a09bb2e83151ddb39824d96032ec7d Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 15:41:51 +0100 Subject: [PATCH 109/117] WIP --- ..._production_snippets___staging_api_server___latest_sdk.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test_production_snippets___staging_api_server___latest_sdk.yml b/.github/workflows/test_production_snippets___staging_api_server___latest_sdk.yml index 910d6b35..4e165e52 100644 --- a/.github/workflows/test_production_snippets___staging_api_server___latest_sdk.yml +++ b/.github/workflows/test_production_snippets___staging_api_server___latest_sdk.yml @@ -67,6 +67,10 @@ jobs: working-directory: v1/test_sdk_snippets run: uv sync + - name: Print pyproject.toml after installing dependencies + working-directory: v1/test_sdk_snippets + run: cat pyproject.toml + - name: Run endpoint snippet working-directory: v1/test_sdk_snippets run: uv run python run_endpoint_python.py From e52b0aaa46f854961e65876338b2eb8fa6c7af19 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Thu, 25 Sep 2025 15:46:12 +0100 Subject: [PATCH 110/117] WIP --- ...duction_snippets___staging_api_server___latest_sdk.yml | 6 +++++- ...ppets___staging_api_server___release_candidate_sdk.yml | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_production_snippets___staging_api_server___latest_sdk.yml b/.github/workflows/test_production_snippets___staging_api_server___latest_sdk.yml index 4e165e52..62029107 100644 --- a/.github/workflows/test_production_snippets___staging_api_server___latest_sdk.yml +++ b/.github/workflows/test_production_snippets___staging_api_server___latest_sdk.yml @@ -67,9 +67,13 @@ jobs: working-directory: v1/test_sdk_snippets run: uv sync + - name: Print compass-api-sdk version (uv) + working-directory: v1/test_sdk_snippets + run: uv pip freeze | grep -i '^compass-api-sdk' || echo "compass-api-sdk not installed" + - name: Print pyproject.toml after installing dependencies working-directory: v1/test_sdk_snippets - run: cat pyproject.toml + run: cat pyproject.toml - name: Run endpoint snippet working-directory: v1/test_sdk_snippets diff --git a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml index 9a7f4f3b..8e9c2a7e 100644 --- a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml +++ b/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml @@ -158,6 +158,10 @@ jobs: uv sync uv pip freeze + - name: Print compass-api-sdk version (uv) + working-directory: v1/test_sdk_snippets + run: uv pip freeze | grep -i '^compass-api-sdk' || echo "compass-api-sdk not installed" + - name: Print pyproject.toml after installing dependencies working-directory: v1/test_sdk_snippets run: cat pyproject.toml @@ -205,6 +209,10 @@ jobs: uv sync uv pip freeze + - name: Print compass-api-sdk version (uv) + working-directory: v1/test_sdk_snippets + run: uv pip freeze | grep -i '^compass-api-sdk' || echo "compass-api-sdk not installed" + - name: Set up Node.js uses: actions/setup-node@v3 with: From 75c1b97bfd0ff7ce76d1756c91093f27774c4860 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Fri, 26 Sep 2025 11:51:56 +0100 Subject: [PATCH 111/117] WIP --- ..._snippets___prod_api_server___prod_sdk.yml | 132 ++++++++++++++++++ ...ets___staging_api_server___latest_sdk.yml} | 0 ...ng_api_server___release_candidate_sdk.yml} | 0 3 files changed, 132 insertions(+) create mode 100644 .github/workflows/test_prod_snippets___prod_api_server___prod_sdk.yml rename .github/workflows/{test_production_snippets___staging_api_server___latest_sdk.yml => test_prod_snippets___staging_api_server___latest_sdk.yml} (100%) rename .github/workflows/{test_production_snippets___staging_api_server___release_candidate_sdk.yml => test_prod_snippets___staging_api_server___release_candidate_sdk.yml} (100%) diff --git a/.github/workflows/test_prod_snippets___prod_api_server___prod_sdk.yml b/.github/workflows/test_prod_snippets___prod_api_server___prod_sdk.yml new file mode 100644 index 00000000..969663d9 --- /dev/null +++ b/.github/workflows/test_prod_snippets___prod_api_server___prod_sdk.yml @@ -0,0 +1,132 @@ +name: test_production_snippets___staging_api_server___latest_sdk +# not sure how to test release candidate snippets + +on: + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + + discover_sdk_snippets: + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + + outputs: + items: ${{ steps.collect.outputs.items }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup uv and Python + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.12" + + - name: Install dependencies (uv) + working-directory: v1/test_sdk_snippets + run: uv sync + + - id: collect + name: Collect endpoints (writes items=... to $GITHUB_OUTPUT) + working-directory: v1/test_sdk_snippets + run: uv run python discover_endpoints.py + + - name: Print collected items + run: | + cat > items.json <<'JSON' + ${{ steps.collect.outputs.items }} + JSON + echo "Collected items ✅ (pretty):" + jq . items.json | tee items.pretty.json + + python: + needs: discover_sdk_snippets # + if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + #SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} + SERVER_URL: https://api.compasslabs.ai/ + strategy: + fail-fast: false + max-parallel: 3 # limit concurrency + matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup uv and Python + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.12" + + - name: Install dependencies (uv) + working-directory: v1/test_sdk_snippets + run: uv sync + + - name: Print compass-api-sdk version (uv) + working-directory: v1/test_sdk_snippets + run: uv pip freeze | grep -i '^compass-api-sdk' || echo "compass-api-sdk not installed" + + - name: Print pyproject.toml after installing dependencies + working-directory: v1/test_sdk_snippets + run: cat pyproject.toml + + - name: Run endpoint snippet + working-directory: v1/test_sdk_snippets + run: uv run python run_endpoint_python.py + env: + ENDPOINT: ${{ matrix.item }} + + typescript: + needs: discover_sdk_snippets # + if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} + runs-on: ubuntu-latest + env: + COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + #SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} + SERVER_URL: https://api.compasslabs.ai/ + strategy: + fail-fast: false + max-parallel: 3 # limit concurrency + matrix: ${{ fromJson(needs.discover_sdk_snippets.outputs.items) }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup uv and Python + uses: astral-sh/setup-uv@v5 + with: + python-version: "3.12" + + - name: Install dependencies (uv) + working-directory: v1/test_sdk_snippets + run: uv sync + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Node deps for TS snippets + working-directory: v1/test_sdk_snippets + run: | + npm init -y >/dev/null 2>&1 || true + npm i -D tsx + # Install the TS SDK used by snippets + npm i @compass-labs/api-sdk + + - name: List installed @compass-labs/api-sdk + working-directory: v1/test_sdk_snippets + run: npm ls @compass-labs/api-sdk || true + + - name: Run endpoint snippet + working-directory: v1/test_sdk_snippets + run: uv run python run_endpoint_typescript.py + env: + ENDPOINT: ${{ matrix.item }} \ No newline at end of file diff --git a/.github/workflows/test_production_snippets___staging_api_server___latest_sdk.yml b/.github/workflows/test_prod_snippets___staging_api_server___latest_sdk.yml similarity index 100% rename from .github/workflows/test_production_snippets___staging_api_server___latest_sdk.yml rename to .github/workflows/test_prod_snippets___staging_api_server___latest_sdk.yml diff --git a/.github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml b/.github/workflows/test_prod_snippets___staging_api_server___release_candidate_sdk.yml similarity index 100% rename from .github/workflows/test_production_snippets___staging_api_server___release_candidate_sdk.yml rename to .github/workflows/test_prod_snippets___staging_api_server___release_candidate_sdk.yml From 1f7624e28aaf17439d3f19d20d848d4164d16929 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Fri, 26 Sep 2025 11:52:43 +0100 Subject: [PATCH 112/117] WIP --- .../test_prod_snippets___prod_api_server___prod_sdk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_prod_snippets___prod_api_server___prod_sdk.yml b/.github/workflows/test_prod_snippets___prod_api_server___prod_sdk.yml index 969663d9..8df3ff42 100644 --- a/.github/workflows/test_prod_snippets___prod_api_server___prod_sdk.yml +++ b/.github/workflows/test_prod_snippets___prod_api_server___prod_sdk.yml @@ -1,4 +1,4 @@ -name: test_production_snippets___staging_api_server___latest_sdk +name: test_prod_snippets___prod_api_server___prod_sdk # not sure how to test release candidate snippets on: From 4bab6a619da6db2f03980949e3eeca58b8835352 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Fri, 26 Sep 2025 11:52:54 +0100 Subject: [PATCH 113/117] WIP --- .../test_prod_snippets___staging_api_server___latest_sdk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_prod_snippets___staging_api_server___latest_sdk.yml b/.github/workflows/test_prod_snippets___staging_api_server___latest_sdk.yml index 62029107..48c33011 100644 --- a/.github/workflows/test_prod_snippets___staging_api_server___latest_sdk.yml +++ b/.github/workflows/test_prod_snippets___staging_api_server___latest_sdk.yml @@ -1,4 +1,4 @@ -name: test_production_snippets___staging_api_server___latest_sdk +name: test_prod_snippets___staging_api_server___latest_sdk # not sure how to test release candidate snippets on: From df502e8d094ff7e14f1d1fd35875731047aff192 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Fri, 26 Sep 2025 12:01:35 +0100 Subject: [PATCH 114/117] WIP --- .../test_prod_snippets___staging_api_server___latest_sdk.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_prod_snippets___staging_api_server___latest_sdk.yml b/.github/workflows/test_prod_snippets___staging_api_server___latest_sdk.yml index 48c33011..d649665d 100644 --- a/.github/workflows/test_prod_snippets___staging_api_server___latest_sdk.yml +++ b/.github/workflows/test_prod_snippets___staging_api_server___latest_sdk.yml @@ -49,6 +49,7 @@ jobs: env: COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ + strategy: fail-fast: false #max-parallel: 3 # limit concurrency From e122ab7e4287f65242e5ee4ec81a7156ddf99411 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Wed, 8 Oct 2025 07:22:20 +0100 Subject: [PATCH 115/117] remove v0 workflow --- .../test_prod_snippets___prod_api_server___prod_sdk.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test_prod_snippets___prod_api_server___prod_sdk.yml b/.github/workflows/test_prod_snippets___prod_api_server___prod_sdk.yml index 8df3ff42..5d05701c 100644 --- a/.github/workflows/test_prod_snippets___prod_api_server___prod_sdk.yml +++ b/.github/workflows/test_prod_snippets___prod_api_server___prod_sdk.yml @@ -4,6 +4,9 @@ name: test_prod_snippets___prod_api_server___prod_sdk on: pull_request: branches: [ main ] + push: + branches: + - 'conor/com-5939-create-workflow-for-sdk-snippets-test' workflow_dispatch: jobs: From 2c828c3614dbbb487a3a3cc7338ce8c818f342be Mon Sep 17 00:00:00 2001 From: ccosnett Date: Wed, 8 Oct 2025 09:00:54 +0100 Subject: [PATCH 116/117] running staging workflow --- .../test_prod_snippets___staging_api_server___latest_sdk.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test_prod_snippets___staging_api_server___latest_sdk.yml b/.github/workflows/test_prod_snippets___staging_api_server___latest_sdk.yml index d649665d..57f57f06 100644 --- a/.github/workflows/test_prod_snippets___staging_api_server___latest_sdk.yml +++ b/.github/workflows/test_prod_snippets___staging_api_server___latest_sdk.yml @@ -4,6 +4,10 @@ name: test_prod_snippets___staging_api_server___latest_sdk on: pull_request: branches: [ main ] + push: + branches: + - 'conor/com-5939-create-workflow-for-sdk-snippets-test' + workflow_dispatch: jobs: From f5fddc11ac9accb34769ed96a4c67016c6f31d79 Mon Sep 17 00:00:00 2001 From: ccosnett Date: Wed, 8 Oct 2025 09:11:31 +0100 Subject: [PATCH 117/117] STAGING_COMPASS_API_KEY --- ...test_prod_snippets___staging_api_server___latest_sdk.yml | 6 +++--- ...nippets___staging_api_server___release_candidate_sdk.yml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_prod_snippets___staging_api_server___latest_sdk.yml b/.github/workflows/test_prod_snippets___staging_api_server___latest_sdk.yml index 57f57f06..711aa692 100644 --- a/.github/workflows/test_prod_snippets___staging_api_server___latest_sdk.yml +++ b/.github/workflows/test_prod_snippets___staging_api_server___latest_sdk.yml @@ -15,7 +15,7 @@ jobs: discover_sdk_snippets: runs-on: ubuntu-latest env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + COMPASS_API_KEY: ${{ secrets.STAGING_COMPASS_API_KEY }} outputs: items: ${{ steps.collect.outputs.items }} @@ -51,7 +51,7 @@ jobs: if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} runs-on: ubuntu-latest env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + COMPASS_API_KEY: ${{ secrets.STAGING_COMPASS_API_KEY }} SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ strategy: @@ -91,7 +91,7 @@ jobs: if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} runs-on: ubuntu-latest env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + COMPASS_API_KEY: ${{ secrets.STAGING_COMPASS_API_KEY }} SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ strategy: fail-fast: false diff --git a/.github/workflows/test_prod_snippets___staging_api_server___release_candidate_sdk.yml b/.github/workflows/test_prod_snippets___staging_api_server___release_candidate_sdk.yml index 8e9c2a7e..0242cec2 100644 --- a/.github/workflows/test_prod_snippets___staging_api_server___release_candidate_sdk.yml +++ b/.github/workflows/test_prod_snippets___staging_api_server___release_candidate_sdk.yml @@ -128,7 +128,7 @@ jobs: if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} runs-on: ubuntu-latest env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + COMPASS_API_KEY: ${{ secrets.STAGING_COMPASS_API_KEY }} #SERVER_URL: https://api.compasslabs.ai/ # production server SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }} @@ -178,7 +178,7 @@ jobs: if: ${{ needs.discover_sdk_snippets.outputs.items != '' }} runs-on: ubuntu-latest env: - COMPASS_API_KEY: ${{ secrets.COMPASS_API_KEY }} + COMPASS_API_KEY: ${{ secrets.STAGING_COMPASS_API_KEY }} SERVER_URL: ${{ secrets.STAGING_SERVER_URL }} #https://api.compasslabs.ai/ NPM_PACKAGE_VERSION: ${{ needs.set-versions.outputs.npm_package_version }}