added git dirty check for our codegen, if the codegen is dirty, build will fail #4929
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: js-build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: # Allows manual invocation | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # https://github.com/actions/checkout | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| # Install and cache JS toolchain and dependencies (node_modules) | |
| - name: Setup JS | |
| uses: ./.github/actions/js-setup | |
| - name: Build | |
| run: pnpm run build-all | |
| - name: Typecheck | |
| run: pnpm run typecheck-all | |
| - name: Prettier | |
| run: pnpm run prettier-all:check | |
| # This is to catch when someone forgets to run `pnpm run version` after bumping package versions as well as check to make sure codegen output is up to date. | |
| # Both of these things will cause git to be dirty after the build step. | |
| - name: Run version script | |
| run: pnpm run version | |
| - name: Run codegen | |
| run: pnpm run codegen-all | |
| # Run prettier again after codegen to ensure generated code is formatted correctly | |
| - name: Run prettier | |
| run: pnpm run prettier-codegen:write | |
| - name: Ensure git is clean | |
| run: | | |
| if [ -z "$( git status --porcelain )" ]; then | |
| echo "Git is clean!" | |
| exit 0 | |
| else | |
| echo "Git is dirty!" | |
| git add -A | |
| git --no-pager diff HEAD | |
| exit 1 | |
| fi | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: build-artifacts-${{ github.sha }} | |
| path: | | |
| packages/*/dist/** | |
| retention-days: 1 | |
| test-prod: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| # https://github.com/actions/checkout | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| # Install and cache JS toolchain and dependencies (node_modules) | |
| - name: Setup JS | |
| uses: ./.github/actions/js-setup | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: build-artifacts-${{ github.sha }} | |
| path: packages/ | |
| - name: Test (prod) | |
| run: anvil & pnpm run test-all && lsof -t -i tcp:8545 | xargs kill | |
| env: | |
| API_PUBLIC_KEY: ${{ secrets.API_PUBLIC_KEY }} | |
| API_PRIVATE_KEY: ${{ secrets.API_PRIVATE_KEY }} | |
| BASE_URL: "https://api.turnkey.com" | |
| ORGANIZATION_ID: ${{ secrets.ORGANIZATION_ID }} | |
| PRIVATE_KEY_ID: ${{ secrets.PRIVATE_KEY_ID }} | |
| EXPECTED_PRIVATE_KEY_ETH_ADDRESS: ${{ secrets.EXPECTED_PRIVATE_KEY_ETH_ADDRESS }} | |
| EXPECTED_PRIVATE_KEY_ETH_ADDRESS_2: ${{ secrets.EXPECTED_PRIVATE_KEY_ETH_ADDRESS_2 }} | |
| EXPECTED_WALLET_ACCOUNT_ETH_ADDRESS: ${{ secrets.EXPECTED_WALLET_ACCOUNT_ETH_ADDRESS }} | |
| EXPECTED_WALLET_ACCOUNT_ETH_ADDRESS_2: ${{ secrets.EXPECTED_WALLET_ACCOUNT_ETH_ADDRESS_2 }} | |
| BANNED_TO_ADDRESS: "0x6F72eDB2429820c2A0606a9FC3cA364f5E9b2375" | |
| SOLANA_TEST_ORG_API_PRIVATE_KEY: ${{ secrets.SOLANA_TEST_ORG_API_PRIVATE_KEY }} | |
| WALLET_ID: ${{ secrets.WALLET_ID }} | |
| test-pre-prod: | |
| runs-on: ubuntu-latest | |
| needs: test-prod | |
| steps: | |
| # https://github.com/actions/checkout | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| # Install and cache JS toolchain and dependencies (node_modules) | |
| - name: Setup JS | |
| uses: ./.github/actions/js-setup | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: build-artifacts-${{ github.sha }} | |
| path: packages/ | |
| - name: Test (preprod) | |
| run: anvil & pnpm run test-all && lsof -t -i tcp:8545 | xargs kill | |
| env: | |
| API_PUBLIC_KEY: ${{ secrets.PREPROD_API_PUBLIC_KEY }} | |
| API_PRIVATE_KEY: ${{ secrets.PREPROD_API_PRIVATE_KEY }} | |
| BASE_URL: ${{ secrets.PREPROD_BASE_URL }} | |
| ORGANIZATION_ID: ${{ secrets.PREPROD_ORGANIZATION_ID }} | |
| PRIVATE_KEY_ID: ${{ secrets.PREPROD_PRIVATE_KEY_ID }} | |
| EXPECTED_PRIVATE_KEY_ETH_ADDRESS: ${{ secrets.PREPROD_EXPECTED_PRIVATE_KEY_ETH_ADDRESS }} | |
| EXPECTED_PRIVATE_KEY_ETH_ADDRESS_2: ${{ secrets.PREPROD_EXPECTED_PRIVATE_KEY_ETH_ADDRESS_2 }} | |
| EXPECTED_WALLET_ACCOUNT_ETH_ADDRESS: ${{ secrets.PREPROD_EXPECTED_WALLET_ACCOUNT_ETH_ADDRESS }} | |
| EXPECTED_WALLET_ACCOUNT_ETH_ADDRESS_2: ${{ secrets.PREPROD_EXPECTED_WALLET_ACCOUNT_ETH_ADDRESS_2 }} | |
| BANNED_TO_ADDRESS: ${{ secrets.PREPROD_BANNED_TO_ADDRESS }} | |
| SOLANA_TEST_ORG_API_PRIVATE_KEY: ${{ secrets.SOLANA_TEST_ORG_API_PRIVATE_KEY }} | |
| WALLET_ID: ${{ secrets.PREPROD_WALLET_ID }} | |
| test-end-to-end: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| env: | |
| NEXT_PUBLIC_BASE_URL: https://api.preprod.turnkey.engineering | |
| NEXT_PUBLIC_AUTH_PROXY_URL: https://authproxy.preprod.turnkey.engineering | |
| NEXT_PUBLIC_ORGANIZATION_ID: 7f947121-11a0-4906-bf7c-76712396a20d | |
| NEXT_PUBLIC_AUTH_PROXY_ID: 8ffb4198-a41e-4d14-b7b8-ada33f410d7a | |
| NEXT_PUBLIC_AUTH_IFRAME_URL: https://auth.preprod.turnkey.engineering | |
| NEXT_PUBLIC_EXPORT_IFRAME_URL: https://export.preprod.turnkey.engineering | |
| NEXT_PUBLIC_IMPORT_IFRAME_URL: https://import.preprod.turnkey.engineering | |
| NEXT_PUBLIC_OAUTH_REDIRECT_URI: http://127.0.0.1:3000/ | |
| NEXT_PUBLIC_GOOGLE_CLIENT_ID: <Google OIDC client ID> | |
| NEXT_PUBLIC_APPLE_CLIENT_ID: <Apple OIDC client ID> | |
| NEXT_PUBLIC_FACEBOOK_CLIENT_ID: <Facebook OIDC client ID> | |
| NEXT_PUBLIC_DISCORD_CLIENT_ID: <Discord OIDC client ID> | |
| NEXT_PUBLIC_X_CLIENT_ID: <X OIDC client ID> | |
| defaults: | |
| run: | |
| working-directory: examples/with-sdk-js | |
| steps: | |
| # https://github.com/actions/checkout | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| # Install and cache JS toolchain and dependencies (node_modules) | |
| - name: Setup JS | |
| uses: ./.github/actions/js-setup | |
| - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: "20" | |
| cache: "pnpm" | |
| # Install workspace deps (uses root lockfile and links workspaces) | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| # (Optional) Build any workspace packages example depends on | |
| - name: Build workspace packages | |
| working-directory: . | |
| run: pnpm -r --filter "./packages/*" build | |
| # Install Playwright browsers + system deps | |
| - name: Install Playwright browsers | |
| run: pnpm exec playwright install chromium --with-deps | |
| - name: Run Playwright tests | |
| env: | |
| CI: "true" | |
| run: pnpm exec playwright test --reporter=line,html | |
| - name: Upload Playwright report | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: playwright-report | |
| path: examples/with-sdk-js/playwright-report | |
| retention-days: 30 |