@@ -21,28 +21,11 @@ jobs:
21
21
node-version : ${{ matrix.version }}
22
22
cache : " npm"
23
23
- name : Setup npm
24
- run : npm i -g npm@next-8
25
- - name : Cache node modules
26
- id : cache-node-modules
27
- uses : actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
24
+ run : npm i -g npm@latest
25
+ - name : Setup dependencies
26
+ uses : ./.github/actions/cached-node-modules
28
27
with :
29
- path : " ./node_modules"
30
- # Use the combo between node version, name, and SHA-256 hash of the lock file as cache key so that
31
- # if one of them changes the cache is invalidated/discarded
32
- key : ${{ matrix.version }}-cache-utilities-node-modules-${{ hashFiles('./package-lock.json') }}
33
- - name : Install dependencies
34
- # We can skip the installation if there was a cache hit
35
- if : steps.cache-node-modules.outputs.cache-hit != 'true'
36
- # See https://github.com/npm/cli/issues/4475 to see why --foreground-scripts
37
- run : npm ci --foreground-scripts
38
- - name : Build packages
39
- # If there's a cache hit we still need to manually build the packages
40
- # this would otherwise have been done automatically as a part of the
41
- # post-install npm hook
42
- if : steps.cache-node-modules.outputs.cache-hit == 'true'
43
- run : |
44
- npm run build -w packages/commons
45
- npm run build -w packages/logger & npm run build -w packages/tracer & npm run build -w packages/metrics & npm run build -w packages/parameters & npm run build -w packages/idempotency
28
+ nodeVersion : ${{ matrix.version }}
46
29
- name : Run linting
47
30
run : npm run lint -w packages/commons -w packages/logger -w packages/tracer -w packages/metrics -w packages/parameters -w packages/idempotency
48
31
- name : Run unit tests
66
49
with :
67
50
node-version : 18
68
51
cache : " npm"
69
- - name : Cache node modules
70
- id : cache-node-modules
71
- uses : actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
72
- with :
73
- path : " ./examples/${{ matrix.example }}/node_modules"
74
- # Use the combo between example, name, and SHA-256 hash of all example lock files as cache key.
75
- # It's not possible to use the ${{ matrix.example }} key in the hashFiles fn so
76
- # if any of the lock files (wich should be fairly similar anyway) changes the cache is
77
- # invalidated/discarded for all.
78
- key : ${{ matrix.example }}-cache-examples-node-modules-${{ hashFiles('./examples/*/package-lock.json') }}
79
- - name : Install dependencies
80
- # We can skip the installation if there was a cache hit
81
- if : steps.cache-node-modules.outputs.cache-hit != 'true'
82
- run : npm ci
52
+ - name : Setup dependencies
53
+ uses : ./.github/actions/cached-node-modules
83
54
- name : Run linting
84
55
run : npm run lint
85
56
- name : Run tests
96
67
with :
97
68
node-version : 18
98
69
cache : " npm"
99
- - name : Cache node modules
100
- id : cache-node-modules
101
- uses : actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
102
- with :
103
- path : " ./node_modules"
104
- # Use the combo between node version, name, and SHA-256 hash of the lock file as cache key so that
105
- # if one of them changes the cache is invalidated/discarded
106
- key : 18-cache-utilities-node-modules-${{ hashFiles('./package-lock.json') }}
107
- - name : Install dependencies
108
- # We can skip the installation if there was a cache hit
109
- if : steps.cache-node-modules.outputs.cache-hit != 'true'
110
- # See https://github.com/npm/cli/issues/4475 to see why --foreground-scripts
111
- run : npm ci --foreground-scripts
70
+ - name : Setup dependencies
71
+ uses : ./.github/actions/cached-node-modules
112
72
- name : Run linting
113
73
run : npm run lint -w layers
114
74
- name : Create layer files
@@ -129,28 +89,7 @@ jobs:
129
89
with :
130
90
node-version : 18
131
91
cache : " npm"
132
- - name : Setup npm
133
- run : npm i -g npm@next-8
134
- - name : Cache node modules
135
- id : cache-node-modules
136
- uses : actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
137
- with :
138
- path : " ./node_modules"
139
- # Use the combo between node version, name, and SHA-256 hash of the lock file as cache key so that
140
- # if one of them changes the cache is invalidated/discarded
141
- key : 18-cache-utilities-node-modules-${{ hashFiles('./package-lock.json') }}
142
- - name : Install dependencies
143
- # We can skip the installation if there was a cache hit
144
- if : steps.cache-node-modules.outputs.cache-hit != 'true'
145
- # See https://github.com/npm/cli/issues/4475 to see why --foreground-scripts
146
- run : npm ci --foreground-scripts
147
- - name : Build packages
148
- # If there's a cache hit we still need to manually build the packages
149
- # this would otherwise have been done automatically as a part of the
150
- # post-install npm hook
151
- if : steps.cache-node-modules.outputs.cache-hit == 'true'
152
- run : |
153
- npm run build -w packages/commons
154
- npm run build -w packages/logger & npm run build -w packages/tracer & npm run build -w packages/metrics & npm run build -w packages/parameters & npm run build -w packages/idempotency & npm run build -w docs/snippets
92
+ - name : Setup dependencies
93
+ uses : ./.github/actions/cached-node-modules
155
94
- name : Run linting
156
95
run : npm run lint -w docs/snippets
0 commit comments