From adc650ea15953b4eaf5ba991c172090b00cd9fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Tue, 11 Jun 2024 00:38:07 +0200 Subject: [PATCH] ci: Use turbo for build cache (no-changelog) --- .github/workflows/ci-master.yml | 3 + .github/workflows/ci-postgres-mysql.yml | 14 ++++- .github/workflows/ci-pull-requests.yml | 3 + .github/workflows/linting-reusable.yml | 3 + .github/workflows/units-tests-reusable.yml | 3 + package.json | 21 +++---- packages/@n8n/chat/package.json | 2 +- pnpm-lock.yaml | 66 +++++++++++----------- turbo.json | 63 ++++++++++++++++++++- 9 files changed, 130 insertions(+), 48 deletions(-) diff --git a/.github/workflows/ci-master.yml b/.github/workflows/ci-master.yml index 6d517cc1d5c731..45444fda8439b9 100644 --- a/.github/workflows/ci-master.yml +++ b/.github/workflows/ci-master.yml @@ -23,6 +23,9 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile + - name: Setup build cache + uses: rharkor/caching-for-turbo@v1.5 + - name: Build run: pnpm build diff --git a/.github/workflows/ci-postgres-mysql.yml b/.github/workflows/ci-postgres-mysql.yml index 16d446cc920e6a..d5abf1fa2652fb 100644 --- a/.github/workflows/ci-postgres-mysql.yml +++ b/.github/workflows/ci-postgres-mysql.yml @@ -26,6 +26,9 @@ jobs: cache: 'pnpm' - run: pnpm install --frozen-lockfile + - name: Setup build cache + uses: rharkor/caching-for-turbo@v1.5 + - name: Build Backend run: pnpm build:backend @@ -52,6 +55,9 @@ jobs: cache: 'pnpm' - run: pnpm install --frozen-lockfile + - name: Setup build cache + uses: rharkor/caching-for-turbo@v1.5 + - name: Restore cached build artifacts uses: actions/cache/restore@v4.0.0 with: @@ -60,7 +66,7 @@ jobs: - name: Test SQLite Pooled working-directory: packages/cli - run: pnpm jest --coverage + run: pnpm jest mysql: name: MySQL @@ -78,6 +84,9 @@ jobs: cache: 'pnpm' - run: pnpm install --frozen-lockfile + - name: Setup build cache + uses: rharkor/caching-for-turbo@v1.5 + - name: Restore cached build artifacts uses: actions/cache/restore@v4.0.0 with: @@ -112,6 +121,9 @@ jobs: cache: 'pnpm' - run: pnpm install --frozen-lockfile + - name: Setup build cache + uses: rharkor/caching-for-turbo@v1.5 + - name: Restore cached build artifacts uses: actions/cache/restore@v4.0.0 with: diff --git a/.github/workflows/ci-pull-requests.yml b/.github/workflows/ci-pull-requests.yml index 1bdd6c60b96ee0..78a5388950d519 100644 --- a/.github/workflows/ci-pull-requests.yml +++ b/.github/workflows/ci-pull-requests.yml @@ -21,6 +21,9 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile + - name: Setup build cache + uses: rharkor/caching-for-turbo@v1.5 + - name: Build run: pnpm build diff --git a/.github/workflows/linting-reusable.yml b/.github/workflows/linting-reusable.yml index 69bccd9ce62167..2650622bd04e46 100644 --- a/.github/workflows/linting-reusable.yml +++ b/.github/workflows/linting-reusable.yml @@ -33,6 +33,9 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile + - name: Setup build cache + uses: rharkor/caching-for-turbo@v1.5 + - name: Build if: ${{ inputs.cacheKey == '' }} run: pnpm build diff --git a/.github/workflows/units-tests-reusable.yml b/.github/workflows/units-tests-reusable.yml index 2c82e9834db3a5..fe270b1de004c2 100644 --- a/.github/workflows/units-tests-reusable.yml +++ b/.github/workflows/units-tests-reusable.yml @@ -49,6 +49,9 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile + - name: Setup build cache + uses: rharkor/caching-for-turbo@v1.5 + - name: Build if: ${{ inputs.cacheKey == '' }} run: pnpm build diff --git a/package.json b/package.json index ae4062e47840c9..51c30560f76a11 100644 --- a/package.json +++ b/package.json @@ -11,27 +11,28 @@ "scripts": { "preinstall": "node scripts/block-npm-install.js", "build": "turbo run build", - "build:backend": "pnpm --filter=!@n8n/chat --filter=!@n8n/codemirror-lang --filter=!n8n-design-system --filter=!n8n-editor-ui build", - "build:frontend": "pnpm --filter=@n8n/chat --filter=@n8n/codemirror-lang --filter=n8n-design-system --filter=n8n-editor-ui build", - "typecheck": "pnpm --filter=!n8n typecheck", + "build:backend": "turbo run build:backend", + "build:frontend": "turbo run build:frontend", + "build:nodes": "turbo run build:nodes", + "typecheck": "turbo --filter=!n8n typecheck", "dev": "turbo run dev --parallel --filter=!n8n-design-system --filter=!@n8n/chat", "dev:ai": "turbo run dev --parallel --filter=@n8n/nodes-langchain --filter=n8n --filter=n8n-core", "clean": "turbo run clean --parallel", "format": "turbo run format && node scripts/format.mjs", "lint": "turbo run lint", "lintfix": "turbo run lintfix", - "lint:backend": "pnpm --filter=!@n8n/chat --filter=!@n8n/codemirror-lang --filter=!n8n-design-system --filter=!n8n-editor-ui --filter=!n8n-nodes-base --filter=!@n8n/n8n-nodes-langchain lint", - "lint:nodes": "pnpm --filter=n8n-nodes-base --filter=@n8n/n8n-nodes-langchain lint", - "lint:frontend": "pnpm --filter=@n8n/chat --filter=@n8n/codemirror-lang --filter=n8n-design-system --filter=n8n-editor-ui lint", + "lint:backend": "turbo run lint:backend", + "lint:nodes": "turbo run lint:nodes", + "lint:frontend": "turbo run lint:frontend", "optimize-svg": "find ./packages -name '*.svg' ! -name 'pipedrive.svg' -print0 | xargs -0 -P16 -L20 npx svgo", "start": "run-script-os", "start:default": "cd packages/cli/bin && ./n8n", "start:tunnel": "./packages/cli/bin/n8n start --tunnel", "start:windows": "cd packages/cli/bin && n8n", "test": "turbo run test", - "test:backend": "pnpm --filter=!@n8n/chat --filter=!@n8n/codemirror-lang --filter=!n8n-design-system --filter=!n8n-editor-ui --filter=!n8n-nodes-base --filter=!@n8n/n8n-nodes-langchain test", - "test:nodes": "pnpm --filter=n8n-nodes-base --filter=@n8n/n8n-nodes-langchain test", - "test:frontend": "pnpm --filter=@n8n/chat --filter=@n8n/codemirror-lang --filter=n8n-design-system --filter=n8n-editor-ui test", + "test:backend": "turbo run test:backend --concurrency=1", + "test:frontend": "turbo run test:frontend --concurrency=1", + "test:nodes": "turbo run test:nodes --concurrency=1", "watch": "turbo run watch --parallel", "webhook": "./packages/cli/bin/n8n webhook", "worker": "./packages/cli/bin/n8n worker" @@ -55,7 +56,7 @@ "ts-jest": "^29.1.1", "tsc-alias": "^1.8.7", "tsc-watch": "^6.0.4", - "turbo": "1.13.3", + "turbo": "2.0.6", "typescript": "*", "vite": "^5.2.12", "vitest": "^1.6.0", diff --git a/packages/@n8n/chat/package.json b/packages/@n8n/chat/package.json index 6654fc213f8f09..6281dfc4f7c246 100644 --- a/packages/@n8n/chat/package.json +++ b/packages/@n8n/chat/package.json @@ -12,7 +12,7 @@ "build:pack": "node scripts/pack.js", "preview": "vite preview", "test:dev": "vitest", - "test": "vitest run --coverage", + "test": "vitest run", "typecheck": "vue-tsc --noEmit", "lint": "eslint . --ext .js,.ts,.vue --quiet", "lintfix": "eslint . --ext .js,.ts,.vue --fix", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c95da810def993..8e751d16d676ab 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -100,8 +100,8 @@ importers: specifier: ^6.0.4 version: 6.0.4(typescript@5.5.2) turbo: - specifier: 1.13.3 - version: 1.13.3 + specifier: 2.0.6 + version: 2.0.6 typescript: specifier: ^5.5.2 version: 5.5.2 @@ -13436,38 +13436,38 @@ packages: resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==} engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'} - turbo-darwin-64@1.13.3: - resolution: {integrity: sha512-glup8Qx1qEFB5jerAnXbS8WrL92OKyMmg5Hnd4PleLljAeYmx+cmmnsmLT7tpaVZIN58EAAwu8wHC6kIIqhbWA==} + turbo-darwin-64@2.0.6: + resolution: {integrity: sha512-XpgBwWj3Ggmz/gQVqXdMKXHC1iFPMDiuwugLwSzE7Ih0O13JuNtYZKhQnopvbDQnFQCeRq2Vsm5OTWabg/oB/g==} cpu: [x64] os: [darwin] - turbo-darwin-arm64@1.13.3: - resolution: {integrity: sha512-/np2xD+f/+9qY8BVtuOQXRq5f9LehCFxamiQnwdqWm5iZmdjygC5T3uVSYuagVFsZKMvX3ycySwh8dylGTl6lg==} + turbo-darwin-arm64@2.0.6: + resolution: {integrity: sha512-RfeZYXIAkiA21E8lsvfptGTqz/256YD+eI1x37fedfvnHFWuIMFZGAOwJxtZc6QasQunDZ9TRRREbJNI68tkIw==} cpu: [arm64] os: [darwin] - turbo-linux-64@1.13.3: - resolution: {integrity: sha512-G+HGrau54iAnbXLfl+N/PynqpDwi/uDzb6iM9hXEDG+yJnSJxaHMShhOkXYJPk9offm9prH33Khx2scXrYVW1g==} + turbo-linux-64@2.0.6: + resolution: {integrity: sha512-92UDa0xNQQbx0HdSp9ag3YSS3xPdavhc7q9q9mxIAcqyjjD6VElA4Y85m4F/DDGE5SolCrvBz2sQhVmkOd6Caw==} cpu: [x64] os: [linux] - turbo-linux-arm64@1.13.3: - resolution: {integrity: sha512-qWwEl5VR02NqRyl68/3pwp3c/olZuSp+vwlwrunuoNTm6JXGLG5pTeme4zoHNnk0qn4cCX7DFrOboArlYxv0wQ==} + turbo-linux-arm64@2.0.6: + resolution: {integrity: sha512-eQKu6utCVUkIH2kqOzD8OS6E0ba6COjWm6PRDTNCHQRljZW503ycaTUIdMOiJrVg1MkEjDyOReUg8s8D18aJ4Q==} cpu: [arm64] os: [linux] - turbo-windows-64@1.13.3: - resolution: {integrity: sha512-Nudr4bRChfJzBPzEmpVV85VwUYRCGKecwkBFpbp2a4NtrJ3+UP1VZES653ckqCu2FRyRuS0n03v9euMbAvzH+Q==} + turbo-windows-64@2.0.6: + resolution: {integrity: sha512-+9u4EPrpoeHYCQ46dRcou9kbkSoelhOelHNcbs2d86D6ruYD/oIAHK9qgYK8LeARRz0jxhZIA/dWYdYsxJJWkw==} cpu: [x64] os: [win32] - turbo-windows-arm64@1.13.3: - resolution: {integrity: sha512-ouJCgsVLd3icjRLmRvHQDDZnmGzT64GBupM1Y+TjtYn2LVaEBoV6hicFy8x5DUpnqdLy+YpCzRMkWlwhmkX7sQ==} + turbo-windows-arm64@2.0.6: + resolution: {integrity: sha512-rdrKL+p+EjtdDVg0wQ/7yTbzkIYrnb0Pw4IKcjsy3M0RqUM9UcEi67b94XOAyTa5a0GqJL1+tUj2ebsFGPgZbg==} cpu: [arm64] os: [win32] - turbo@1.13.3: - resolution: {integrity: sha512-n17HJv4F4CpsYTvKzUJhLbyewbXjq1oLCi90i5tW1TiWDz16ML1eDG7wi5dHaKxzh5efIM56SITnuVbMq5dk4g==} + turbo@2.0.6: + resolution: {integrity: sha512-/Ftmxd5Mq//a9yMonvmwENNUN65jOVTwhhBPQjEtNZutYT9YKyzydFGLyVM1nzhpLWahQSMamRc/RDBv5EapzA==} hasBin: true tween-functions@1.2.0: @@ -13913,8 +13913,8 @@ packages: vue-component-type-helpers@2.0.19: resolution: {integrity: sha512-cN3f1aTxxKo4lzNeQAkVopswuImUrb5Iurll9Gaw5cqpnbTAxtEMM1mgi6ou4X79OCyqYv1U1mzBHJkzmiK82w==} - vue-component-type-helpers@2.0.22: - resolution: {integrity: sha512-gPr2Ba7efUwy/Vfbuf735bHSVdN4ycoZUCHfypkI33M9DUH+ieRblLLVM2eImccFYaWNWwEzURx02EgoXDBmaQ==} + vue-component-type-helpers@2.0.24: + resolution: {integrity: sha512-Jr5N8QVYEcbQuMN1LRgvg61758G8HTnzUlQsAFOxx6Y6X8kmhJ7C+jOvWsQruYxi3uHhhS6BghyRlyiwO99DBg==} vue-demi@0.14.5: resolution: {integrity: sha512-o9NUVpl/YlsGJ7t+xuqJKx8EBGf1quRhCiT6D/J0pfwmk9zUwYkC7yrF4SZCe6fETvSM3UNL2edcbYrSyc4QHA==} @@ -19809,7 +19809,7 @@ snapshots: ts-dedent: 2.2.0 type-fest: 2.19.0 vue: 3.4.21(typescript@5.5.2) - vue-component-type-helpers: 2.0.22 + vue-component-type-helpers: 2.0.24 transitivePeerDependencies: - encoding - prettier @@ -29020,32 +29020,32 @@ snapshots: tunnel@0.0.6: {} - turbo-darwin-64@1.13.3: + turbo-darwin-64@2.0.6: optional: true - turbo-darwin-arm64@1.13.3: + turbo-darwin-arm64@2.0.6: optional: true - turbo-linux-64@1.13.3: + turbo-linux-64@2.0.6: optional: true - turbo-linux-arm64@1.13.3: + turbo-linux-arm64@2.0.6: optional: true - turbo-windows-64@1.13.3: + turbo-windows-64@2.0.6: optional: true - turbo-windows-arm64@1.13.3: + turbo-windows-arm64@2.0.6: optional: true - turbo@1.13.3: + turbo@2.0.6: optionalDependencies: - turbo-darwin-64: 1.13.3 - turbo-darwin-arm64: 1.13.3 - turbo-linux-64: 1.13.3 - turbo-linux-arm64: 1.13.3 - turbo-windows-64: 1.13.3 - turbo-windows-arm64: 1.13.3 + turbo-darwin-64: 2.0.6 + turbo-darwin-arm64: 2.0.6 + turbo-linux-64: 2.0.6 + turbo-linux-arm64: 2.0.6 + turbo-windows-64: 2.0.6 + turbo-windows-arm64: 2.0.6 tween-functions@1.2.0: {} @@ -29514,7 +29514,7 @@ snapshots: vue-component-type-helpers@2.0.19: {} - vue-component-type-helpers@2.0.22: {} + vue-component-type-helpers@2.0.24: {} vue-demi@0.14.5(vue@3.4.21(typescript@5.5.2)): dependencies: diff --git a/turbo.json b/turbo.json index f0b0521623c1a3..ec9ee58c68eb3a 100644 --- a/turbo.json +++ b/turbo.json @@ -1,17 +1,74 @@ { - "$schema": "https://turborepo.org/schema.json", - "pipeline": { + "$schema": "https://turbo.build/schema.json", + "ui": "stream", + "tasks": { "clean": { "cache": false }, + "build:backend": { + "dependsOn": ["n8n#build"] + }, + "build:frontend": { + "dependsOn": ["n8n-editor-ui#build"] + }, + "build:nodes": { + "dependsOn": ["n8n-nodes-base#build", "@n8n/n8n-nodes-langchain#build"] + }, "build": { "dependsOn": ["^build"], "outputs": ["dist/**"] }, - "typecheck": {}, + "typecheck": { + "dependsOn": ["^typecheck"] + }, "format": {}, + "lint:backend": { + "dependsOn": [ + "@n8n/client-oauth2#lint", + "@n8n/imap#lint", + "@n8n/permissions#lint", + "n8n-workflow#lint", + "n8n-core#lint", + "n8n-node-dev#lint", + "n8n#lint" + ] + }, + "lint:frontend": { + "dependsOn": [ + "@n8n/chat#lint", + "@n8n/codemirror-lang#lint", + "@n8n/storybook#lint", + "n8n-cypress#lint", + "n8n-design-system#lint", + "n8n-editor-ui#lint" + ] + }, + "lint:nodes": { + "dependsOn": ["n8n-nodes-base#lint", "@n8n/n8n-nodes-langchain#lint"] + }, "lint": {}, "lintfix": {}, + "test:backend": { + "dependsOn": [ + "@n8n/client-oauth2#test", + "@n8n/imap#test", + "@n8n/permissions#test", + "n8n-workflow#test", + "n8n-core#test", + "n8n#test" + ] + }, + "test:frontend": { + "dependsOn": [ + "@n8n/chat#test", + "@n8n/codemirror-lang#test", + "n8n-design-system#test", + "n8n-editor-ui#test" + ] + }, + "test:nodes": { + "dependsOn": ["n8n-nodes-base#test", "@n8n/n8n-nodes-langchain#test"] + }, "test": {}, "watch": { "cache": false,