-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (92 loc) · 2.32 KB
/
build-and-test.yaml
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Build and Test
on:
pull_request:
type:
- opened
- synchronize
- reopened
workflow_call: {}
jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: cache-install
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
- if: steps.cache-install.outputs.cache-hit != 'true'
uses: actions/setup-node@v3
with:
node-version: 16
- if: steps.cache-install.outputs.cache-hit != 'true'
run: npm ci
- run: |
touch installed.tgz
tar -zcf installed.tgz --exclude=installed.tgz --exclude=.git .
- uses: actions/upload-artifact@v3
with:
name: installed
path: installed.tgz
retention-days: 1
lint:
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: installed
- uses: actions/setup-node@v3
with:
node-version: 16
- run: |
tar -xf installed.tgz
rm installed.tgz
- uses: actions/cache@v3
id: cache-eslint
with:
path: .eslintcache
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
- run: npm run lint -- --cache-strategy=content
build:
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: installed
- uses: actions/setup-node@v3
with:
node-version: 16
- run: |
tar -xf installed.tgz
rm installed.tgz
- run: npm run tsc
- run: tar -zcf built.tgz ./dist
- uses: actions/upload-artifact@v3
with:
name: built
path: built.tgz
retention-days: 1
test:
needs:
- install
- build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: installed
- uses: actions/download-artifact@v3
with:
name: built
- uses: actions/setup-node@v3
with:
node-version: 16
- run: |
tar -xf installed.tgz
rm installed.tgz
tar -xf built.tgz
rm built.tgz
- run: npm test