forked from n8n-io/n8n
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (51 loc) · 1.75 KB
/
units-tests-reusable.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Reusable units test workflow
on:
workflow_call:
inputs:
ref:
description: 'GitHub ref to test.'
required: false
type: string
default: 'master'
nodeVersion:
description: 'Version of node to use.'
required: false
type: string
default: '18.x'
cacheKey:
description: 'Cache key for modules and build artifacts.'
required: false
default: ''
type: string
jobs:
unit-test:
name: Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.5.3
with:
repository: n8n-io/n8n
ref: ${{ inputs.ref }}
- uses: pnpm/action-setup@v2.4.0
- name: Use Node.js ${{ inputs.nodeVersion }}
uses: actions/setup-node@v3.7.0
with:
node-version: ${{ inputs.nodeVersion }}
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
if: ${{ inputs.cacheKey == '' }}
run: pnpm build
- name: Restore cached build artifacts
if: ${{ inputs.cacheKey != '' }}
uses: actions/cache/restore@v3.3.1
with:
path: ./packages/**/dist
key: ${{ inputs.cacheKey }}
- name: Test
run: pnpm test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
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