Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasbordeau authored Dec 27, 2024
2 parents 2dea8df + acc07f5 commit 9fb443f
Show file tree
Hide file tree
Showing 1,036 changed files with 22,159 additions and 10,992 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/ci-demo-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CI Demo check
on:
schedule:
- cron: '30 7,19 * * *'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
timeout-minutes: 15
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/twenty-e2e-testing
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Install dependencies
uses: ./.github/workflows/actions/yarn-install

- name: Install Playwright Browsers
run: yarn playwright install --with-deps

- name: Run Playwright tests
id: test
run: yarn playwright test --grep "@demo-only"

- name: Upload report after tests
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 90

- name: Send Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/[email protected]
with:
args: 'Demo check ${{ steps.test.outcome }} - check ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'

- name: Send email if demo is not working
if: steps.test.outcome == 'failure'
uses: dawidd6/[email protected]
with:
connection_url: ${{ secrets.MAIL_CONNECTION }}
server_address: smtp.gmail.com
server_port: 465
secure: true
username: ${{ secrets.MAIL_USERNAME }}
subject: 'Demo is not working'
from: 'Github CI Demo check'
to: ${{ secrets.RECIPIENTS }}
body: '<a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}">Link</a>'
priority: high
1 change: 1 addition & 0 deletions .github/workflows/ci-front.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
package.json
packages/twenty-front/**
packages/twenty-ui/**
packages/twenty-shared/**
- name: Skip if no relevant changes
if: steps.changed-files.outputs.any_changed == 'false'
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/ci-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,14 @@ jobs:
package.json
packages/twenty-server/**
packages/twenty-emails/**
packages/twenty-shared/**
- name: Install dependencies
if: steps.changed-files.outputs.any_changed == 'true'
uses: ./.github/workflows/actions/yarn-install
- name: Build twenty-shared
if: steps.changed-files.outputs.any_changed == 'true'
run: npx nx build twenty-shared
- name: Server / Restore Task Cache
if: steps.changed-files.outputs.any_changed == 'true'
uses: ./.github/workflows/actions/task-cache
Expand Down Expand Up @@ -120,6 +124,7 @@ jobs:
package.json
packages/twenty-server/**
packages/twenty-emails/**
packages/twenty-shared/**
- name: Install dependencies
if: steps.changed-files.outputs.any_changed == 'true'
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/ci-shared.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CI Shared
on:
push:
branches:
- main

pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
shared-test:
timeout-minutes: 30
runs-on: ubuntu-latest
env:
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0
strategy:
matrix:
task: [lint, typecheck, test]
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Fetch custom Github Actions and base branch history
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for changed files
id: changed-files
uses: tj-actions/changed-files@v11
with:
files: |
packages/twenty-shared/**
- name: Skip if no relevant changes
if: steps.changed-files.outputs.any_changed == 'false'
run: echo "No relevant changes. Skipping CI."
- name: Install dependencies
if: steps.changed-files.outputs.any_changed == 'true'
uses: ./.github/workflows/actions/yarn-install
- name: Run ${{ matrix.task }} task
if: steps.changed-files.outputs.any_changed == 'true'
uses: ./.github/workflows/actions/nx-affected
with:
tag: scope:frontend
tasks: ${{ matrix.task }}
4 changes: 4 additions & 0 deletions .vscode/twenty.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
"name": "packages/twenty-emails",
"path": "../packages/twenty-emails"
},
{
"name": "packages/twenty-shared",
"path": "../packages/twenty-shared"
},
{
"name": "packages/twenty-server",
"path": "../packages/twenty-server"
Expand Down
14 changes: 9 additions & 5 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"configurations": {
"ci": { "cacheStrategy": "content" },
"fix": { "fix": true }
}
},
"dependsOn": ["^build"]
},
"fmt": {
"executor": "nx:run-commands",
Expand All @@ -63,7 +64,8 @@
"configurations": {
"ci": { "cacheStrategy": "content" },
"fix": { "write": true }
}
},
"dependsOn": ["^build"]
},
"typecheck": {
"executor": "nx:run-commands",
Expand All @@ -74,7 +76,8 @@
},
"configurations": {
"watch": { "watch": true }
}
},
"dependsOn": ["^build"]
},
"test": {
"executor": "@nx/jest:jest",
Expand Down Expand Up @@ -112,10 +115,11 @@
"outputs": ["{projectRoot}/{options.output-dir}"],
"options": {
"cwd": "{projectRoot}",
"command": "VITE_DISABLE_ESLINT_CHECKER=true storybook build",
"command": "VITE_DISABLE_TYPESCRIPT_CHECKER=true VITE_DISABLE_ESLINT_CHECKER=true storybook build",
"output-dir": "storybook-static",
"config-dir": ".storybook"
}
},
"dependsOn": ["^build"]
},
"storybook:serve:dev": {
"executor": "nx:run-commands",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@
"@types/express": "^4.17.13",
"@types/graphql-fields": "^1.3.6",
"@types/graphql-upload": "^8.0.12",
"@types/jest": "^29.5.11",
"@types/js-cookie": "^3.0.3",
"@types/js-levenshtein": "^1.1.3",
"@types/lodash.camelcase": "^4.3.7",
Expand Down Expand Up @@ -365,6 +364,7 @@
"packages/twenty-zapier",
"packages/twenty-website",
"packages/twenty-e2e-testing",
"packages/twenty-shared",
"tools/eslint-rules"
]
}
Expand Down
7 changes: 2 additions & 5 deletions packages/twenty-docker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@ TAG=latest

#PGUSER_SUPERUSER=postgres
#PGPASSWORD_SUPERUSER=replace_me_with_a_strong_password

PG_DATABASE_HOST=db:5432
REDIS_URL=redis://redis:6379
#PG_DATABASE_HOST=db
#REDIS_URL=redis://redis:6379

SERVER_URL=http://localhost:3000

# Use openssl rand -base64 32 for each secret
# APP_SECRET=replace_me_with_a_random_string

SIGN_IN_PREFILLED=true

STORAGE_TYPE=local

# STORAGE_S3_REGION=eu-west3
Expand Down
7 changes: 1 addition & 6 deletions packages/twenty-docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ services:
PORT: 3000
PG_DATABASE_URL: postgres://${PGUSER_SUPERUSER:-postgres}:${PGPASSWORD_SUPERUSER:-postgres}@${PG_DATABASE_HOST:-db:5432}/default
SERVER_URL: ${SERVER_URL}
FRONT_BASE_URL: ${FRONT_BASE_URL:-$SERVER_URL}
REDIS_URL: ${REDIS_URL:-redis://redis:6379}

ENABLE_DB_MIGRATIONS: "true"

SIGN_IN_PREFILLED: ${SIGN_IN_PREFILLED}
STORAGE_TYPE: ${STORAGE_TYPE}
STORAGE_S3_REGION: ${STORAGE_S3_REGION}
Expand All @@ -54,10 +51,8 @@ services:
environment:
PG_DATABASE_URL: postgres://${PGUSER_SUPERUSER:-postgres}:${PGPASSWORD_SUPERUSER:-postgres}@${PG_DATABASE_HOST:-db:5432}/default
SERVER_URL: ${SERVER_URL}
FRONT_BASE_URL: ${FRONT_BASE_URL:-$SERVER_URL}
REDIS_URL: ${REDIS_URL:-redis://redis:6379}

ENABLE_DB_MIGRATIONS: "false" # it already runs on the server
DISABLE_DB_MIGRATIONS: "true" # it already runs on the server

STORAGE_TYPE: ${STORAGE_TYPE}
STORAGE_S3_REGION: ${STORAGE_S3_REGION}
Expand Down
6 changes: 1 addition & 5 deletions packages/twenty-docker/k8s/manifests/deployment-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,12 @@ spec:
value: 3000
- name: SERVER_URL
value: "https://crm.example.com:443"
- name: FRONT_BASE_URL
value: "https://crm.example.com:443"
- name: "PG_DATABASE_URL"
value: "postgres://postgres:[email protected]/default"
- name: "REDIS_URL"
value: "redis://twentycrm-redis.twentycrm.svc.cluster.local:6379"
- name: ENABLE_DB_MIGRATIONS
value: "true"
- name: SIGN_IN_PREFILLED
value: "true"
value: "false"
- name: STORAGE_TYPE
value: "local"
- name: "MESSAGE_QUEUE_TYPE"
Expand Down
4 changes: 1 addition & 3 deletions packages/twenty-docker/k8s/manifests/deployment-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ spec:
env:
- name: SERVER_URL
value: "https://crm.example.com:443"
- name: FRONT_BASE_URL
value: "https://crm.example.com:443"
- name: PG_DATABASE_URL
value: "postgres://postgres:[email protected]/default"
- name: ENABLE_DB_MIGRATIONS
- name: DISABLE_DB_MIGRATIONS
value: "false" # it already runs on the server
- name: STORAGE_TYPE
value: "local"
Expand Down
14 changes: 2 additions & 12 deletions packages/twenty-docker/k8s/terraform/deployment-server.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ resource "kubernetes_deployment" "twentycrm_server" {
value = var.twentycrm_app_hostname
}

env {
name = "FRONT_BASE_URL"
value = var.twentycrm_app_hostname
}

env {
name = "PG_DATABASE_URL"
value = "postgres://twenty:${var.twentycrm_pgdb_admin_password}@${kubernetes_service.twentycrm_db.metadata.0.name}.${kubernetes_namespace.twentycrm.metadata.0.name}.svc.cluster.local/default"
Expand All @@ -65,13 +60,8 @@ resource "kubernetes_deployment" "twentycrm_server" {
value = "redis://${kubernetes_service.twentycrm_redis.metadata.0.name}.${kubernetes_namespace.twentycrm.metadata.0.name}.svc.cluster.local:6379"
}
env {
name = "ENABLE_DB_MIGRATIONS"
value = "true"
}

env {
name = "SIGN_IN_PREFILLED"
value = "true"
name = "DISABLE_DB_MIGRATIONS"
value = "false"
}

env {
Expand Down
9 changes: 2 additions & 7 deletions packages/twenty-docker/k8s/terraform/deployment-worker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ resource "kubernetes_deployment" "twentycrm_worker" {
value = var.twentycrm_app_hostname
}

env {
name = "FRONT_BASE_URL"
value = var.twentycrm_app_hostname
}

env {
name = "PG_DATABASE_URL"
value = "postgres://twenty:${var.twentycrm_pgdb_admin_password}@${kubernetes_service.twentycrm_db.metadata.0.name}.${kubernetes_namespace.twentycrm.metadata.0.name}.svc.cluster.local/default"
Expand All @@ -64,8 +59,8 @@ resource "kubernetes_deployment" "twentycrm_worker" {
}

env {
name = "ENABLE_DB_MIGRATIONS"
value = "false" #it already runs on the server
name = "DISABLE_DB_MIGRATIONS"
value = "true" #it already runs on the server
}

env {
Expand Down
5 changes: 4 additions & 1 deletion packages/twenty-docker/twenty/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ COPY ./packages/twenty-emails/package.json /app/packages/twenty-emails/
COPY ./packages/twenty-server/package.json /app/packages/twenty-server/
COPY ./packages/twenty-server/patches /app/packages/twenty-server/patches
COPY ./packages/twenty-ui/package.json /app/packages/twenty-ui/
COPY ./packages/twenty-shared/package.json /app/packages/twenty-shared/
COPY ./packages/twenty-front/package.json /app/packages/twenty-front/

# Install all dependencies
Expand All @@ -22,6 +23,7 @@ FROM common-deps as twenty-server-build

# Copy sourcecode after installing dependences to accelerate subsequents builds
COPY ./packages/twenty-emails /app/packages/twenty-emails
COPY ./packages/twenty-shared /app/packages/twenty-shared
COPY ./packages/twenty-server /app/packages/twenty-server

RUN npx nx run twenty-server:build
Expand All @@ -31,7 +33,7 @@ RUN mv /app/packages/twenty-server/dist/package.json /app/packages/twenty-server
RUN rm -rf /app/packages/twenty-server/dist
RUN mv /app/packages/twenty-server/build /app/packages/twenty-server/dist

RUN yarn workspaces focus --production twenty-emails twenty-server
RUN yarn workspaces focus --production twenty-emails twenty-shared twenty-server


# Build the front
Expand All @@ -41,6 +43,7 @@ ARG REACT_APP_SERVER_BASE_URL

COPY ./packages/twenty-front /app/packages/twenty-front
COPY ./packages/twenty-ui /app/packages/twenty-ui
COPY ./packages/twenty-shared /app/packages/twenty-shared
RUN npx nx build twenty-front


Expand Down
2 changes: 1 addition & 1 deletion packages/twenty-docker/twenty/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

# Check if the initialization has already been done and that we enabled automatic migration
if [ "${ENABLE_DB_MIGRATIONS}" = "true" ] && [ ! -f /app/docker-data/db_status ]; then
if [ "${DISABLE_DB_MIGRATIONS}" != "true" ] && [ ! -f /app/docker-data/db_status ]; then
echo "Running database setup and migrations..."

# Creating the database if it doesn't exist
Expand Down
Loading

0 comments on commit 9fb443f

Please sign in to comment.