generated from twig-it/typescript-starter-template
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (52 loc) · 1.34 KB
/
build-and-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
name: build-and-test
on:
pull_request:
push:
branches:
- main
jobs:
npm-install:
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v2
- id: cache
name: Cache node modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- name: Npm Install
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
build:
runs-on: ubuntu-20.04
needs: [npm-install]
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- name: Build
run: npm run build:ci
- name: Archive build artifacts
uses: actions/upload-artifact@v2
with:
name: dist
path: dist
test:
runs-on: ubuntu-20.04
needs: [npm-install]
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Restore node modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- name: Test
run: npm run build:ci