feat: add trigger order support to SwiftPlacer #1314
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy on sdk update | |
| on: | |
| pull_request: | |
| types: [opened, synchronize] | |
| repository_dispatch: | |
| types: [jit-sdk-update] | |
| jobs: | |
| build-and-test: | |
| runs-on: ubicloud | |
| # Require maintainer approval for PRs (protects secrets), skip for trusted repository_dispatch | |
| environment: ${{ github.event_name == 'pull_request' && 'pr-dry-run' || '' }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24.x.x" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Setup yarn | |
| run: corepack enable && corepack prepare yarn@4.5.1 --activate | |
| - name: Install dependencies | |
| run: | | |
| yarn install | |
| yarn build | |
| - name: Add specific version of sdk | |
| if: github.event_name == 'repository_dispatch' | |
| run: yarn add @drift-labs/sdk@${{ github.event.client_payload.sdk-version }} | |
| - name: Add specific version of jit sdk | |
| if: github.event_name == 'repository_dispatch' | |
| run: yarn add @drift-labs/jit-proxy@${{ github.event.client_payload.jit-version }} | |
| - name: Sync SDK resolution with dependency version | |
| if: github.event_name == 'repository_dispatch' | |
| env: | |
| YARN_ENABLE_IMMUTABLE_INSTALLS: false | |
| run: | | |
| # Get the SDK version from dependencies and update the resolution to match | |
| # This prevents type conflicts between @drift-labs/sdk and the version bundled in @drift-labs/jit-proxy | |
| SDK_VERSION=$(node -p "require('./package.json').dependencies['@drift-labs/sdk']") | |
| echo "Syncing @drift-labs/sdk resolution to: $SDK_VERSION" | |
| # Update package.json resolution using node | |
| node -e " | |
| const fs = require('fs'); | |
| const pkg = require('./package.json'); | |
| pkg.resolutions = pkg.resolutions || {}; | |
| pkg.resolutions['@drift-labs/sdk'] = '$SDK_VERSION'; | |
| fs.writeFileSync('package.json', JSON.stringify(pkg, null, '\t') + '\n'); | |
| " | |
| # Reinstall to apply the resolution | |
| yarn install | |
| - name: Build after new dependency | |
| if: github.event_name == 'repository_dispatch' | |
| run: yarn run build | |
| - name: Run bot dry-run test (trigger + userPnlSettler) | |
| env: | |
| KEEPER_PRIVATE_KEY: ${{ secrets.KEEPER_PRIVATE_KEY }} | |
| ENDPOINT: ${{ secrets.MAINNET_RPC_ENDPOINT }} | |
| run: | | |
| # Run 2 bots (trigger + userPnlSettler) in dry-run mode to validate SDK compatibility | |
| # This tests: | |
| # 1. SDK imports and DriftClient initialization work | |
| # 2. Bot initialization completes without runtime errors | |
| # 3. One loop iteration runs successfully | |
| # Uses mainnet RPC - no real transactions are sent (dryRun: true) | |
| timeout 180 node lib/index.js --config-file .github/ci-test-config.yaml || exit_code=$? | |
| # timeout returns 124 if the command times out, which is acceptable | |
| # since it means initialization succeeded (bots ran for full duration) | |
| if [ "${exit_code:-0}" -eq 124 ]; then | |
| echo "Bot test timed out after 180s - this is acceptable (bots initialized and ran)" | |
| exit 0 | |
| elif [ "${exit_code:-0}" -ne 0 ]; then | |
| echo "Bot dry-run test failed with exit code ${exit_code}" | |
| exit 1 | |
| fi | |
| echo "Bot dry-run test completed successfully" | |
| - name: Commit and push changes | |
| if: github.event_name == 'repository_dispatch' | |
| run: | | |
| git config user.name "GitHub Actions" | |
| git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
| git add -A | |
| git commit --allow-empty -m "Bumping sdk and jit dependencies to ${{ github.event.client_payload.sdk-version }} and ${{ github.event.client_payload.jit-version }}" | |
| - name: Push changes | |
| if: github.event_name == 'repository_dispatch' | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GH_PAT }} |