73
73
# We need to check out not only the fake merge commit between the PR and the base branch which GH creates, but
74
74
# also its parents, so that we can pull the commit message from the head commit of the PR
75
75
fetch-depth : 2
76
+
76
77
- name : Get metadata
77
78
id : get_metadata
78
79
# We need to try a number of different options for finding the head commit, because each kind of trigger event
@@ -82,101 +83,32 @@ jobs:
82
83
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV
83
84
echo "COMMIT_MESSAGE=$(git log -n 1 --pretty=format:%s $COMMIT_SHA)" >> $GITHUB_ENV
84
85
86
+ # Most changed packages are determined in job_build via Nx
87
+ # However, for profiling-node we only want to run certain things when in this specific package
88
+ # something changed, not in any of the dependencies (which include core, utils, ...)
85
89
- name : Determine changed packages
86
90
87
91
id : changed
88
92
with :
89
93
filters : |
90
- workflow: &workflow
94
+ workflow:
91
95
- '.github/**'
92
- shared: &shared
93
- - *workflow
94
- - '*.{js,ts,json,yml,lock}'
95
- - 'CHANGELOG.md'
96
- - 'jest/**'
97
- - 'scripts/**'
98
- - 'packages/core/**'
99
- - 'packages/rollup-utils/**'
100
- - 'packages/utils/**'
101
- - 'packages/types/**'
102
- - 'dev-packages/test-utils/**'
103
- browser: &browser
104
- - *shared
105
- - 'packages/browser/**'
106
- - 'packages/browser-utils/**'
107
- - 'packages/replay-internal/**'
108
- - 'packages/replay-worker/**'
109
- - 'packages/replay-canvas/**'
110
- - 'packages/feedback/**'
111
- - 'packages/wasm/**'
112
- node: &node
113
- - *shared
114
- - 'packages/node/**'
115
- - 'packages/opentelemetry/**'
116
- browser_integration:
117
- - *shared
118
- - *browser
119
- - 'dev-packages/browser-integration-tests/**'
120
- ember:
121
- - *shared
122
- - *browser
123
- - 'packages/ember/**'
124
- node_integration:
125
- - *shared
126
- - *node
127
- - 'dev-packages/node-integration-tests/**'
128
- - 'packages/nestjs/**'
129
- nextjs:
130
- - *shared
131
- - *browser
132
- - *node
133
- - 'packages/nextjs/**'
134
- - 'packages/react/**'
135
- - 'packages/vercel-edge/**'
136
- remix:
137
- - *shared
138
- - *browser
139
- - *node
140
- - 'packages/remix/**'
141
- - 'packages/react/**'
142
96
profiling_node:
143
- - *shared
144
- - 'packages/node/**'
145
- - 'packages/profiling-node/**'
146
- - 'dev-packages/e2e-tests/test-applications/node-profiling/**'
147
- profiling_node_bindings:
148
97
- 'packages/profiling-node/**'
149
98
- 'dev-packages/e2e-tests/test-applications/node-profiling/**'
150
- deno:
151
- - *shared
152
- - 'packages/deno/**'
153
- bun:
154
- - *shared
155
- - 'packages/bun/**'
156
- any_code:
157
- - '!**/*.md'
99
+
158
100
159
101
- name : Get PR labels
160
102
id : pr-labels
161
103
uses : mydea/pr-labels-action@fn/bump-node20
162
104
163
105
outputs :
164
106
commit_label : ' ${{ env.COMMIT_SHA }}: ${{ env.COMMIT_MESSAGE }}'
165
- changed_nextjs : ${{ steps.changed.outputs.nextjs }}
166
- changed_ember : ${{ steps.changed.outputs.ember }}
167
- changed_remix : ${{ steps.changed.outputs.remix }}
168
- changed_node : ${{ steps.changed.outputs.node }}
169
- changed_node_integration : ${{ steps.changed.outputs.node_integration }}
170
- changed_profiling_node : ${{ steps.changed.outputs.profiling_node }}
171
- changed_profiling_node_bindings : ${{ steps.changed.outputs.profiling_node_bindings }}
172
- changed_deno : ${{ steps.changed.outputs.deno }}
173
- changed_bun : ${{ steps.changed.outputs.bun }}
174
- changed_browser : ${{ steps.changed.outputs.browser }}
175
- changed_browser_integration : ${{ steps.changed.outputs.browser_integration }}
176
- changed_any_code : ${{ steps.changed.outputs.any_code }}
177
107
# Note: These next three have to be checked as strings ('true'/'false')!
178
108
is_develop : ${{ github.ref == 'refs/heads/develop' }}
179
109
is_release : ${{ startsWith(github.ref, 'refs/heads/release/') }}
110
+ changed_profiling_node : ${{ steps.changed.outputs.profiling_node == 'true' }}
111
+ changed_ci : ${{ steps.changed.outputs.workflow == 'true' }}
180
112
# When merging into master, or from master
181
113
is_gitflow_sync : ${{ github.head_ref == 'master' || github.ref == 'refs/heads/master' }}
182
114
has_gitflow_label :
@@ -185,22 +117,30 @@ jobs:
185
117
${{ github.event_name == 'schedule' || (github.event_name == 'pull_request' &&
186
118
contains(steps.pr-labels.outputs.labels, ' ci-skip-cache ')) }}
187
119
188
- job_install_deps :
189
- name : Install Dependencies
120
+ job_build :
121
+ name : Build
190
122
needs : job_get_metadata
191
123
runs-on : ubuntu-20.04
192
124
timeout-minutes : 15
193
125
if : |
194
126
(needs.job_get_metadata.outputs.is_gitflow_sync == 'false' && needs.job_get_metadata.outputs.has_gitflow_label == 'false')
195
127
steps :
128
+ - name : Check out base commit (${{ github.event.pull_request.base.sha }})
129
+ uses : actions/checkout@v4
130
+ if : github.event_name == 'pull_request'
131
+ with :
132
+ ref : ${{ github.event.pull_request.base.sha }}
133
+
196
134
- name : ' Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})'
197
135
uses : actions/checkout@v4
198
136
with :
199
137
ref : ${{ env.HEAD_COMMIT }}
138
+
200
139
- name : Set up Node
201
140
uses : actions/setup-node@v4
202
141
with :
203
142
node-version-file : ' package.json'
143
+
204
144
# we use a hash of yarn.lock as our cache key, because if it hasn't changed, our dependencies haven't changed,
205
145
# so no need to reinstall them
206
146
- name : Compute dependency cache key
@@ -217,46 +157,14 @@ jobs:
217
157
- name : Install dependencies
218
158
if : steps.cache_dependencies.outputs.cache-hit != 'true'
219
159
run : yarn install --ignore-engines --frozen-lockfile
220
- outputs :
221
- dependency_cache_key : ${{ steps.compute_lockfile_hash.outputs.hash }}
222
-
223
- job_check_branches :
224
- name : Check PR branches
225
- needs : job_get_metadata
226
- runs-on : ubuntu-20.04
227
- if : github.event_name == 'pull_request'
228
- permissions :
229
- pull-requests : write
230
- steps :
231
- - name : PR is opened against master
232
- uses : mshick/add-pr-comment@dd126dd8c253650d181ad9538d8b4fa218fc31e8
233
- if : ${{ github.base_ref == 'master' && !startsWith(github.head_ref, 'prepare-release/') }}
234
- with :
235
- message : |
236
- ⚠️ This PR is opened against **master**. You probably want to open it against **develop**.
237
160
238
- job_build :
239
- name : Build
240
- needs : [job_get_metadata, job_install_deps]
241
- runs-on : ubuntu-20.04-large-js
242
- timeout-minutes : 30
243
- if : |
244
- (needs.job_get_metadata.outputs.changed_any_code == 'true' || github.event_name != 'pull_request')
245
- steps :
246
- - name : Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
247
- uses : actions/checkout@v4
248
- with :
249
- ref : ${{ env.HEAD_COMMIT }}
250
- - name : Set up Node
251
- uses : actions/setup-node@v4
252
- with :
253
- node-version-file : ' package.json'
254
- - name : Check dependency cache
255
- uses : actions/cache/restore@v4
161
+ - name : Check for Affected Nx Projects
162
+
163
+ id : checkForAffected
164
+ if : github.event_name == 'pull_request'
256
165
with :
257
- path : ${{ env.CACHED_DEPENDENCY_PATHS }}
258
- key : ${{ needs.job_install_deps.outputs.dependency_cache_key }}
259
- fail-on-cache-miss : true
166
+ base : ${{ github.event.pull_request.base.sha }}
167
+ head : ${{ env.HEAD_COMMIT }}
260
168
261
169
- name : Check build cache
262
170
uses : actions/cache@v4
@@ -285,10 +193,31 @@ jobs:
285
193
env :
286
194
CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
287
195
run : yarn build
196
+
288
197
outputs :
289
- # this needs to be passed on, because the `needs` context only looks at direct ancestors (so steps which depend on
290
- # `job_build` can't see `job_install_deps` and what it returned)
291
- dependency_cache_key : ${{ needs.job_install_deps.outputs.dependency_cache_key }}
198
+ dependency_cache_key : ${{ steps.compute_lockfile_hash.outputs.hash }}
199
+ changed_node_integration : ${{ needs.job_get_metadata.outputs.changed_ci == 'true' || contains(steps.checkForAffected.outputs.affected, '@sentry-internal/node-integration-tests') }}
200
+ changed_remix : ${{ needs.job_get_metadata.outputs.changed_ci == 'true' || contains(steps.checkForAffected.outputs.affected, '@sentry/remix') }}
201
+ changed_node : ${{ needs.job_get_metadata.outputs.changed_ci == 'true' || contains(steps.checkForAffected.outputs.affected, '@sentry/node') }}
202
+ changed_deno : ${{ needs.job_get_metadata.outputs.changed_ci == 'true' || contains(steps.checkForAffected.outputs.affected, '@sentry/deno') }}
203
+ changed_bun : ${{ needs.job_get_metadata.outputs.changed_ci == 'true' || contains(steps.checkForAffected.outputs.affected, '@sentry/bun') }}
204
+ changed_browser_integration : ${{ needs.job_get_metadata.outputs.changed_ci == 'true' || contains(steps.checkForAffected.outputs.affected, '@sentry-internal/browser-integration-tests') }}
205
+ # If you are looking for changed_profiling_node, this is defined in job_get_metadata
206
+
207
+ job_check_branches :
208
+ name : Check PR branches
209
+ needs : job_get_metadata
210
+ runs-on : ubuntu-20.04
211
+ if : github.event_name == 'pull_request'
212
+ permissions :
213
+ pull-requests : write
214
+ steps :
215
+ - name : PR is opened against master
216
+ uses : mshick/add-pr-comment@dd126dd8c253650d181ad9538d8b4fa218fc31e8
217
+ if : ${{ github.base_ref == 'master' && !startsWith(github.head_ref, 'prepare-release/') }}
218
+ with :
219
+ message : |
220
+ ⚠️ This PR is opened against **master**. You probably want to open it against **develop**.
292
221
293
222
job_size_check :
294
223
name : Size Check
@@ -345,7 +274,7 @@ jobs:
345
274
346
275
job_check_format :
347
276
name : Check file formatting
348
- needs : [job_get_metadata, job_install_deps ]
277
+ needs : [job_get_metadata, job_build ]
349
278
timeout-minutes : 10
350
279
runs-on : ubuntu-20.04
351
280
steps :
@@ -361,7 +290,7 @@ jobs:
361
290
uses : actions/cache/restore@v4
362
291
with :
363
292
path : ${{ env.CACHED_DEPENDENCY_PATHS }}
364
- key : ${{ needs.job_install_deps .outputs.dependency_cache_key }}
293
+ key : ${{ needs.job_build .outputs.dependency_cache_key }}
365
294
fail-on-cache-miss : true
366
295
- name : Check file formatting
367
296
run : yarn lint:prettier && yarn lint:biome
@@ -437,6 +366,7 @@ jobs:
437
366
steps :
438
367
- name : Check out base commit (${{ github.event.pull_request.base.sha }})
439
368
uses : actions/checkout@v4
369
+ if : github.event_name == 'pull_request'
440
370
with :
441
371
ref : ${{ github.event.pull_request.base.sha }}
442
372
@@ -469,7 +399,7 @@ jobs:
469
399
job_bun_unit_tests :
470
400
name : Bun Unit Tests
471
401
needs : [job_get_metadata, job_build]
472
- if : needs.job_get_metadata .outputs.changed_bun == 'true' || github.event_name != 'pull_request'
402
+ if : needs.job_build .outputs.changed_bun == 'true' || github.event_name != 'pull_request'
473
403
timeout-minutes : 10
474
404
runs-on : ubuntu-20.04
475
405
strategy :
@@ -496,7 +426,7 @@ jobs:
496
426
job_deno_unit_tests :
497
427
name : Deno Unit Tests
498
428
needs : [job_get_metadata, job_build]
499
- if : needs.job_get_metadata .outputs.changed_deno == 'true' || github.event_name != 'pull_request'
429
+ if : needs.job_build .outputs.changed_deno == 'true' || github.event_name != 'pull_request'
500
430
timeout-minutes : 10
501
431
runs-on : ubuntu-20.04
502
432
strategy :
@@ -536,6 +466,7 @@ jobs:
536
466
steps :
537
467
- name : Check out base commit (${{ github.event.pull_request.base.sha }})
538
468
uses : actions/checkout@v4
469
+ if : github.event_name == 'pull_request'
539
470
with :
540
471
ref : ${{ github.event.pull_request.base.sha }}
541
472
- name : Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
@@ -571,7 +502,7 @@ jobs:
571
502
job_profiling_node_unit_tests :
572
503
name : Node Profiling Unit Tests
573
504
needs : [job_get_metadata, job_build]
574
- if : needs.job_get_metadata .outputs.changed_node == 'true' || needs.job_get_metadata.outputs.changed_profiling_node == 'true' || github.event_name != 'pull_request'
505
+ if : needs.job_build .outputs.changed_node == 'true' || needs.job_get_metadata.outputs.changed_profiling_node == 'true' || github.event_name != 'pull_request'
575
506
runs-on : ubuntu-latest
576
507
timeout-minutes : 10
577
508
steps :
@@ -599,7 +530,7 @@ jobs:
599
530
job_browser_playwright_tests :
600
531
name : Playwright (${{ matrix.bundle }}${{ matrix.shard && format(' {0}/{1}', matrix.shard, matrix.shards) || ''}}) Tests
601
532
needs : [job_get_metadata, job_build]
602
- if : needs.job_get_metadata .outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
533
+ if : needs.job_build .outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
603
534
runs-on : ubuntu-20.04-large-js
604
535
timeout-minutes : 25
605
536
strategy :
@@ -674,11 +605,10 @@ jobs:
674
605
name : playwright-traces
675
606
path : dev-packages/browser-integration-tests/test-results
676
607
677
-
678
608
job_browser_loader_tests :
679
609
name : Playwright Loader (${{ matrix.bundle }}) Tests
680
610
needs : [job_get_metadata, job_build]
681
- if : needs.job_get_metadata .outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
611
+ if : needs.job_build .outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
682
612
runs-on : ubuntu-20.04
683
613
timeout-minutes : 15
684
614
strategy :
@@ -748,13 +678,12 @@ jobs:
748
678
exit 1
749
679
fi
750
680
751
-
752
681
job_node_integration_tests :
753
682
name :
754
683
Node (${{ matrix.node }})${{ (matrix.typescript && format(' (TS {0})', matrix.typescript)) || '' }} Integration
755
684
Tests
756
685
needs : [job_get_metadata, job_build]
757
- if : needs.job_get_metadata .outputs.changed_node_integration == 'true' || github.event_name != 'pull_request'
686
+ if : needs.job_build .outputs.changed_node_integration == 'true' || github.event_name != 'pull_request'
758
687
runs-on : ubuntu-20.04
759
688
timeout-minutes : 15
760
689
strategy :
@@ -796,7 +725,7 @@ jobs:
796
725
job_remix_integration_tests :
797
726
name : Remix v${{ matrix.remix }} (Node ${{ matrix.node }}) Tests
798
727
needs : [job_get_metadata, job_build]
799
- if : needs.job_get_metadata .outputs.changed_remix == 'true' || github.event_name != 'pull_request'
728
+ if : needs.job_build .outputs.changed_remix == 'true' || github.event_name != 'pull_request'
800
729
runs-on : ubuntu-20.04
801
730
timeout-minutes : 10
802
731
strategy :
@@ -866,14 +795,14 @@ jobs:
866
795
# Rebuild profiling by compiling TS and pull the precompiled binary artifacts
867
796
- name : Build Profiling Node
868
797
if : |
869
- (needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
798
+ (needs.job_get_metadata.outputs.changed_profiling_node == 'true') ||
870
799
(needs.job_get_metadata.outputs.is_release == 'true') ||
871
800
(github.event_name != 'pull_request')
872
801
run : yarn lerna run build:lib --scope @sentry/profiling-node
873
802
874
803
- name : Extract Profiling Node Prebuilt Binaries
875
804
if : |
876
- (needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
805
+ (needs.job_get_metadata.outputs.changed_profiling_node == 'true') ||
877
806
(needs.job_get_metadata.outputs.is_release == 'true') ||
878
807
(github.event_name != 'pull_request')
879
808
uses : actions/download-artifact@v4
@@ -1167,7 +1096,7 @@ jobs:
1167
1096
always() && needs.job_e2e_prepare.result == 'success' &&
1168
1097
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) &&
1169
1098
(
1170
- (needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
1099
+ (needs.job_get_metadata.outputs.changed_profiling_node == 'true') ||
1171
1100
(needs.job_get_metadata.outputs.is_release == 'true') ||
1172
1101
(github.event_name != 'pull_request')
1173
1102
)
@@ -1320,11 +1249,11 @@ jobs:
1320
1249
1321
1250
job_compile_bindings_profiling_node :
1322
1251
name : Compile & Test Profiling Bindings (v${{ matrix.node }}) ${{ matrix.target_platform || matrix.os }}, ${{ matrix.node || matrix.container }}, ${{ matrix.arch || matrix.container }}, ${{ contains(matrix.container, 'alpine') && 'musl' || 'glibc' }}
1323
- needs : [job_get_metadata, job_install_deps, job_build]
1252
+ needs : [job_get_metadata, job_build]
1324
1253
# Compiling bindings can be very slow (especially on windows), so only run precompile
1325
1254
# Skip precompile unless we are on a release branch as precompile slows down CI times.
1326
1255
if : |
1327
- (needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
1256
+ (needs.job_get_metadata.outputs.changed_profiling_node == 'true') ||
1328
1257
(needs.job_get_metadata.outputs.is_release == 'true') ||
1329
1258
(github.event_name != 'pull_request')
1330
1259
runs-on : ${{ matrix.os }}
@@ -1481,7 +1410,7 @@ jobs:
1481
1410
id : restore-dependencies
1482
1411
with :
1483
1412
path : ${{ env.CACHED_DEPENDENCY_PATHS }}
1484
- key : ${{ needs.job_install_deps .outputs.dependency_cache_key }}
1413
+ key : ${{ needs.job_build .outputs.dependency_cache_key }}
1485
1414
enableCrossOsArchive : true
1486
1415
1487
1416
- name : Restore build cache
0 commit comments