Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesBochet committed Dec 16, 2024
2 parents 179c0d5 + 5d51a82 commit a4838a2
Show file tree
Hide file tree
Showing 535 changed files with 8,418 additions and 4,656 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,30 @@ jobs:
run: |
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:init:prod
npx nx run twenty-server:database:migrate:prod
- name: Worker / Run
if: steps.changed-files.outputs.any_changed == 'true'
run: npx nx run twenty-server:worker:ci
- name: Server / Check for Pending Migrations
if: steps.changed-files.outputs.any_changed == 'true'
run: |
METADATA_MIGRATION_OUTPUT=$(npx nx run twenty-server:typeorm migration:generate metadata-migration-check -d src/database/typeorm/metadata/metadata.datasource.ts || true)
CORE_MIGRATION_OUTPUT=$(npx nx run twenty-server:typeorm migration:generate core-migration-check -d src/database/typeorm/core/core.datasource.ts || true)
METADATA_MIGRATION_FILE=$(ls packages/twenty-server/*metadata-migration-check.ts 2>/dev/null || echo "")
CORE_MIGRATION_FILE=$(ls packages/twenty-server/*core-migration-check.ts 2>/dev/null || echo "")
if [ -n "$METADATA_MIGRATION_FILE" ] || [ -n "$CORE_MIGRATION_FILE" ]; then
echo "::error::Unexpected migration files were generated. Please create a proper migration manually."
echo "$METADATA_MIGRATION_OUTPUT"
echo "$CORE_MIGRATION_OUTPUT"
rm -f packages/twenty-server/*metadata-migration-check.ts packages/twenty-server/*core-migration-check.ts
exit 1
fi
server-test:
timeout-minutes: 30
Expand Down
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"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"
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"@types/nodemailer": "^6.4.14",
"@types/passport-microsoft": "^1.0.3",
"@wyw-in-js/vite": "^0.5.3",
"@xyflow/react": "^12.3.5",
"add": "^2.0.6",
"addressparser": "^1.0.1",
"afterframe": "^1.0.2",
Expand Down Expand Up @@ -168,7 +169,6 @@
"react-router-dom": "^6.4.4",
"react-textarea-autosize": "^8.4.1",
"react-tooltip": "^5.13.1",
"reactflow": "^11.11.3",
"recoil": "^0.7.7",
"rehype-slug": "^6.0.0",
"remark-behead": "^3.1.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/twenty-docker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ PG_DATABASE_HOST=db:5432
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
Expand Down
3 changes: 0 additions & 3 deletions packages/twenty-docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ 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"
Expand Down Expand Up @@ -54,9 +53,7 @@ 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

STORAGE_TYPE: ${STORAGE_TYPE}
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 @@ -37,10 +37,8 @@ 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:postgres@twenty-db.twentycrm.svc.cluster.local/default"
value: "postgres://postgres:postgres@twentycrm-db.twentycrm.svc.cluster.local/default"
- name: "REDIS_URL"
value: "redis://twentycrm-redis.twentycrm.svc.cluster.local:6379"
- name: ENABLE_DB_MIGRATIONS
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,10 +28,8 @@ 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:postgres@twenty-db.twentycrm.svc.cluster.local/default"
value: "postgres://postgres:postgres@twentycrm-db.twentycrm.svc.cluster.local/default"
- name: ENABLE_DB_MIGRATIONS
value: "false" # it already runs on the server
- name: STORAGE_TYPE
Expand Down
5 changes: 0 additions & 5 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 Down
5 changes: 0 additions & 5 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 Down
2 changes: 1 addition & 1 deletion packages/twenty-e2e-testing/.env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Note that provide always without trailing forward slash to have expected behaviour
FRONTEND_BASE_URL=http://localhost:3001
FRONTEND_BASE_URL=http://app.localhost:3001
CI_DEFAULT_BASE_URL=https://demo.twenty.com
DEFAULT_LOGIN=[email protected]
NEW_WORKSPACE_LOGIN=[email protected]
Expand Down
2 changes: 1 addition & 1 deletion packages/twenty-e2e-testing/lib/pom/loginPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class LoginPage {
private readonly forgotPasswordButton: Locator;
private readonly passwordField: Locator;
private readonly revealPasswordButton: Locator;
private readonly signInButton: Locator;
readonly signInButton: Locator;
private readonly signUpButton: Locator;
private readonly previewImageButton: Locator;
private readonly uploadImageButton: Locator;
Expand Down
8 changes: 6 additions & 2 deletions packages/twenty-e2e-testing/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export default defineConfig({
fullyParallel: true, // false only for specific tests, overwritten in specific projects or global setups of projects
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined, // undefined = amount of projects * amount of tests
workers: 1, // 1 worker = 1 test at the time, tests can't be parallelized
timeout: 30 * 1000, // timeout can be changed
use: {
baseURL: process.env.CI
? process.env.CI_DEFAULT_BASE_URL
: (process.env.FRONTEND_BASE_URL ?? 'http://localhost:3001'),
: (process.env.FRONTEND_BASE_URL ?? 'http://app.localhost:3001'),
trace: 'retain-on-failure', // trace takes EVERYTHING from page source, records every single step, should be used only when normal debugging won't work
screenshot: 'on', // either 'on' here or in different method in modules, if 'on' all screenshots are overwritten each time the test is run
headless: true, // instead of changing it to false, run 'yarn test:e2e:debug' or 'yarn test:e2e:ui'
Expand Down Expand Up @@ -56,6 +56,10 @@ export default defineConfig({
},
dependencies: ['Login setup'],
},
{
name: 'Authentication',
testMatch: /authentication\/.*\.spec\.ts/,
},

//{
// name: 'webkit',
Expand Down
17 changes: 17 additions & 0 deletions packages/twenty-e2e-testing/tests/authentication/login.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { test as base, expect } from '../../lib/fixtures/screenshot';
import { LoginPage } from '../../lib/pom/loginPage';

// fixture
const test = base.extend<{ loginPage: LoginPage }>({
loginPage: async ({ page }, use) => {
await use(new LoginPage(page));
},
});

test('Check login with email', async ({ loginPage }) => {
await loginPage.typeEmail(process.env.DEFAULT_LOGIN);
await loginPage.clickContinueButton();
await loginPage.typePassword(process.env.DEFAULT_PASSWORD);
await loginPage.clickSignInButton();
await expect(loginPage.signInButton).not.toBeVisible();
});
2 changes: 1 addition & 1 deletion packages/twenty-emails/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "twenty-emails",
"version": "0.34.0-canary",
"version": "0.40.0-canary",
"description": "",
"author": "",
"private": true,
Expand Down
3 changes: 2 additions & 1 deletion packages/twenty-front/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "twenty-front",
"version": "0.34.0-canary",
"version": "0.40.0-canary",
"private": true,
"type": "module",
"scripts": {
Expand Down Expand Up @@ -40,6 +40,7 @@
"@tiptap/extension-text-style": "^2.8.0",
"@tiptap/react": "^2.8.0",
"@xyflow/react": "^12.0.4",
"buffer": "^6.0.3",
"transliteration": "^2.3.5"
}
}
2 changes: 1 addition & 1 deletion packages/twenty-front/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"test": {},
"storybook:build": {
"options": {
"env": { "NODE_OPTIONS": "--max_old_space_size=7000" }
"env": { "NODE_OPTIONS": "--max_old_space_size=8000" }
},
"configurations": {
"docs": { "env": { "STORYBOOK_SCOPE": "ui-docs" } },
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a4838a2

Please sign in to comment.