This repository has been archived by the owner on Jun 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
77 lines (66 loc) · 2.23 KB
/
ci.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: ci
on: [push]
jobs:
e2e:
runs-on: ubuntu-20.04
steps:
- name: Checkout 🛎
uses: actions/checkout@v2
- name: Install and run Cypress tests 🌲
uses: cypress-io/github-action@v2
unit:
runs-on: ubuntu-20.04
steps:
- name: Checkout 🛎
uses: actions/checkout@v2
# we are only interested in installing and caching dependencies,
# without installing the Cypress binary
- name: Install NPM dependencies 📦
uses: bahmutov/npm-install@v1
env:
# we do not need to install Cypress itself
# as we do not plan to run tests
CYPRESS_INSTALL_BINARY: 0
- name: Run Jest tests 🧪
run: npm test
unit-using-cypress-gh-action:
runs-on: ubuntu-20.04
steps:
- name: Checkout 🛎
uses: actions/checkout@v2
# we are only interested in installing and caching dependencies,
# without installing the Cypress binary
- name: Install NPM dependencies 📦
uses: cypress-io/github-action@v2
# we do not want to accidentally overwrite
# the full cache created in the e2e test job
# because this job does not cache Cypress binary
# thus we use custom cache key
with:
cache-key: unit-cache-v1-${{ runner.os }}-hash-${{ hashFiles('package-lock.json') }}
env:
# we do not need to install Cypress itself
# as we do not plan to run tests
CYPRESS_INSTALL_BINARY: 0
- name: Run Jest tests 🧪
run: npm test
unit-without-any-helpers:
runs-on: ubuntu-20.04
steps:
- name: Checkout 🛎
uses: actions/checkout@v2
# use actions/cache to restore / save cache
- name: Cache dependencies 💎
uses: actions/cache@v2
with:
path: ~/.npm
# use key string with "v1" for simple cache invalidation
key: dependencies-v1-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies 📦
run: npm ci
env:
# we do not need to install Cypress itself
# as we do not plan to run tests
CYPRESS_INSTALL_BINARY: 0
- name: Run Jest tests 🧪
run: npm test