6
6
- release/**
7
7
pull_request :
8
8
9
+ env :
10
+ CACHED_DEPENDENCY_PATHS : |
11
+ ${{ github.workspace }}/node_modules
12
+ ${{ github.workspace }}/packages/**/node_modules
13
+
14
+ # DEPENDENCY_CACHE_KEY: can't be set here because we don't have access to yarn.lock
15
+
16
+ CACHED_BUILD_PATHS : |
17
+ ${{ github.workspace }}/packages/**/build
18
+ ${{ github.workspace }}/packages/**/dist
19
+ ${{ github.workspace }}/packages/**/esm
20
+ ${{ github.workspace }}/packages/serverless/dist-awslambda-layer/*.zip
21
+
22
+ BUILD_CACHE_KEY : ${{ github.sha }}
23
+
9
24
jobs :
25
+ job_install_deps :
26
+ name : Install Dependencies
27
+ runs-on : ubuntu-latest
28
+ timeout-minutes : 15
29
+ steps :
30
+ - name : Check out current commit (${{ github.sha }})
31
+ uses : actions/checkout@v2
32
+ - name : Set up Node
33
+ uses : actions/setup-node@v1
34
+ # we use a hash of yarn.lock as our cache key, because if it hasn't changed, our dependencies haven't changed,
35
+ # so no need to reinstall them
36
+ - name : Compute dependency cache key
37
+ id : compute_lockfile_hash
38
+ run : echo "::set-output name=hash::${{ hashFiles('yarn.lock') }}"
39
+ - name : Check dependency cache
40
+ uses : actions/cache@v2
41
+ id : cache_dependencies
42
+ with :
43
+ path : ${{ env.CACHED_DEPENDENCY_PATHS }}
44
+ key : ${{ steps.compute_lockfile_hash.outputs.hash }}
45
+ - name : Install dependencies
46
+ if : steps.cache_dependencies.outputs.cache-hit == ''
47
+ run : yarn install
48
+ outputs :
49
+ dependency_cache_key : ${{ steps.compute_lockfile_hash.outputs.hash }}
50
+
10
51
job_build :
11
52
name : Build
53
+ needs : job_install_deps
12
54
runs-on : ubuntu-latest
13
55
timeout-minutes : 15
14
56
steps :
15
- - uses : actions/checkout@v2
16
- - uses : actions/setup-node@v1
17
- - uses : actions/cache@v2
57
+ - name : Check out current commit (${{ github.sha }})
58
+ uses : actions/checkout@v2
59
+ - name : Set up Node
60
+ uses : actions/setup-node@v1
61
+ - name : Check dependency cache
62
+ uses : actions/cache@v2
18
63
with :
19
- path : |
20
- ${{ github.workspace }}/node_modules
21
- ${{ github.workspace }}/packages/**/node_modules
22
- ${{ github.workspace }}/packages/**/build
23
- ${{ github.workspace }}/packages/**/dist
24
- ${{ github.workspace }}/packages/**/esm
25
- ${{ github.workspace }}/packages/serverless/dist-awslambda-layer/*.zip
26
- key : ${{ github.sha }}
27
- - name : Install
28
- run : yarn install
29
- - name : Build
64
+ path : ${{ env.CACHED_DEPENDENCY_PATHS }}
65
+ key : ${{ needs.job_install_deps.outputs.dependency_cache_key }}
66
+ - name : Check build cache
67
+ uses : actions/cache@v2
68
+ id : cache_built_packages
69
+ with :
70
+ path : ${{ env.CACHED_BUILD_PATHS }}
71
+ key : ${{ env.BUILD_CACHE_KEY }}
72
+ - name : Build packages
73
+ # Under normal circumstances, using the git SHA as a cache key, there shouldn't ever be a cache hit on the built
74
+ # packages, and so `yarn build` should always run. This `if` check is therefore only there for testing CI issues
75
+ # where the built packages are beside the point. In that case, you can change `BUILD_CACHE_KEY` (at the top of
76
+ # this file) to a constant and skip rebuilding all of the packages each time CI runs.
77
+ if : steps.cache_built_packages.outputs.cache-hit == ''
30
78
run : yarn build
79
+ outputs :
80
+ # this needs to be passed on, because the `needs` context only looks at direct ancestors (so steps which depend on
81
+ # `job_build` can't see `job_install_deps` and what it returned)
82
+ dependency_cache_key : ${{ needs.job_install_deps.outputs.dependency_cache_key }}
31
83
32
84
job_size_check :
33
85
name : Size Check
@@ -36,19 +88,22 @@ jobs:
36
88
runs-on : ubuntu-latest
37
89
if : ${{ github.head_ref }}
38
90
steps :
39
- - uses : actions/checkout@v2
40
- - uses : actions/setup-node@v1
41
- - uses : actions/cache@v2
91
+ - name : Check out current commit (${{ github.sha }})
92
+ uses : actions/checkout@v2
93
+ - name : Set up Node
94
+ uses : actions/setup-node@v1
95
+ - name : Check dependency cache
96
+ uses : actions/cache@v2
42
97
with :
43
- path : |
44
- ${{ github.workspace }}/node_modules
45
- ${{ github.workspace }}/packages/**/node_modules
46
- ${{ github.workspace }}/packages/**/build
47
- ${{ github.workspace }}/packages/**/dist
48
- ${{ github.workspace }}/packages/**/esm
49
- ${{ github.workspace }}/packages/serverless/dist-awslambda-layer/*.zip
50
- key : ${{ github.sha }}
51
- - uses :
andresz1/[email protected]
98
+ path : ${{ env.CACHED_DEPENDENCY_PATHS }}
99
+ key : ${{ needs.job_build.outputs.dependency_cache_key }}
100
+ - name : Check build cache
101
+ uses : actions/cache@v2
102
+ with :
103
+ path : ${{ env.CACHED_BUILD_PATHS }}
104
+ key : ${{ env.BUILD_CACHE_KEY }}
105
+ - name : Check bundle sizes
106
+
52
107
with :
53
108
github_token : ${{ secrets.GITHUB_TOKEN }}
54
109
skip_step : build
@@ -59,20 +114,21 @@ jobs:
59
114
timeout-minutes : 10
60
115
runs-on : ubuntu-latest
61
116
steps :
62
- - uses : actions/checkout@v2
63
- - uses : actions/setup-node@v1
64
- - uses : actions/cache@v2
117
+ - name : Check out current commit (${{ github.sha }})
118
+ uses : actions/checkout@v2
119
+ - name : Set up Node
120
+ uses : actions/setup-node@v1
121
+ - name : Check dependency cache
122
+ uses : actions/cache@v2
65
123
with :
66
- path : |
67
- ${{ github.workspace }}/node_modules
68
- ${{ github.workspace }}/packages/**/node_modules
69
- ${{ github.workspace }}/packages/**/build
70
- ${{ github.workspace }}/packages/**/dist
71
- ${{ github.workspace }}/packages/**/esm
72
- ${{ github.workspace }}/packages/serverless/dist-awslambda-layer/*.zip
73
- key : ${{ github.sha }}
74
- - run : yarn install
75
- - name : Run Linter
124
+ path : ${{ env.CACHED_DEPENDENCY_PATHS }}
125
+ key : ${{ needs.job_build.outputs.dependency_cache_key }}
126
+ - name : Check build cache
127
+ uses : actions/cache@v2
128
+ with :
129
+ path : ${{ env.CACHED_BUILD_PATHS }}
130
+ key : ${{ env.BUILD_CACHE_KEY }}
131
+ - name : Run linter
76
132
run : yarn lint
77
133
78
134
job_unit_test :
@@ -85,47 +141,85 @@ jobs:
85
141
matrix :
86
142
node : [6, 8, 10, 12, 14]
87
143
steps :
88
- - uses : actions/checkout@v2
89
- - uses : actions/setup-node@v1
144
+ - name : Check out current commit (${{ github.sha }})
145
+ uses : actions/checkout@v2
146
+ - name : Set up Node
147
+ uses : actions/setup-node@v1
90
148
with :
91
149
node-version : ${{ matrix.node }}
92
- - uses : actions/cache@v2
150
+ - name : Check dependency cache
151
+ uses : actions/cache@v2
93
152
with :
94
- path : |
95
- ${{ github.workspace }}/node_modules
96
- ${{ github.workspace }}/packages/**/node_modules
97
- ${{ github.workspace }}/packages/**/build
98
- ${{ github.workspace }}/packages/**/dist
99
- ${{ github.workspace }}/packages/**/esm
100
- ${{ github.workspace }}/packages/serverless/dist-awslambda-layer/*.zip
101
- key : ${{ github.sha }}
102
- - name : Unit Tests
153
+ path : ${{ env.CACHED_DEPENDENCY_PATHS }}
154
+ key : ${{ needs.job_build.outputs.dependency_cache_key }}
155
+ - name : Check build cache
156
+ uses : actions/cache@v2
157
+ with :
158
+ path : ${{ env.CACHED_BUILD_PATHS }}
159
+ key : ${{ env.BUILD_CACHE_KEY }}
160
+ - name : Run tests
103
161
env :
104
162
NODE_VERSION : ${{ matrix.node }}
105
163
run : ./scripts/test.sh
106
- - uses : codecov/codecov-action@v1
164
+ - name : Compute test coverage
165
+ uses : codecov/codecov-action@v1
166
+
167
+ # Ember tests are separate from the rest because they are the slowest part of the test suite, and making them a
168
+ # separate job allows them to run in parallel with the other tests.
169
+ job_ember_tests :
170
+ name : Test @sentry/ember
171
+ needs : job_build
172
+ continue-on-error : true
173
+ timeout-minutes : 30
174
+ runs-on : ubuntu-latest
175
+ steps :
176
+ - name : Check out current commit (${{ github.sha }})
177
+ uses : actions/checkout@v2
178
+ - name : Set up Node
179
+ uses : actions/setup-node@v1
180
+ with :
181
+ # The only danger with Ember in terms of Node versions is that the build tool, ember-cli, won't work if Node
182
+ # is too old. Since Oct 2019, Node 10 has been the oldest version supported by ember-cli, so test against
183
+ # that. If it passes, newer versions of Node should also be fine. This saves us from having to run the Ember
184
+ # tests in our Node matrix above.
185
+ node-version : ' 10'
186
+ - name : Check dependency cache
187
+ uses : actions/cache@v2
188
+ with :
189
+ path : ${{ env.CACHED_DEPENDENCY_PATHS }}
190
+ key : ${{ needs.job_build.outputs.dependency_cache_key }}
191
+ - name : Check build cache
192
+ uses : actions/cache@v2
193
+ with :
194
+ path : ${{ env.CACHED_BUILD_PATHS }}
195
+ key : ${{ env.BUILD_CACHE_KEY }}
196
+ - name : Run Ember tests
197
+ run : yarn test --scope=@sentry/ember
198
+ - name : Compute test coverage
199
+ uses : codecov/codecov-action@v1
107
200
108
201
job_artifacts :
109
- name : Artifacts Upload
202
+ name : Upload Artifacts
110
203
needs : job_build
111
204
runs-on : ubuntu-latest
112
205
steps :
113
- - uses : actions/checkout@v2
114
- - uses : actions/setup-node@v1
115
- - uses : actions/cache@v2
206
+ - name : Check out current commit (${{ github.sha }})
207
+ uses : actions/checkout@v2
208
+ - name : Set up Node
209
+ uses : actions/setup-node@v1
210
+ - name : Check dependency cache
211
+ uses : actions/cache@v2
116
212
with :
117
- path : |
118
- ${{ github.workspace }}/node_modules
119
- ${{ github.workspace }}/packages/**/node_modules
120
- ${{ github.workspace }}/packages/**/build
121
- ${{ github.workspace }}/packages/**/dist
122
- ${{ github.workspace }}/packages/**/esm
123
- ${{ github.workspace }}/packages/serverless/dist-awslambda-layer/*.zip
124
- key : ${{ github.sha }}
213
+ path : ${{ env.CACHED_DEPENDENCY_PATHS }}
214
+ key : ${{ needs.job_build.outputs.dependency_cache_key }}
215
+ - name : Check build cache
216
+ uses : actions/cache@v2
217
+ with :
218
+ path : ${{ env.CACHED_BUILD_PATHS }}
219
+ key : ${{ env.BUILD_CACHE_KEY }}
125
220
- name : Pack
126
221
run : yarn pack:changed
127
- - run : yarn install
128
- - name : Archive Artifacts
222
+ - name : Archive artifacts
129
223
uses : actions/upload-artifact@v2
130
224
with :
131
225
name : ${{ github.sha }}
@@ -146,20 +240,21 @@ jobs:
146
240
# if: startsWith(github.ref, 'refs/heads/release/')
147
241
if : false
148
242
steps :
149
- - uses : actions/checkout@v2
150
- - uses : actions/setup-node@v1
151
- - uses : actions/cache@v2
243
+ - name : Check out current commit (${{ github.sha }})
244
+ uses : actions/checkout@v2
245
+ - name : Set up Node
246
+ uses : actions/setup-node@v1
247
+ - name : Check dependency cache
248
+ uses : actions/cache@v2
152
249
with :
153
- path : |
154
- ${{ github.workspace }}/node_modules
155
- ${{ github.workspace }}/packages/**/node_modules
156
- ${{ github.workspace }}/packages/**/build
157
- ${{ github.workspace }}/packages/**/dist
158
- ${{ github.workspace }}/packages/**/esm
159
- ${{ github.workspace }}/packages/serverless/dist-awslambda-layer/*.zip
160
- key : ${{ github.sha }}
161
- - run : yarn install
162
- - name : Integration Tests
250
+ path : ${{ env.CACHED_DEPENDENCY_PATHS }}
251
+ key : ${{ needs.job_build.outputs.dependency_cache_key }}
252
+ - name : Check build cache
253
+ uses : actions/cache@v2
254
+ with :
255
+ path : ${{ env.CACHED_BUILD_PATHS }}
256
+ key : ${{ env.BUILD_CACHE_KEY }}
257
+ - name : Run integration tests
163
258
env :
164
259
BROWSERSTACK_USERNAME : ${{ secrets.BROWSERSTACK_USERNAME }}
165
260
BROWSERSTACK_ACCESS_KEY : ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
0 commit comments