mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
ci: Improve CI performance (no-changelog) (#7637)
1. Split backend and frontend tests to avoid them running in parallel 2. Enable coverage only on `master`
This commit is contained in:
parent
f748de9567
commit
2f665683fc
1
.github/workflows/ci-master.yml
vendored
1
.github/workflows/ci-master.yml
vendored
|
@ -49,6 +49,7 @@ jobs:
|
||||||
ref: ${{ inputs.branch }}
|
ref: ${{ inputs.branch }}
|
||||||
nodeVersion: ${{ matrix.node-version }}
|
nodeVersion: ${{ matrix.node-version }}
|
||||||
cacheKey: ${{ github.sha }}-base:${{ matrix.node-version }}-test-lint
|
cacheKey: ${{ github.sha }}-base:${{ matrix.node-version }}-test-lint
|
||||||
|
collectCoverage: true
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
name: Lint changes
|
name: Lint changes
|
||||||
|
|
14
.github/workflows/units-tests-reusable.yml
vendored
14
.github/workflows/units-tests-reusable.yml
vendored
|
@ -18,11 +18,17 @@ on:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
type: string
|
type: string
|
||||||
|
collectCoverage:
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
|
type: string
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
unit-test:
|
unit-test:
|
||||||
name: Unit tests
|
name: Unit tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
COVERAGE_ENABLED: ${{ inputs.collectCoverage }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3.5.3
|
- uses: actions/checkout@v3.5.3
|
||||||
with:
|
with:
|
||||||
|
@ -51,10 +57,14 @@ jobs:
|
||||||
path: ./packages/**/dist
|
path: ./packages/**/dist
|
||||||
key: ${{ inputs.cacheKey }}
|
key: ${{ inputs.cacheKey }}
|
||||||
|
|
||||||
- name: Test
|
- name: Test Backend
|
||||||
run: pnpm test
|
run: pnpm test:backend
|
||||||
|
|
||||||
|
- name: Test Frontend
|
||||||
|
run: pnpm test:frontend
|
||||||
|
|
||||||
- name: Upload coverage to Codecov
|
- name: Upload coverage to Codecov
|
||||||
|
if: ${{ inputs.collectCoverage == 'true' }}
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v3
|
||||||
with:
|
with:
|
||||||
files: packages/@n8n/client-oauth2/coverage/cobertura-coverage.xml,packages/cli/coverage/cobertura-coverage.xml,packages/core/coverage/cobertura-coverage.xml,packages/design-system/coverage/cobertura-coverage.xml,packages/editor-ui/coverage/cobertura-coverage.xml,packages/nodes-base/coverage/cobertura-coverage.xml,packages/workflow/coverage/cobertura-coverage.xml
|
files: packages/@n8n/client-oauth2/coverage/cobertura-coverage.xml,packages/cli/coverage/cobertura-coverage.xml,packages/core/coverage/cobertura-coverage.xml,packages/design-system/coverage/cobertura-coverage.xml,packages/editor-ui/coverage/cobertura-coverage.xml,packages/nodes-base/coverage/cobertura-coverage.xml,packages/workflow/coverage/cobertura-coverage.xml
|
||||||
|
|
|
@ -30,7 +30,7 @@ const config = {
|
||||||
return acc;
|
return acc;
|
||||||
}, {}),
|
}, {}),
|
||||||
setupFilesAfterEnv: ['jest-expect-message'],
|
setupFilesAfterEnv: ['jest-expect-message'],
|
||||||
collectCoverage: true,
|
collectCoverage: process.env.COVERAGE_ENABLED === 'true',
|
||||||
coverageReporters: [process.env.COVERAGE_REPORT === 'true' ? 'text' : 'text-summary'],
|
coverageReporters: [process.env.COVERAGE_REPORT === 'true' ? 'text' : 'text-summary'],
|
||||||
collectCoverageFrom: ['src/**/*.ts'],
|
collectCoverageFrom: ['src/**/*.ts'],
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"preinstall": "node scripts/block-npm-install.js",
|
"preinstall": "node scripts/block-npm-install.js",
|
||||||
"build": "turbo run build",
|
"build": "turbo run build",
|
||||||
|
"build:backend": "pnpm --filter=!n8n-design-system --filter=!n8n-editor-ui build",
|
||||||
|
"build:frontend": "pnpm --filter=n8n-design-system --filter=n8n-editor-ui build",
|
||||||
"typecheck": "turbo run typecheck",
|
"typecheck": "turbo run typecheck",
|
||||||
"dev": "turbo run dev --parallel",
|
"dev": "turbo run dev --parallel",
|
||||||
"clean": "turbo run clean --parallel",
|
"clean": "turbo run clean --parallel",
|
||||||
|
@ -23,6 +25,8 @@
|
||||||
"start:tunnel": "./packages/cli/bin/n8n start --tunnel",
|
"start:tunnel": "./packages/cli/bin/n8n start --tunnel",
|
||||||
"start:windows": "cd packages/cli/bin && n8n",
|
"start:windows": "cd packages/cli/bin && n8n",
|
||||||
"test": "turbo run test",
|
"test": "turbo run test",
|
||||||
|
"test:backend": "pnpm --filter=!n8n-design-system --filter=!n8n-editor-ui test",
|
||||||
|
"test:frontend": "pnpm --filter=n8n-design-system --filter=n8n-editor-ui test",
|
||||||
"watch": "turbo run watch",
|
"watch": "turbo run watch",
|
||||||
"webhook": "./packages/cli/bin/n8n webhook",
|
"webhook": "./packages/cli/bin/n8n webhook",
|
||||||
"worker": "./packages/cli/bin/n8n worker",
|
"worker": "./packages/cli/bin/n8n worker",
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
"clean": "rimraf dist .turbo",
|
"clean": "rimraf dist .turbo",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"typecheck": "vue-tsc --declaration --emitDeclarationOnly",
|
"typecheck": "vue-tsc --declaration --emitDeclarationOnly",
|
||||||
"test": "vitest run --coverage",
|
"test": "vitest run",
|
||||||
"test:dev": "vitest",
|
"test:dev": "vitest",
|
||||||
"build:storybook": "storybook build",
|
"build:storybook": "storybook build",
|
||||||
"storybook": "storybook dev -p 6006",
|
"storybook": "storybook dev -p 6006",
|
||||||
|
|
|
@ -1,9 +1,30 @@
|
||||||
import vue from '@vitejs/plugin-vue';
|
import vue from '@vitejs/plugin-vue';
|
||||||
import { resolve } from 'path';
|
import { resolve } from 'path';
|
||||||
import { defineConfig, mergeConfig } from 'vite';
|
import { defineConfig, mergeConfig } from 'vite';
|
||||||
|
import { type UserConfig } from 'vitest';
|
||||||
import { defineConfig as defineVitestConfig } from 'vitest/config';
|
import { defineConfig as defineVitestConfig } from 'vitest/config';
|
||||||
|
|
||||||
const { coverageReporters } = require('../../jest.config.js');
|
export const vitestConfig = defineVitestConfig({
|
||||||
|
test: {
|
||||||
|
globals: true,
|
||||||
|
environment: 'jsdom',
|
||||||
|
setupFiles: ['./src/__tests__/setup.ts'],
|
||||||
|
...(process.env.COVERAGE_ENABLED === 'true'
|
||||||
|
? {
|
||||||
|
coverage: {
|
||||||
|
provider: 'v8',
|
||||||
|
reporter: require('../../jest.config.js').coverageReporters,
|
||||||
|
all: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
css: {
|
||||||
|
modules: {
|
||||||
|
classNameStrategy: 'non-scoped',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}) as UserConfig;
|
||||||
|
|
||||||
export default mergeConfig(
|
export default mergeConfig(
|
||||||
defineConfig({
|
defineConfig({
|
||||||
|
@ -35,21 +56,5 @@ export default mergeConfig(
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
defineVitestConfig({
|
vitestConfig,
|
||||||
test: {
|
|
||||||
globals: true,
|
|
||||||
environment: 'jsdom',
|
|
||||||
setupFiles: ['./src/__tests__/setup.ts'],
|
|
||||||
coverage: {
|
|
||||||
provider: 'v8',
|
|
||||||
reporter: coverageReporters,
|
|
||||||
all: true,
|
|
||||||
},
|
|
||||||
css: {
|
|
||||||
modules: {
|
|
||||||
classNameStrategy: 'non-scoped',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
"lintfix": "eslint src --ext .js,.ts,.vue --fix",
|
"lintfix": "eslint src --ext .js,.ts,.vue --fix",
|
||||||
"format": "prettier --write . --ignore-path ../../.prettierignore",
|
"format": "prettier --write . --ignore-path ../../.prettierignore",
|
||||||
"serve": "cross-env VUE_APP_URL_BASE_API=http://localhost:5678/ vite --host 0.0.0.0 --port 8080 dev",
|
"serve": "cross-env VUE_APP_URL_BASE_API=http://localhost:5678/ vite --host 0.0.0.0 --port 8080 dev",
|
||||||
"test": "vitest run --coverage",
|
"test": "vitest run",
|
||||||
"test:dev": "vitest"
|
"test:dev": "vitest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
import vue from '@vitejs/plugin-vue';
|
import vue from '@vitejs/plugin-vue';
|
||||||
import { resolve } from 'path';
|
import { resolve } from 'path';
|
||||||
import { defineConfig, mergeConfig } from 'vite';
|
import { defineConfig, mergeConfig } from 'vite';
|
||||||
import { defineConfig as defineVitestConfig } from 'vitest/config';
|
|
||||||
import { sentryVitePlugin } from '@sentry/vite-plugin';
|
import { sentryVitePlugin } from '@sentry/vite-plugin';
|
||||||
|
|
||||||
import packageJSON from './package.json';
|
import packageJSON from './package.json';
|
||||||
|
import { vitestConfig } from '../design-system/vite.config';
|
||||||
const { coverageReporters } = require('../../jest.config.js');
|
|
||||||
|
|
||||||
const vendorChunks = ['vue', 'vue-router'];
|
const vendorChunks = ['vue', 'vue-router'];
|
||||||
const n8nChunks = ['n8n-workflow', 'n8n-design-system'];
|
const n8nChunks = ['n8n-workflow', 'n8n-design-system'];
|
||||||
|
@ -115,21 +113,5 @@ export default mergeConfig(
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
defineVitestConfig({
|
vitestConfig,
|
||||||
test: {
|
|
||||||
globals: true,
|
|
||||||
environment: 'jsdom',
|
|
||||||
setupFiles: ['./src/__tests__/setup.ts'],
|
|
||||||
coverage: {
|
|
||||||
provider: 'v8',
|
|
||||||
reporter: coverageReporters,
|
|
||||||
all: true,
|
|
||||||
},
|
|
||||||
css: {
|
|
||||||
modules: {
|
|
||||||
classNameStrategy: 'non-scoped',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue