Skip to content

Commit

Permalink
Merge branch 'main' into 8978-add-navigation-inside-the-command-menu-…
Browse files Browse the repository at this point in the history
…for-showpage
  • Loading branch information
bosiraphael committed Dec 17, 2024
2 parents d1a2650 + edff53f commit 0a2895d
Show file tree
Hide file tree
Showing 253 changed files with 4,357 additions and 2,114 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/ci-demo-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI demo check
on:
schedule:
- cron: '30 7,19 * * *'

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

jobs:
test:
timeout-minutes: 15
runs-on: ubuntu-latest
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 }}
12 changes: 8 additions & 4 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 @@ -115,7 +118,8 @@
"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
10 changes: 2 additions & 8 deletions packages/twenty-docker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +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
FRONT_DOMAIN=localhost
FRONT_PORT=3000
FRONT_PROTOCOL=http

# 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
4 changes: 1 addition & 3 deletions packages/twenty-docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ services:
SERVER_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,7 +52,7 @@ services:
PG_DATABASE_URL: postgres://${PGUSER_SUPERUSER:-postgres}:${PGPASSWORD_SUPERUSER:-postgres}@${PG_DATABASE_HOST:-db:5432}/default
SERVER_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
4 changes: 1 addition & 3 deletions packages/twenty-docker/k8s/manifests/deployment-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ spec:
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
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
9 changes: 2 additions & 7 deletions packages/twenty-docker/k8s/terraform/deployment-server.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,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
4 changes: 2 additions & 2 deletions packages/twenty-docker/k8s/terraform/deployment-worker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,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
11 changes: 10 additions & 1 deletion packages/twenty-e2e-testing/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,27 @@ export default defineConfig({
expect: {
timeout: 5000,
},
reporter: [['html', { open: 'never' }]],
reporter: process.env.CI ? 'github' : 'list',
projects: [
{
name: 'Login setup',
testMatch: /login\.setup\.ts/, // finds all tests matching this regex, in this case only 1 test should be found
},
{
name: 'Demo check',
use: {
...devices['Desktop Chrome'],
},
testMatch: /demo\/demo_basic\.spec\.ts/,
},
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
storageState: path.resolve(__dirname, '.auth', 'user.json'), // takes saved cookies from directory
},
dependencies: ['Login setup'], // forces to run login setup before running tests from this project - CASE SENSITIVE
testMatch: /all\/.+\.spec\.ts/,
},
{
name: 'firefox',
Expand All @@ -55,6 +63,7 @@ export default defineConfig({
storageState: path.resolve(__dirname, '.auth', 'user.json'),
},
dependencies: ['Login setup'],
testMatch: /all\/.+\.spec\.ts/,
},
{
name: 'Authentication',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect } from '../lib/fixtures/screenshot';
import { test, expect } from '../../lib/fixtures/screenshot';

test.describe('Basic check', () => {
test('Checking if table in Companies is visible', async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, expect } from '@playwright/test';
import { sh } from '../drivers/shell_driver';
import { sh } from '../../drivers/shell_driver';

test.describe('', () => {
test('Testing logging', async ({ page }) => {
Expand Down
15 changes: 15 additions & 0 deletions packages/twenty-e2e-testing/tests/demo/demo_basic.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { test, expect } from '@playwright/test';

test('Check if demo account is working properly @demo-only', async ({
page,
}) => {
await page.goto('https://demo.twenty.com/');
await page.getByRole('button', { name: 'Continue With Email' }).click();
await page.getByRole('button', { name: 'Continue', exact: true }).click();
await page.getByRole('button', { name: 'Sign in' }).click();
await expect(page.getByText('Welcome to Twenty')).not.toBeVisible();
await page.waitForTimeout(5000);
await expect(page.getByText('Server’s on a coffee break')).not.toBeVisible({
timeout: 5000,
});
});
Loading

0 comments on commit 0a2895d

Please sign in to comment.