name: CI SDK on: pull_request: merge_group: permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} jobs: changed-files-check: if: github.event_name != 'merge_group' uses: ./.github/workflows/changed-files.yaml with: files: | packages/twenty-sdk/** packages/twenty-server/** !packages/twenty-sdk/package.json sdk-test: needs: changed-files-check if: needs.changed-files-check.outputs.any_changed == 'true' timeout-minutes: 30 runs-on: ubuntu-latest strategy: matrix: task: [lint, typecheck, test:unit, test:integration] steps: - name: Cancel Previous Runs uses: styfle/cancel-workflow-action@0.11.0 with: access_token: ${{ github.token }} - name: Fetch custom Github Actions and base branch history uses: actions/checkout@v4 with: fetch-depth: 10 - name: Install dependencies uses: ./.github/actions/yarn-install - name: Build run: npx nx build twenty-sdk - name: Run ${{ matrix.task }} task uses: ./.github/actions/nx-affected with: tag: scope:sdk tasks: ${{ matrix.task }} sdk-e2e-test: timeout-minutes: 30 runs-on: ubuntu-latest needs: [changed-files-check, sdk-test] if: needs.changed-files-check.outputs.any_changed == 'true' services: postgres: image: postgres:18 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres ports: - 5432:5432 options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 redis: image: redis ports: - 6379:6379 env: NODE_ENV: test TWENTY_API_URL: http://localhost:3000 TWENTY_API_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyMDIwMjAyMC1lNmI1LTQ2ODAtOGEzMi1iODIwOTczNzE1NmIiLCJ1c2VySWQiOiIyMDIwMjAyMC1lNmI1LTQ2ODAtOGEzMi1iODIwOTczNzE1NmIiLCJ3b3Jrc3BhY2VJZCI6IjIwMjAyMDIwLTFjMjUtNGQwMi1iZjI1LTZhZWNjZjdlYTQxOSIsIndvcmtzcGFjZU1lbWJlcklkIjoiMjAyMDIwMjAtNDYzZi00MzViLTgyOGMtMTA3ZTAwN2EyNzExIiwidXNlcldvcmtzcGFjZUlkIjoiMjAyMDIwMjAtMWU3Yy00M2Q5LWE1ZGItNjg1YjUwNjlkODE2IiwidHlwZSI6IkFDQ0VTUyIsImF1dGhQcm92aWRlciI6InBhc3N3b3JkIiwiaWF0IjoxNzUxMjgxNzA0LCJleHAiOjIwNjY4NTc3MDR9.HMGqCsVlOAPVUBhKSGlD1X86VoHKt4LIUtET3CGIdik steps: - name: Fetch custom Github Actions and base branch history uses: actions/checkout@v4 with: fetch-depth: 10 - name: Install dependencies uses: ./.github/actions/yarn-install - name: Build run: npx nx build twenty-sdk - name: Server / Create Test DB run: | PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d postgres -c 'CREATE DATABASE "test";' - name: SDK / Run e2e Tests uses: ./.github/actions/nx-affected with: tag: scope:sdk tasks: test:e2e ci-sdk-status-check: if: always() && !cancelled() timeout-minutes: 5 runs-on: ubuntu-latest needs: [changed-files-check, sdk-test, sdk-e2e-test] steps: - name: Fail job if any needs failed if: contains(needs.*.result, 'failure') run: exit 1