forked from elementor/elementor
-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (49 loc) · 1.45 KB
/
jest.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
name: Jest
on:
pull_request:
merge_group:
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
file-diff:
runs-on: ubuntu-22.04
name: File Diff
if: startsWith( github.repository, 'elementor/' )
outputs:
js_diff: ${{ steps.js_diff_files.outputs.diff }}
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Check JS files diff
id: js_diff_files
uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
**/*.+(js|ts|json|jsx|tsx)
package*.json
.github/**/*.yml
jest:
runs-on: ubuntu-22.04
needs: [ 'file-diff' ]
if: ${{ needs.file-diff.outputs.js_diff || github.event.pull_request.title == null }}
name: Test
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Install Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- uses: actions/cache@v3
id: npm-cache
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Dependencies
run: npm ci
- name: "Run Jest"
run: npm run test:jest