-
Notifications
You must be signed in to change notification settings - Fork 7
66 lines (55 loc) · 1.61 KB
/
test.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
name: Test
on:
push:
branches:
- master
pull_request:
branches:
- '*'
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v1
- name: Retrieve engines' versions from package.json to env variables
id: engines
run: echo "##[set-output name=NVMRC;]$(cat package.json | grep '\"node\":' | sed 's/^ *//;s/ *$//;s/\"node\":\ \"//;s/\",//' )"
- name: Setup node ${{ steps.engines.outputs.NODE_VERSION }}
uses: actions/setup-node@master
with:
node-version: ${{ steps.engines.outputs.NODE_VERSION }}
- name: Cache depedendencies
id: cache
uses: actions/cache@v1
with:
path: node_modules
## Check cache based on yarn.lock hashfile
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ env.cache-name }}-
${{ runner.os }}-yarn-
${{ runner.os }}-
- name: Install dependencies
## If no cache is found, install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn
run:
name: Run
needs: [setup]
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v1
- name: Restore cache
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Lint
run: yarn lint
- name: Typescript
run: yarn tsc
- name: Test
run: yarn test