Some checks failed
App Prod-Parity E2E Dispatch / dispatch (push) Failing after 10s
CD Storybook UI / build (push) Failing after 3m25s
CD Storybook UI / dispatch (push) Has been skipped
CD deploy main / website-changed-files (push) Successful in 18m8s
CI Agent Skills / changed-files-check (push) Successful in 18m9s
CI Create App E2E minimal / changed-files-check (push) Successful in 24s
CI Create App / changed-files-check (push) Successful in 26s
CI Docs / changed-files-check (push) Successful in 26s
CI Emails / changed-files-check (push) Successful in 28s
CI Example App Hello World / changed-files-check (push) Successful in 23s
CI Front / changed-files-check (push) Has been skipped
CI Example App Postcard / changed-files-check (push) Successful in 27s
CI UI / changed-files-check (push) Has been skipped
CI Utils Test / changed-files-check (push) Successful in 45s
CI Twenty Apps / discover (push) Successful in 1m3s
CD deploy main / deploy-main (push) Failing after 3s
CI Agent Skills / agent-skills-validate (push) Has been skipped
CI Create App / create-app-test (lint) (push) Has been skipped
CI Emails / emails-test (push) Has been skipped
CI Front / front-task (lingui:compile) (push) Has been skipped
CI Front / front-task (lint) (push) Has been skipped
CI Example App Postcard / example-app-postcard (push) Has been skipped
CI UI / ui-task (lint) (push) Has been skipped
CI UI / ui-task (pack-size) (push) Has been skipped
CI UI / ui-task (size) (push) Has been skipped
CI UI / ui-task (test) (push) Has been skipped
CI UI / ui-task (typecheck) (push) Has been skipped
CI Utils Test / utils-test (push) Has been skipped
CI Twenty Apps / ${{ matrix.app.name }} (push) Has been skipped
CI Emails / ci-emails-status-check (push) Successful in 2s
CI Example App Hello World / ci-example-app-hello-world-status-check (push) Successful in 2s
CI Example App Postcard / ci-example-app-postcard-status-check (push) Successful in 3s
CI UI / ui-sb-test (push) Has been skipped
CI Utils Test / ci-utils-test-status-check (push) Successful in 2s
CI Twenty Apps / ci-twenty-apps-status-check (push) Successful in 2s
CI UI / ci-ui-status-check (push) Successful in 2s
CI Desktop / desktop (push) Failing after 1m8s
Push docs to Crowdin / Push documentation to Crowdin (push) Failing after 55s
Push translations to Crowdin / Extract and upload translations (push) Failing after 5s
Push website translations to Crowdin / Extract and upload website translations (push) Failing after 5s
CI Create App / create-app-test (test) (push) Has been skipped
CI Create App / create-app-test (typecheck) (push) Has been skipped
CI Docs / docs-lint (push) Has been skipped
CI Example App Hello World / example-app-hello-world (push) Has been skipped
CI Front / front-task (lingui:extract) (push) Has been skipped
CI Front / front-task (test) (push) Has been skipped
CI Front / front-task (typecheck) (push) Has been skipped
CI UI / ui-sb-build (push) Failing after 1m32s
CI Twenty Apps / ${{ matrix.app.name }} (${{ matrix.server-source }}) (push) Has been skipped
CI Agent Skills / agent-skills-publish (push) Has been skipped
CI Create App / ci-create-app-status-check (push) Successful in 2s
CI Agent Skills / agent-skills-remote-source (push) Has been skipped
CI Create App E2E minimal / create-app-e2e-minimal (push) Has been cancelled
CI E2E Main / e2e-test (push) Has been cancelled
CI Front / front-sb-build (push) Has been cancelled
CI Front / front-build (push) Has been cancelled
CI Create App E2E minimal / ci-create-app-e2e-minimal-status-check (push) Has been cancelled
CI E2E Main / ci-e2e-main-status-check (push) Has been cancelled
CI E2E Main / notify-main-ci-failure (push) Has been cancelled
CI E2E Main / qa-scout-comment (push) Has been cancelled
CI Front / front-sb-test (push) Has been cancelled
CI Front / front-sb-screenshots (push) Has been cancelled
CI Front / ci-front-status-check (push) Has been cancelled
DPA Sub-Processor Sync / sync-subprocessors (push) Failing after 3s
AI Catalog Sync / sync-catalog (push) Failing after 2s
125 lines
4.8 KiB
YAML
125 lines
4.8 KiB
YAML
name: Spawn Twenty Server
|
|
description: >
|
|
Provisions a running Twenty server and returns its URL + API key, from one of
|
|
two sources:
|
|
- dockerhub-latest: the latest published twentycrm/twenty-app-dev image
|
|
(delegates to spawn-twenty-app-dev-test, port 2021).
|
|
- local: a server built from the monorepo's current files (port 3000). It
|
|
brings up its own postgres + redis via docker, so it works inside any job
|
|
without declaring job-level services.
|
|
Both sources expose the same server-url / api-key contract so callers never
|
|
branch on how the server came up.
|
|
|
|
inputs:
|
|
source:
|
|
description: 'Where the server comes from: "dockerhub-latest" or "local".'
|
|
required: false
|
|
default: 'local'
|
|
twenty-version:
|
|
description: 'Docker Hub image tag, only used when source is "dockerhub-latest".'
|
|
required: false
|
|
default: 'latest'
|
|
server-build-cache-key:
|
|
description: 'Cache key used to speed up the local server build (nx cache).'
|
|
required: false
|
|
default: 'server-build'
|
|
|
|
outputs:
|
|
server-url:
|
|
description: 'URL where the Twenty server can be reached'
|
|
value: ${{ steps.resolve.outputs.server-url }}
|
|
api-key:
|
|
description: 'API key (or access token) for the seeded workspace'
|
|
value: ${{ steps.resolve.outputs.api-key }}
|
|
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
- name: Spawn from Docker Hub image
|
|
id: dockerhub
|
|
if: inputs.source == 'dockerhub-latest'
|
|
uses: ./.github/actions/spawn-twenty-app-dev-test
|
|
with:
|
|
twenty-version: ${{ inputs.twenty-version }}
|
|
|
|
- name: Start postgres and redis
|
|
if: inputs.source == 'local'
|
|
shell: bash
|
|
run: |
|
|
docker run -d --name twenty-postgres \
|
|
-e POSTGRES_USER=postgres \
|
|
-e POSTGRES_PASSWORD=postgres \
|
|
-p 5432:5432 \
|
|
postgres:18
|
|
docker run -d --name twenty-redis -p 6379:6379 redis
|
|
|
|
echo "Waiting for postgres…"
|
|
for i in {1..30}; do
|
|
if PGPASSWORD=postgres pg_isready -h localhost -p 5432 -U postgres > /dev/null 2>&1; then
|
|
echo "Postgres ready"
|
|
break
|
|
fi
|
|
sleep 2
|
|
if [ "$i" -eq 30 ]; then
|
|
echo "::error::Postgres did not become ready in time"
|
|
docker logs twenty-postgres 2>&1 | tail -40
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
- name: Install dependencies
|
|
if: inputs.source == 'local'
|
|
uses: ./.github/actions/yarn-install
|
|
|
|
- name: Restore server build cache
|
|
if: inputs.source == 'local'
|
|
uses: ./.github/actions/restore-cache
|
|
with:
|
|
key: ${{ inputs.server-build-cache-key }}
|
|
|
|
- name: Build server from monorepo
|
|
if: inputs.source == 'local'
|
|
shell: bash
|
|
run: |
|
|
npx nx build twenty-shared
|
|
npx nx build twenty-server
|
|
|
|
- name: Write server env and create databases
|
|
if: inputs.source == 'local'
|
|
shell: bash
|
|
run: |
|
|
npx nx reset:env:e2e-testing-server twenty-server
|
|
PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d postgres -c 'CREATE DATABASE "default";'
|
|
PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d postgres -c 'CREATE DATABASE "test";'
|
|
npx nx run twenty-server:database:reset
|
|
|
|
- name: Start server
|
|
if: inputs.source == 'local'
|
|
shell: bash
|
|
run: nohup npx nx start:ci twenty-server &
|
|
|
|
- name: Wait for server to be ready
|
|
if: inputs.source == 'local'
|
|
shell: bash
|
|
run: npx wait-on http://localhost:3000/healthz --timeout 180000 --interval 1000
|
|
|
|
- name: Resolve server url and api key
|
|
id: resolve
|
|
shell: bash
|
|
env:
|
|
SOURCE: ${{ inputs.source }}
|
|
DOCKERHUB_URL: ${{ steps.dockerhub.outputs.server-url }}
|
|
DOCKERHUB_KEY: ${{ steps.dockerhub.outputs.api-key }}
|
|
LOCAL_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyMDIwMjAyMC1lNmI1LTQ2ODAtOGEzMi1iODIwOTczNzE1NmIiLCJ1c2VySWQiOiIyMDIwMjAyMC1lNmI1LTQ2ODAtOGEzMi1iODIwOTczNzE1NmIiLCJ3b3Jrc3BhY2VJZCI6IjIwMjAyMDIwLTFjMjUtNGQwMi1iZjI1LTZhZWNjZjdlYTQxOSIsIndvcmtzcGFjZU1lbWJlcklkIjoiMjAyMDIwMjAtNDYzZi00MzViLTgyOGMtMTA3ZTAwN2EyNzExIiwidXNlcldvcmtzcGFjZUlkIjoiMjAyMDIwMjAtMWU3Yy00M2Q5LWE1ZGItNjg1YjUwNjlkODE2IiwidHlwZSI6IkFDQ0VTUyIsImF1dGhQcm92aWRlciI6InBhc3N3b3JkIiwiaWF0IjoxNzUxMjgxNzA0LCJleHAiOjIwNjY4NTc3MDR9.HMGqCsVlOAPVUBhKSGlD1X86VoHKt4LIUtET3CGIdik
|
|
run: |
|
|
if [ "$SOURCE" = "dockerhub-latest" ]; then
|
|
echo "server-url=$DOCKERHUB_URL" >> "$GITHUB_OUTPUT"
|
|
echo "api-key=$DOCKERHUB_KEY" >> "$GITHUB_OUTPUT"
|
|
elif [ "$SOURCE" = "local" ]; then
|
|
echo "server-url=http://localhost:3000" >> "$GITHUB_OUTPUT"
|
|
echo "api-key=$LOCAL_KEY" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "::error::Unknown source '$SOURCE' (expected 'dockerhub-latest' or 'local')"
|
|
exit 1
|
|
fi
|