Commit Graph

124 Commits

Author SHA1 Message Date
Charles Bochet
6683ffb890
Clarify storybook tests (#6073)
In this PR, I'm simplifying storybook setup:
1) Remove build --test configuration that prevent autodocs. We are not
using autodocs at all (the dev experience is not good enough), so I have
completely disabled it.
2) Clarify `serve` vs `test` vs `serve-and-test` configurations


After this PR:
- you can serve storybook in two modes: `npx nx run
twenty-front:storybook:serve:dev` and `npx nx run
twenty-front:storybook:serve:static`
- you can run tests agains an already served storybook (this is useful
in dev so you don't have to rebuild everytime to run tests): `npx nx run
twenty-front:storybook:test`
- you can conbine both: `npx nx run
twenty-front:storybook:serve-and-test:static`
2024-06-30 20:02:13 +02:00
Quentin G
2fdd2f4949
Fix/release workflow (#5802)
Here is a fix for https://github.com/twentyhq/twenty/issues/5163

I tested it on another repo and should work as intended this time
arround.

I've created two workflows
- One that creates a PR
- The second that watch PR merge with specific labels
- I also check the author of the PR to make sure it was created by a bot

You can now disable the creation of the a draft release

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2024-06-12 21:11:58 +02:00
Charles Bochet
a57e251208
Fix docs build in CI (#5826) 2024-06-11 19:06:37 +02:00
Ady Beraud
ff1bca1816
Docs modifications (#5804)
- Fixes #5504
- Fixes #5503
- Return 404 when the page does not exist
- Modified the footer in order to align it properly
- Removed "noticed something to change" in each table of content
- Fixed the URLs of the edit module 
- Added the edit module to Developers
- Fixed header style on the REST API page.
- Edited the README to point to Developers
- Fixed selected state when clicking on sidebar elements

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
2024-06-11 09:45:17 +02:00
Ady Beraud
5ad59b5845
Create congratulations bot (#5404)
- Created congratulations bot :
<img width="939" alt="Screenshot 2024-05-14 at 12 47 13"
src="https://github.com/twentyhq/twenty/assets/102751374/5138515f-fe4d-4c6d-9c7a-0240accbfca9">

- Modified OG image

- Added png extension to OG image route

To be noted: The bot will not work until the new API route is not
deployed. Please check OG image with Cloudflare cache.

---------

Co-authored-by: Ady Beraud <a.beraud96@gmail.com>
2024-05-21 22:56:25 +02:00
Thaïs
992602b307
fix: fix storybook build cache not being used by tests in CI (#5451)
TL;DR:
- removed `--configuration={args.scope}` from `storybook:static:test`
for the `storybook:static` part, as it was making `front-sb-test` jobs
in CI not reuse the cache from the `front-sb-build` job and re-build
storybook every time.
- replaced it with a new `test` configuration which optimizes storybook
build for tests and builds storybook 2x faster.

## Fix storybook:build cache usage in CI

`storybook:static:test` executes two scripts in parallel:
1. `storybook:static`, which depends on `storybook:build`
1.a. it builds storybook first with `storybook:build`, the output
directory is `storybook-static`.
1.b. then it launches an `http-server`, using what has been built in
`storybook-static`
2. `storybook:test` to execute tests (needs the storybook http-server to
be running)

When passing `--configuration=pages` or `--configuration=modules` to
`storybook:static` from step 1, those configurations are passed to the
`storybook:build` script from step 1.a as well.

But for Nx `storybook:build` and `storybook:build --configuration=pages`
(or `modules`) are not the same command, therefore one does not reuse
the cache of the other because they could output completely different
things.

As `front-sb-test` jobs are passing `--configuration={args.scope}` to
`storybook:static`, the cache of the previously executed
`storybook:build` (from `front-sb-build`) is not reused and therefore
each job re-builds Storybook with its own scope, which increases CI
time.

### Solution

- Removed scope configurations from `storybook:static` and
`storybook:build` scripts to avoid confusion.
- `storybook:test` and `storybook:dev` can keep scope configurations as
they can be useful and this doesn't impact storybook build cache in CI.

### Improve Storybook build time for testing

Added the `test` configuration to `storybook:build` and
`storybook:static` which makes Storybook build time 2x faster. It
disables addons that slow down build time and are not used in tests.
2024-05-17 16:05:31 +02:00
Charles Bochet
040ec9165d
Try fix tests (#5431)
As per title!
2024-05-15 22:54:51 +02:00
Lucas Bordeau
cfacdfce60
Generic Profiling story to wrap any component (#5341)
This PR introduces a Profiling feature for our story book tests.

It also implements a new CI job : front-sb-test-performance, that only
runs stories suffixed with `.perf.stories.tsx`

## How it works 

It allows to wrap any component into an array of React Profiler
components that will run tests many times to have the most replicable
average render time possible.

It is simply used by calling the new `getProfilingStory` util.

Internally it creates a defined number of tests, separated by an
arbitrary waiting time to allow the CPU to give more stable results.

It will do 3 warm-up and 3 finishing runs of tests because the first and
last renders are always a bit erratic, so we want to measure only the
runs in-between.

On the UI side it gives a table of results : 

<img width="515" alt="image"
src="https://github.com/twentyhq/twenty/assets/26528466/273d2d91-26da-437a-890e-778cb6c1f993">

On the programmatic side, it stores the result in a div that can then be
parsed by the play fonction of storybook, to expect a defined threshold.

```tsx
play: async ({ canvasElement }) => {
    await findByTestId(
      canvasElement,
      'profiling-session-finished',
      {},
      { timeout: 60000 },
    );

    const profilingReport = getProfilingReportFromDocument(canvasElement);

    if (!isDefined(profilingReport)) {
      return;
    }

    const p95result = profilingReport?.total.p95;

    expect(
      p95result,
      `Component render time is more than p95 threshold (${p95ThresholdInMs}ms)`,
    ).toBeLessThan(p95ThresholdInMs);
  },
```
2024-05-15 13:50:02 +02:00
Thaïs
8c85e7bf61
fix: fix storybook:build cache output path (#5336) 2024-05-08 11:51:09 +02:00
Charles Bochet
eef497cb57
Fix front jest tests (#5331) 2024-05-08 01:49:49 +02:00
Thaïs
b7a2e72c32
fix: fix storybook pages tests coverage (#5319) 2024-05-07 21:05:45 +02:00
Thaïs
16ae34dfd1
fix: fix Chromatic script memory allocation in CI (#5299) 2024-05-06 17:49:53 +02:00
Aditya Pimpalkar
2828492945
chore: add nx/project.json to twenty-chrome-extension (#5217)
Fix for `build` CI on `twenty-chrome-extension`

---------

Co-authored-by: Thaïs Guigon <guigon.thais@gmail.com>
2024-05-06 11:33:48 +02:00
Thaïs
fc87a51acf
fix: fix storybook:build memory allocation error in CI (#5284) 2024-05-03 19:19:21 +02:00
Thaïs
1351a95754
fix: fix storybook coverage task (#5256)
- Fixes storybook coverage command: the coverage directory path was
incorrect, but instead of failing `storybook:test --configuration=ci`,
it was hanging indefinitely.
- Switches back to `concurrently` to launch `storybook:static` and
`storybook:test` in parallel, which allows to use options to explicitly
kill `storybook:static` when `storybook:test` fails.
- Moves `storybook:test --configuration=ci` to its own command
`storybook:static:test`: used in the CI, and can be used locally to run
storybook tests without having to launch `storybook:dev` first.
- Creates command `storybook:coverage` and enables cache for this
command.
- Fixes Jest tests that were failing.
- Improves caching conditions for some tasks (for instance, no need to
invalidate Jest test cache if only Storybook story files were modified).
2024-05-03 14:59:09 +02:00
Thaïs
5128ea3ffb
fix: fix storybook build script not found by Chromatic (#5235) 2024-05-02 16:15:36 +02:00
Charles Bochet
3fc48feefb Re-add chromatic CI to github workflow 2024-04-30 18:26:08 +02:00
Thaïs
c193663a71
chore: use Nx affected tasks in CI (#5110)
Closes #5097

- Uses "nx affected" to detect what projects need to be checked in the
current PR (for now, `ci-front` and `ci-server` workflows only).
- Caches results of certain tasks (`lint`, `typecheck`, `test`,
`storybook:build`) when a PR pipeline runs. The next runs of the same
PR's pipeline will then be able to reuse the PR's task cache to execute
tasks faster.
- Caches Yarn's cache folder to install dependencies faster in CI jobs.
- Rewrites the node modules cache/install steps as a custom, reusable
Github action.
- Distributes `ci-front` jobs with a "matrix" strategy.
- Sets common tasks config at the root `nx.json`. For instance, to
activate the `typecheck` task in a project, add `typecheck: {}` to its
`project.json` and it'll use the default config set in `nx.json` for the
`typecheck` task. Options can be overridden in each individual
`project.json` if needed.
- Adds "scope" tags to some projects: `scope:frontend`, `scope:backend`,
`scope:shared`. An eslint rule ensures that `scope:frontend` only
depends on `scope:frontent` or `scope:shared` projects, same for
`scope:backend`. These tags are used by `nx affected` to filter projects
by scope and generates different task cache keys according to the
requested scope.
- Enables checks for twenty-emails in the `ci-server` workflow.
2024-04-30 16:28:25 +02:00
Ady Beraud
5d2d6bae08
Remove SQLite from twenty-website (#5142)
Removed SQLite from twenty-website

---------

Co-authored-by: Ady Beraud <a.beraud96@gmail.com>
Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
2024-04-24 17:02:02 +02:00
Thaïs
d3170fc1ea
fix: fix root start script (#5032)
Fixes #5022

See https://nx.dev/recipes/running-tasks/root-level-scripts#setup
2024-04-19 18:28:02 +02:00
Quentin G
9c8cb52952
fix: release workflow (#5053)
Couple fixes to the release workflow in order to make it work as
intended
2024-04-19 15:16:48 +02:00
Pacifique LINJANJA
627a6bda29
Update twenty-front commands (#4667)
# This PR

- Moves dev and ci scripts to the `project.json` file in the
twenty-front package
- Adds a project.json file in the root of the project with the main
start command that start both twenty-server and twenty-front
applications concurrently
- Updates the script command of the root project with the start:prod
command (replacing the start command which will be used in dev with the
help of nx)
- Add a start:prod command in the twenty-front app, replacing the start
command (now used for dev purpose)

Issue ref #4645 

@charlesBochet @FelixMalfait please let me know how can I improve it

---------

Co-authored-by: Thaïs Guigon <guigon.thais@gmail.com>
2024-04-17 18:06:02 +02:00
Quentin G
c9ae9e183d
feat(ci): add release drafter (#4970)
Add release drafter to the Release CI.
This should create a draft release automatically !
2024-04-15 20:09:06 +02:00
Thaïs
56b7c84116
chore: add incremental typecheck to twenty-ui (#4947)
Part of #4766
2024-04-15 12:15:29 +02:00
Thaïs
9f83cc1426
refactor: move @/ui/display/icon to twenty-ui (#4820)
Split from https://github.com/twentyhq/twenty/pull/4518

Part of https://github.com/twentyhq/twenty/issues/4766
2024-04-12 15:30:48 +02:00
Quentin G
bf60227d67
feat: add SENTRY_RELEASE env (#4912)
Add support for a new SENTRY_RELEASE and SENTRY_ENVIRONMENT env.
It is optional and allows to init sentry with a Release version and an
env (used internally at Twenty).
Docker image have been updated do intergrate the new env as an Argument
2024-04-11 16:53:15 +02:00
Quentin G
cfcc93dee1
feat: add release workflow (#4904)
This workflow deploys a new release of Twenty.
- It bumps projects version
- Create a tag
- Push the changes

Then a tag pipeline will be automatically run triggering the deployment
of new Dockerhub images

Deployment to Twenty prod will be a manual action
2024-04-10 18:49:05 +02:00
Anoop P
fbd7c34478
Basic github ci workflow for twenty website (#4869)
Creates a basic github workflow for this issue #4832
2024-04-08 12:47:52 +02:00
Quentin G
5d6094dfa3
fix: update build script for twenty-emails (#4823)
Fix an issue with the build of the server in docker failing to find vite
2024-04-04 18:37:35 +02:00
Quentin G
eab65f34f9
feat(ci): use concurrency.group to cancel previous jobs (#4795)
As recommended on the repo of the action we were using
https://github.com/styfle/cancel-workflow-action, we should use
`concurrency.group` rather than a dedicated action.

Here is a PR to use it on all our workflows
2024-04-04 09:30:55 +02:00
Quentin G
ccd02fe58c
feat: init docker compose test (#4730)
Job testing if docker compose is working. It triggers on pull_requests.
2024-04-03 18:08:21 +02:00
Thaïs
a3e5cf37b0
chore: upgrade Nx to v18.1.3 (#4706)
Split from https://github.com/twentyhq/twenty/pull/4518

- Upgrades dependencies and applies automatic config migrations with the
command: `npx nx migrate nx` (see
https://nx.dev/nx-api/nx/documents/migrate)
- Fixes lint errors after upgrading `@typescript-eslint`

Note: it was not possible (for now) to migrate Nx to the latest stable
version (v18.2.1) because it upgrades Typescript to v5.4.3, which seems
to cause a bug on install when Yarn tries to apply its native patches.
Might be a bug on the Yarn side.
2024-04-01 13:16:50 +02:00
Félix Malfait
4e109c9a38
Fix Vale CI and change vision (#4724) 2024-04-01 11:39:04 +02:00
Thomas des Francs
62ed1893c9
Created the user-guide content (Text and illustrations) (#4683)
* Second attempt

* Small image optimizations

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
2024-03-29 10:07:25 +01:00
Quentin G
d4f6ffdf62
feat(ci): automate CI tags and pass github context (#4652)
* feat(ci): automate CI tags and pass github context

* Update .github/workflows/cd-deploy-tag.yaml

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
2024-03-26 09:01:39 +01:00
Charles Bochet
e576fe0d67
Update yarn commands (#4644)
* Simplify commands

* Simplify commands

* Migrate all dev commands to project.json

* Fix tests
2024-03-25 12:31:18 +01:00
Weiko
a560746fcd
Add worker run step to server cli (#4619)
* Add worker run step to server cli

* add build step

* fix
2024-03-25 11:00:11 +01:00
Charles Bochet
86c0f311f5
Introduce ComponentState (#4386)
* Proof of concept ComponentState

* Migrate to createState and createFamilyState

* Refactor

* Fix

* Fix tests

* Fix lint

* Fix tests

* Re-enable coverage
2024-03-09 11:31:00 +01:00
Abdullah
1265dc74d0
Closes #2413 - Building a chrome extension for twenty to store person/company data into a workspace. (#3430)
* build: create a new vite project for chrome extension

* feat: configure theme per the frontend codebase for chrome extension

* feat: inject the add to twenty button into linkedin profile page

* feat: create the api key form ui and render it on the options page

* feat: inject the add to twenty button into linkedin company page

* feat: scrape required data from both the user profile and the company profile

* refactor: move modules into options because it is the only page using react for now

* fix: show add to twenty button without having to reload the single page application

* fix: extract domain of the business website instead of scrapping the industry type

* feat: store api key to local storage and open options page when trying to store data without setting a key

* feat: send data to the backend upon click and store it to the database

* fix: open options page upon clicking the extension icon

* fix: update terminology from user to person to match the codebase convention

* fix: adopt chrome extension to monorepo approach using nx and get the development server working

* fix: update vite config for build command to work per the requirement

* feat: add instructions in the readme file to install the extension for local testing

* fix: move server base url to a dotenv file and replace the hard-coded url

* feat: permit user to configure a custom route for the server from the options page

* fix: fetch api key and route from local storage and display on options page to inform users of their choices

* fix: move front base url to dotenv and replace the hard-coded url

* fix: remove the trailing slash from person and company linkedin username

* fix: improve code commenting to explain implementation somewhat better

* ci: introduce a workflow to build chrome extension to ensure it can be published

* fix: format files to display code in a consistent manner per the prettier configuration in codebase

* fix: improve the commenting significantly to explain important and hard-to-understand parts of the code

* fix: remove unused permissions from the manifest file for publishing to the chrome web store

* Add nx

* Fix vale

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2024-02-12 12:30:23 +01:00
Thomas des Francs
096f2c456c
Updating pull request prioritization policy (#3775)
Introduce specific rules for Pull Requests (PRs) tagged with "size: minutes" and "size: days".
2024-02-02 14:38:00 +01:00
Charles Bochet
aa603f1ff4
Update contributing guidelines with PR precendence (#3590) 2024-01-23 17:29:10 +01:00
Thomas Trompette
c53abf2f5a
Fix chromatic tests + re-enable (#3414)
* Fix chromatic tests + re-enable

* Try to run command manually

* Fix

* Fix

* Fix

* Fix

* Fix

---------

Co-authored-by: Thomas Trompette <thomast@twenty.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
2024-01-12 18:32:00 +01:00
Charles Bochet
176e840728
Fix vale ci (#3353)
* Fix vale ci

* try

* try

* try

* try
2024-01-10 17:05:23 +01:00
martmull
ae5558d8b5
Add mail driver (#3205)
* Add node mailer packages

* Init mailer module

* Add logger transport

* Use env variable to get transport

* Revert "Add node mailer packages"

This reverts commit 3fb954f0ca.

* Add nodemailer

* Use driver pattern

* Use logger

* Fix yarn install

* Code review returns

* Add configuration examples for smtp

* Fix merge conflict

* Add missing packages

* Fix ci
2024-01-05 16:08:19 +01:00
gitstart-twenty
801177531b
Fix and enhance storybook:modules:tests (#3107)
* Fix and enhance storybook:modules:tests

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>

* Fix and enhance storybook:modules:tests

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>

* Fix and enhance storybook:modules:tests

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>

* Remove unnecessary changes

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>

* Fix email thread story

* Re-enable storybook:modules

* Fix

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
2023-12-21 19:45:47 +01:00
gitstart-twenty
984fc76b94
Fix and enhance storybook:pages tests (#3085)
* Fix and enhance storybook:pages tests

Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com>

* Fix and enhance storybook:pages tests

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com>

* fix SettingsObjectFieldPreview

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com>

* Fix lint

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com>

* Fix jest

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com>

* Add more fixes

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com>

* Fix App.stories.tsx

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com>

* Fix tests

* Fix according to review

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
2023-12-20 18:36:58 +01:00
bosiraphael
5afcab4e78
3011 fill the messagerecipient table when fetching messages (#3073)
* wip

* trying to parse display names and emails

* add nodemailer mailparser

* mail parsing is working

* add personId and workspaceMemberId

* add date to messages

* Fix PR

* Run tsc on bigger machine

* Fix lint

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2023-12-19 17:08:54 +01:00
Charles Bochet
800330df90
Disable Danger CI on push trigger (#3024)
Disable Danger CI on main
2023-12-15 16:22:35 +01:00
Charles Bochet
3d29481fbd Disable chromatic CI 2023-12-15 16:09:49 +01:00
Charles Bochet
064e47b59a
Fix CIs (#3004)
* Fix CIs

* Fix docs

* Fix eslint-build

* Move file

* Move back

* Fix server ci

* Fix server ci

* Fix server ci

* Fix server ci

* Deactivate e2e tests

* Fix front

* Fix front

* Fix front

* Add twenty-zapier and twenty-utils to the yarn project

* fix

* fix

* Remove pull_request trigger
2023-12-15 15:40:04 +01:00