-
Notifications
You must be signed in to change notification settings - Fork 137
71 lines (61 loc) · 1.83 KB
/
Copy pathjs-tests.yml
File metadata and controls
71 lines (61 loc) · 1.83 KB
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
61
62
63
64
65
66
67
68
69
70
71
name: JS Tests
on:
push:
paths:
- '**.js'
- '**.jsx'
- '**.ts'
- '**.tsx'
- 'package.json'
- 'package-lock.json'
- 'jest.config.js'
- '.github/workflows/js-tests.yml'
pull_request:
branches: [develop, main]
paths:
- '**.js'
- '**.jsx'
- '**.ts'
- '**.tsx'
- 'package.json'
- 'package-lock.json'
- 'jest.config.js'
- '.github/workflows/js-tests.yml'
workflow_dispatch:
# Disable all permissions by default; grant minimal permissions per job
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint-and-test:
name: Lint and Jest Tests
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up NodeJS 20
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '20'
cache: npm
- name: Install dependencies
run: npm ci
- name: Cache ESLint and Jest results
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
.eslintcache
node_modules/.cache/jest
key: js-cache-${{ runner.os }}-${{ hashFiles('package-lock.json', 'jest.config.js', '.eslintrc*', 'eslint.config.*') }}-${{ github.sha }}
restore-keys: |
js-cache-${{ runner.os }}-${{ hashFiles('package-lock.json', 'jest.config.js', '.eslintrc*', 'eslint.config.*') }}-
js-cache-${{ runner.os }}-
- name: Run Lint JS
run: npm run lint-js -- --cache
- name: Run Jest tests
run: npm run test-jest