The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
ci(cli): run the CLI's lint, typecheck and unit tests (#27519)
Weikod297f584b727
diff --git a/.github/workflows/ci-cli.yaml b/.github/workflows/ci-cli.yamlindex 35ba968f131..c568826f331 100644--- a/.github/workflows/ci-cli.yaml+++ b/.github/workflows/ci-cli.yaml@@ -21,8 +21,12 @@ jobs:packages/twenty-shared/**packages/twenty-sdk/**packages/twenty-client-sdk/**+ packages/twenty-apps/fixtures/**packages/twenty-ui/**+ packages/twenty-oxlint-rules/**.github/actions/yarn-install/**+ .github/actions/restore-cache/**+ .github/actions/save-cache/**.github/workflows/ci-cli.yamlpackage.jsonyarn.lock@@ -46,11 +50,43 @@ jobs:uses: ./.github/actions/yarn-install- name: Build and test the CLI packagerun: npx nx run twenty-cli:test:package+ cli-test:+ needs: changed-files-check+ if: >-+ !cancelled() &&+ (github.event_name == 'merge_group' || needs.changed-files-check.outputs.any_changed == 'true')+ timeout-minutes: 30+ runs-on: ubuntu-latest+ steps:+ - name: Checkout+ uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1+ with:+ fetch-depth: 10+ - name: Install dependencies+ uses: ./.github/actions/yarn-install+ - name: Restore CLI test cache+ id: restore-cli-test-cache+ uses: ./.github/actions/restore-cache+ with:+ key: cli-test+ - name: Build the CLI and the SDK used by parity tests+ run: npx nx run-many --target=build --projects=twenty-sdk,twenty-cli+ - name: Lint+ run: npx nx lint twenty-cli+ - name: Typecheck+ run: npx tsgo -p packages/twenty-cli/tsconfig.json --noEmit+ - name: Unit tests+ run: npx vitest run --maxWorkers=2+ working-directory: packages/twenty-cli+ - name: Save CLI test cache+ uses: ./.github/actions/save-cache+ with:+ key: ${{ steps.restore-cli-test-cache.outputs.cache-primary-key }}ci-cli-status-check:if: always() && !cancelled()timeout-minutes: 5runs-on: ubuntu-latest- needs: [changed-files-check, cli-package-test]+ needs: [changed-files-check, cli-package-test, cli-test]steps:- name: Fail job if any needs failedif: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')diff --git a/packages/twenty-cli/src/app/manifest/__tests__/manifest-parity.spec.ts b/packages/twenty-cli/src/app/manifest/__tests__/manifest-parity.spec.tsindex 0fbb7fd3d91..c573c23ffff 100644--- a/packages/twenty-cli/src/app/manifest/__tests__/manifest-parity.spec.ts+++ b/packages/twenty-cli/src/app/manifest/__tests__/manifest-parity.spec.ts@@ -284,6 +284,7 @@ export { compileApplicationTranslations } from './cli/utilities/translations/comsignal: new AbortController().signal,});await symlink(join(root, 'node_modules'), join(appPath, 'node_modules'));+ await rm(join(appPath, 'yarn.lock'));const result = await compareManifest(appPath);const packageJson = JSON.parse(await readFile(join(appPath, 'package.json'), 'utf8'),diff --git a/packages/twenty-cli/src/app/pull/__tests__/pull-application.spec.ts b/packages/twenty-cli/src/app/pull/__tests__/pull-application.spec.tsindex bd96c9640e6..033cc079d13 100644--- a/packages/twenty-cli/src/app/pull/__tests__/pull-application.spec.ts+++ b/packages/twenty-cli/src/app/pull/__tests__/pull-application.spec.ts@@ -126,7 +126,7 @@ const requireSuccess = <TData>(result: BuildResult<TData>): TData => {return result.data;};-describe('programmatic application pull', () => {+describe('programmatic application pull', { timeout: 30_000 }, () => {let appPath: string;const read = (relativePath: string) =>readFile(join(appPath, relativePath), 'utf8');diff --git a/packages/twenty-cli/src/app/snapshots/__tests__/snapshot-parity.spec.ts b/packages/twenty-cli/src/app/snapshots/__tests__/snapshot-parity.spec.tsindex 5176302fadf..d6a430fc3a3 100644--- a/packages/twenty-cli/src/app/snapshots/__tests__/snapshot-parity.spec.ts+++ b/packages/twenty-cli/src/app/snapshots/__tests__/snapshot-parity.spec.ts@@ -377,7 +377,33 @@ describe('CLI snapshots preserve SDK manifests and non-frontend artifacts', () =platform: 'node',format: 'cjs',target: 'node24',- plugins: [SORTED_GLOB_PLUGIN],+ plugins: [+ SORTED_GLOB_PLUGIN,+ {+ name: 'sdk-bundled-source',+ setup(build) {+ build.onLoad(+ { filter: /\.ts$/, namespace: 'file' },+ async ({ path, suffix }) => {+ if (suffix !== '?source') return undefined;++ const { outputFiles } = await bundle({+ entryPoints: [path],+ absWorkingDir: dirname(path),+ bundle: true,+ format: 'esm',+ platform: 'neutral',+ legalComments: 'none',+ external: ['__*__'],+ write: false,+ });++ return { contents: outputFiles[0].text, loader: 'text' };+ },+ );+ },+ },+ ],});await mkdir(join(root, 'assets'));@@ -424,6 +450,7 @@ describe('CLI snapshots preserve SDK manifests and non-frontend artifacts', () =signal: new AbortController().signal,});await symlink(join(root, 'node_modules'), join(appPath, 'node_modules'));+ await rm(join(appPath, 'yarn.lock'));const configPath = join(appPath, 'tsconfig.json');const config = JSON.parse(await readFile(configPath, 'utf8'));config.exclude.push('vitest*.config.ts');