mirror of
https://github.com/n8n-io/n8n.git
synced 2025-11-20 17:46:34 +00:00
ci: Split PR unit testing into frontend and backend (no-changelog) (#21009)
This commit is contained in:
parent
69d78034cb
commit
84b970e722
55
.github/workflows/units-tests-reusable.yml
vendored
55
.github/workflows/units-tests-reusable.yml
vendored
@ -26,8 +26,8 @@ env:
|
||||
NODE_OPTIONS: --max-old-space-size=7168
|
||||
|
||||
jobs:
|
||||
unit-test:
|
||||
name: Unit tests
|
||||
unit-test-backend:
|
||||
name: Backend
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2204
|
||||
env:
|
||||
COVERAGE_ENABLED: ${{ inputs.collectCoverage }}
|
||||
@ -42,7 +42,7 @@ jobs:
|
||||
node-version: ${{ inputs.nodeVersion }}
|
||||
|
||||
- name: Test
|
||||
run: pnpm test:ci
|
||||
run: pnpm test:ci:backend
|
||||
|
||||
- name: Upload test results to Codecov
|
||||
if: ${{ !cancelled() }}
|
||||
@ -54,3 +54,52 @@ jobs:
|
||||
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
flags: backend
|
||||
|
||||
unit-test-frontend:
|
||||
name: Frontend (${{ matrix.shard }}/2)
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2204
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shard: [1, 2]
|
||||
env:
|
||||
COVERAGE_ENABLED: ${{ inputs.collectCoverage }}
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
- name: Build
|
||||
uses: n8n-io/n8n/.github/actions/setup-nodejs-blacksmith@f5fbbbe0a28a886451c886cac6b49192a39b0eea # v1.104.1
|
||||
with:
|
||||
node-version: ${{ inputs.nodeVersion }}
|
||||
|
||||
- name: Test
|
||||
run: pnpm test:ci:frontend -- --shard=${{ matrix.shard }}/2
|
||||
env:
|
||||
VITEST_SHARD: ${{ matrix.shard }}/2
|
||||
|
||||
- name: Upload test results to Codecov
|
||||
if: ${{ !cancelled() }}
|
||||
uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1.1.1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
name: frontend-shard-${{ matrix.shard }}
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
flags: frontend
|
||||
name: frontend-shard-${{ matrix.shard }}
|
||||
|
||||
unit-test:
|
||||
name: Unit tests
|
||||
runs-on: ubuntu-latest
|
||||
needs: [unit-test-backend, unit-test-frontend]
|
||||
if: always()
|
||||
steps:
|
||||
- name: Fail if tests failed
|
||||
if: needs.unit-test-backend.result == 'failure' || needs.unit-test-frontend.result == 'failure'
|
||||
run: exit 1
|
||||
|
||||
@ -44,6 +44,8 @@
|
||||
"start:windows": "cd packages/cli/bin && n8n",
|
||||
"test": "JEST_JUNIT_CLASSNAME={filepath} turbo run test",
|
||||
"test:ci": "turbo run test --continue --concurrency=1",
|
||||
"test:ci:frontend": "turbo run test --continue --filter='./packages/frontend/**'",
|
||||
"test:ci:backend": "turbo run test --continue --concurrency=1 --filter='!./packages/frontend/**'",
|
||||
"test:affected": "turbo run test --affected --concurrency=1",
|
||||
"test:with:docker": "pnpm --filter=n8n-playwright test:container:standard",
|
||||
"test:show:report": "pnpm --filter=n8n-playwright exec playwright show-report",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user