mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-12 16:10:30 +02:00
ci: Add timing stats for unit tests (#24821)
This commit is contained in:
parent
3f7d7e3e70
commit
c52da486c8
9
.github/scripts/send-build-stats.mjs
vendored
9
.github/scripts/send-build-stats.mjs
vendored
|
|
@ -12,10 +12,15 @@
|
|||
* BUILD_STATS_WEBHOOK_PASSWORD - Basic auth password (required if URL set)
|
||||
*/
|
||||
|
||||
import { readFileSync, readdirSync } from 'node:fs';
|
||||
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
||||
import * as os from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
|
||||
const runsDir = '.turbo/runs';
|
||||
if (!existsSync(runsDir)) {
|
||||
console.log('No .turbo/runs directory found (turbo --summarize not used), skipping.');
|
||||
process.exit(0);
|
||||
}
|
||||
const files = readdirSync(runsDir).filter((f) => f.endsWith('.json'));
|
||||
const summaryPath = files.length > 0 ? join(runsDir, files[0]) : null;
|
||||
|
||||
|
|
@ -40,8 +45,6 @@ if (!webhookUser || !webhookPassword) {
|
|||
|
||||
const basicAuth = Buffer.from(`${webhookUser}:${webhookPassword}`).toString('base64');
|
||||
|
||||
import * as os from 'node:os';
|
||||
|
||||
const summary = JSON.parse(readFileSync(summaryPath, 'utf-8'));
|
||||
|
||||
// Extract PR number from GITHUB_REF (refs/pull/123/merge)
|
||||
|
|
|
|||
3
.github/workflows/ci-manual-unit-tests.yml
vendored
3
.github/workflows/ci-manual-unit-tests.yml
vendored
|
|
@ -72,6 +72,9 @@ jobs:
|
|||
collectCoverage: true
|
||||
secrets:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
BUILD_STATS_WEBHOOK_URL: ${{ secrets.BUILD_STATS_WEBHOOK_URL }}
|
||||
BUILD_STATS_WEBHOOK_USER: ${{ secrets.BUILD_STATS_WEBHOOK_USER }}
|
||||
BUILD_STATS_WEBHOOK_PASSWORD: ${{ secrets.BUILD_STATS_WEBHOOK_PASSWORD }}
|
||||
|
||||
lint:
|
||||
name: Lint
|
||||
|
|
|
|||
3
.github/workflows/ci-master.yml
vendored
3
.github/workflows/ci-master.yml
vendored
|
|
@ -30,6 +30,9 @@ jobs:
|
|||
collectCoverage: ${{ matrix.node-version == '22.x' }}
|
||||
secrets:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
BUILD_STATS_WEBHOOK_URL: ${{ secrets.BUILD_STATS_WEBHOOK_URL }}
|
||||
BUILD_STATS_WEBHOOK_USER: ${{ secrets.BUILD_STATS_WEBHOOK_USER }}
|
||||
BUILD_STATS_WEBHOOK_PASSWORD: ${{ secrets.BUILD_STATS_WEBHOOK_PASSWORD }}
|
||||
|
||||
lint:
|
||||
name: Lint
|
||||
|
|
|
|||
3
.github/workflows/ci-pull-requests.yml
vendored
3
.github/workflows/ci-pull-requests.yml
vendored
|
|
@ -60,6 +60,9 @@ jobs:
|
|||
collectCoverage: true
|
||||
secrets:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
BUILD_STATS_WEBHOOK_URL: ${{ secrets.BUILD_STATS_WEBHOOK_URL }}
|
||||
BUILD_STATS_WEBHOOK_USER: ${{ secrets.BUILD_STATS_WEBHOOK_USER }}
|
||||
BUILD_STATS_WEBHOOK_PASSWORD: ${{ secrets.BUILD_STATS_WEBHOOK_PASSWORD }}
|
||||
|
||||
typecheck:
|
||||
name: Typecheck
|
||||
|
|
|
|||
49
.github/workflows/test-unit-reusable.yml
vendored
49
.github/workflows/test-unit-reusable.yml
vendored
|
|
@ -21,6 +21,15 @@ on:
|
|||
CODECOV_TOKEN:
|
||||
description: 'Codecov upload token.'
|
||||
required: false
|
||||
BUILD_STATS_WEBHOOK_URL:
|
||||
description: 'Webhook URL for test stats.'
|
||||
required: false
|
||||
BUILD_STATS_WEBHOOK_USER:
|
||||
description: 'Basic auth username for test stats webhook.'
|
||||
required: false
|
||||
BUILD_STATS_WEBHOOK_PASSWORD:
|
||||
description: 'Basic auth password for test stats webhook.'
|
||||
required: false
|
||||
|
||||
env:
|
||||
NODE_OPTIONS: --max-old-space-size=7168
|
||||
|
|
@ -42,7 +51,15 @@ jobs:
|
|||
node-version: ${{ inputs.nodeVersion }}
|
||||
|
||||
- name: Test Unit
|
||||
run: pnpm test:ci:backend:unit
|
||||
run: pnpm test:ci:backend:unit --summarize
|
||||
|
||||
- name: Send Test Stats
|
||||
if: ${{ !cancelled() }}
|
||||
run: node .github/scripts/send-build-stats.mjs || true
|
||||
env:
|
||||
BUILD_STATS_WEBHOOK_URL: ${{ secrets.BUILD_STATS_WEBHOOK_URL }}
|
||||
BUILD_STATS_WEBHOOK_USER: ${{ secrets.BUILD_STATS_WEBHOOK_USER }}
|
||||
BUILD_STATS_WEBHOOK_PASSWORD: ${{ secrets.BUILD_STATS_WEBHOOK_PASSWORD }}
|
||||
|
||||
- name: Upload test results to Codecov
|
||||
if: ${{ !cancelled() }}
|
||||
|
|
@ -75,7 +92,15 @@ jobs:
|
|||
node-version: ${{ inputs.nodeVersion }}
|
||||
|
||||
- name: Test Integration
|
||||
run: pnpm test:ci:backend:integration
|
||||
run: pnpm test:ci:backend:integration --summarize
|
||||
|
||||
- name: Send Test Stats
|
||||
if: ${{ !cancelled() }}
|
||||
run: node .github/scripts/send-build-stats.mjs || true
|
||||
env:
|
||||
BUILD_STATS_WEBHOOK_URL: ${{ secrets.BUILD_STATS_WEBHOOK_URL }}
|
||||
BUILD_STATS_WEBHOOK_USER: ${{ secrets.BUILD_STATS_WEBHOOK_USER }}
|
||||
BUILD_STATS_WEBHOOK_PASSWORD: ${{ secrets.BUILD_STATS_WEBHOOK_PASSWORD }}
|
||||
|
||||
- name: Upload test results to Codecov
|
||||
if: ${{ !cancelled() }}
|
||||
|
|
@ -108,7 +133,15 @@ jobs:
|
|||
node-version: ${{ inputs.nodeVersion }}
|
||||
|
||||
- name: Test Nodes
|
||||
run: pnpm turbo test --filter=n8n-nodes-base
|
||||
run: pnpm turbo test --filter=n8n-nodes-base --summarize
|
||||
|
||||
- name: Send Test Stats
|
||||
if: ${{ !cancelled() }}
|
||||
run: node .github/scripts/send-build-stats.mjs || true
|
||||
env:
|
||||
BUILD_STATS_WEBHOOK_URL: ${{ secrets.BUILD_STATS_WEBHOOK_URL }}
|
||||
BUILD_STATS_WEBHOOK_USER: ${{ secrets.BUILD_STATS_WEBHOOK_USER }}
|
||||
BUILD_STATS_WEBHOOK_PASSWORD: ${{ secrets.BUILD_STATS_WEBHOOK_PASSWORD }}
|
||||
|
||||
- name: Upload test results to Codecov
|
||||
if: ${{ !cancelled() }}
|
||||
|
|
@ -145,10 +178,18 @@ jobs:
|
|||
node-version: ${{ inputs.nodeVersion }}
|
||||
|
||||
- name: Test
|
||||
run: pnpm test:ci:frontend -- --shard=${{ matrix.shard }}/2
|
||||
run: pnpm test:ci:frontend --summarize -- --shard=${{ matrix.shard }}/2
|
||||
env:
|
||||
VITEST_SHARD: ${{ matrix.shard }}/2
|
||||
|
||||
- name: Send Test Stats
|
||||
if: ${{ !cancelled() }}
|
||||
run: node .github/scripts/send-build-stats.mjs || true
|
||||
env:
|
||||
BUILD_STATS_WEBHOOK_URL: ${{ secrets.BUILD_STATS_WEBHOOK_URL }}
|
||||
BUILD_STATS_WEBHOOK_USER: ${{ secrets.BUILD_STATS_WEBHOOK_USER }}
|
||||
BUILD_STATS_WEBHOOK_PASSWORD: ${{ secrets.BUILD_STATS_WEBHOOK_PASSWORD }}
|
||||
|
||||
- name: Upload test results to Codecov
|
||||
if: ${{ !cancelled() }}
|
||||
uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1.1.1
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ try {
|
|||
installProcess.pipe(process.stdout);
|
||||
await installProcess;
|
||||
|
||||
const buildProcess = $`cd ${config.rootDir} && pnpm build`;
|
||||
const buildProcess = $`cd ${config.rootDir} && pnpm build --summarize`;
|
||||
buildProcess.pipe(process.stdout);
|
||||
await buildProcess;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user