74
74
# We need to check out not only the fake merge commit between the PR and the base branch which GH creates, but
75
75
# also its parents, so that we can pull the commit message from the head commit of the PR
76
76
fetch-depth : 2
77
+
77
78
- name : Get metadata
78
79
id : get_metadata
79
80
# We need to try a number of different options for finding the head commit, because each kind of trigger event
@@ -83,101 +84,28 @@ jobs:
83
84
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV
84
85
echo "COMMIT_MESSAGE=$(git log -n 1 --pretty=format:%s $COMMIT_SHA)" >> $GITHUB_ENV
85
86
87
+ # Most changed packages are determined in job_build via Nx
88
+ # However, for profiling-node we only want to run certain things when in this specific package
89
+ # something changed, not in any of the dependencies (which include core, utils, ...)
86
90
- name : Determine changed packages
87
91
88
92
id : changed
89
93
with :
90
94
filters : |
91
- workflow: &workflow
92
- - '.github/**'
93
- shared: &shared
94
- - *workflow
95
- - '*.{js,ts,json,yml,lock}'
96
- - 'CHANGELOG.md'
97
- - 'jest/**'
98
- - 'scripts/**'
99
- - 'packages/core/**'
100
- - 'packages/rollup-utils/**'
101
- - 'packages/utils/**'
102
- - 'packages/types/**'
103
- - 'dev-packages/test-utils/**'
104
- browser: &browser
105
- - *shared
106
- - 'packages/browser/**'
107
- - 'packages/browser-utils/**'
108
- - 'packages/replay-internal/**'
109
- - 'packages/replay-worker/**'
110
- - 'packages/replay-canvas/**'
111
- - 'packages/feedback/**'
112
- - 'packages/wasm/**'
113
- node: &node
114
- - *shared
115
- - 'packages/node/**'
116
- - 'packages/opentelemetry/**'
117
- browser_integration:
118
- - *shared
119
- - *browser
120
- - 'dev-packages/browser-integration-tests/**'
121
- ember:
122
- - *shared
123
- - *browser
124
- - 'packages/ember/**'
125
- node_integration:
126
- - *shared
127
- - *node
128
- - 'dev-packages/node-integration-tests/**'
129
- - 'packages/nestjs/**'
130
- nextjs:
131
- - *shared
132
- - *browser
133
- - *node
134
- - 'packages/nextjs/**'
135
- - 'packages/react/**'
136
- - 'packages/vercel-edge/**'
137
- remix:
138
- - *shared
139
- - *browser
140
- - *node
141
- - 'packages/remix/**'
142
- - 'packages/react/**'
143
95
profiling_node:
144
- - *shared
145
- - 'packages/node/**'
146
- - 'packages/profiling-node/**'
147
- - 'dev-packages/e2e-tests/test-applications/node-profiling/**'
148
- profiling_node_bindings:
149
96
- 'packages/profiling-node/**'
150
97
- 'dev-packages/e2e-tests/test-applications/node-profiling/**'
151
- deno:
152
- - *shared
153
- - 'packages/deno/**'
154
- bun:
155
- - *shared
156
- - 'packages/bun/**'
157
- any_code:
158
- - '!**/*.md'
159
98
160
99
- name : Get PR labels
161
100
id : pr-labels
162
101
uses : mydea/pr-labels-action@fn/bump-node20
163
102
164
103
outputs :
165
104
commit_label : ' ${{ env.COMMIT_SHA }}: ${{ env.COMMIT_MESSAGE }}'
166
- changed_nextjs : ${{ steps.changed.outputs.nextjs }}
167
- changed_ember : ${{ steps.changed.outputs.ember }}
168
- changed_remix : ${{ steps.changed.outputs.remix }}
169
- changed_node : ${{ steps.changed.outputs.node }}
170
- changed_node_integration : ${{ steps.changed.outputs.node_integration }}
171
- changed_profiling_node : ${{ steps.changed.outputs.profiling_node }}
172
- changed_profiling_node_bindings : ${{ steps.changed.outputs.profiling_node_bindings }}
173
- changed_deno : ${{ steps.changed.outputs.deno }}
174
- changed_bun : ${{ steps.changed.outputs.bun }}
175
- changed_browser : ${{ steps.changed.outputs.browser }}
176
- changed_browser_integration : ${{ steps.changed.outputs.browser_integration }}
177
- changed_any_code : ${{ steps.changed.outputs.any_code }}
178
105
# Note: These next three have to be checked as strings ('true'/'false')!
179
106
is_develop : ${{ github.ref == 'refs/heads/develop' }}
180
107
is_release : ${{ startsWith(github.ref, 'refs/heads/release/') }}
108
+ changed_profiling_node : ${{ steps.changed.outputs.profiling_node == 'true' }}
181
109
# When merging into master, or from master
182
110
is_gitflow_sync : ${{ github.head_ref == 'master' || github.ref == 'refs/heads/master' }}
183
111
has_gitflow_label :
@@ -186,22 +114,31 @@ jobs:
186
114
${{ github.event_name == 'schedule' || (github.event_name == 'pull_request' &&
187
115
contains(steps.pr-labels.outputs.labels, ' ci-skip-cache ')) }}
188
116
189
- job_install_deps :
190
- name : Install Dependencies
117
+ job_build :
118
+ name : Build
191
119
needs : job_get_metadata
192
120
runs-on : ubuntu-20.04
193
121
timeout-minutes : 15
194
122
if : |
195
123
(needs.job_get_metadata.outputs.is_gitflow_sync == 'false' && needs.job_get_metadata.outputs.has_gitflow_label == 'false')
196
124
steps :
125
+ - name : Check out base commit (${{ github.event.pull_request.base.sha }})
126
+ uses : actions/checkout@v4
127
+ if : github.event_name == 'pull_request'
128
+ with :
129
+ ref : ${{ github.event.pull_request.base.sha }}
130
+
197
131
- name : ' Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})'
198
132
uses : actions/checkout@v4
199
133
with :
200
134
ref : ${{ env.HEAD_COMMIT }}
135
+
201
136
- name : Set up Node
202
137
uses : actions/setup-node@v4
203
138
with :
204
139
node-version-file : ' package.json'
140
+ cache : ' yarn'
141
+
205
142
# we use a hash of yarn.lock as our cache key, because if it hasn't changed, our dependencies haven't changed,
206
143
# so no need to reinstall them
207
144
- name : Compute dependency cache key
@@ -218,46 +155,14 @@ jobs:
218
155
- name : Install dependencies
219
156
if : steps.cache_dependencies.outputs.cache-hit != 'true'
220
157
run : yarn install --ignore-engines --frozen-lockfile
221
- outputs :
222
- dependency_cache_key : ${{ steps.compute_lockfile_hash.outputs.hash }}
223
158
224
- job_check_branches :
225
- name : Check PR branches
226
- needs : job_get_metadata
227
- runs-on : ubuntu-20.04
228
- if : github.event_name == 'pull_request'
229
- permissions :
230
- pull-requests : write
231
- steps :
232
- - name : PR is opened against master
233
- uses : mshick/add-pr-comment@dd126dd8c253650d181ad9538d8b4fa218fc31e8
234
- if : ${{ github.base_ref == 'master' && !startsWith(github.head_ref, 'prepare-release/') }}
235
- with :
236
- message : |
237
- ⚠️ This PR is opened against **master**. You probably want to open it against **develop**.
238
-
239
- job_build :
240
- name : Build
241
- needs : [job_get_metadata, job_install_deps]
242
- runs-on : ubuntu-20.04-large-js
243
- timeout-minutes : 30
244
- if : |
245
- (needs.job_get_metadata.outputs.changed_any_code == 'true' || github.event_name != 'pull_request')
246
- steps :
247
- - name : Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
248
- uses : actions/checkout@v4
249
- with :
250
- ref : ${{ env.HEAD_COMMIT }}
251
- - name : Set up Node
252
- uses : actions/setup-node@v4
253
- with :
254
- node-version-file : ' package.json'
255
- - name : Check dependency cache
256
- uses : actions/cache/restore@v4
159
+ - name : Check for Affected Nx Projects
160
+
161
+ id : checkForAffected
162
+ if : github.event_name == 'pull_request'
257
163
with :
258
- path : ${{ env.CACHED_DEPENDENCY_PATHS }}
259
- key : ${{ needs.job_install_deps.outputs.dependency_cache_key }}
260
- fail-on-cache-miss : true
164
+ base : ${{ github.event.pull_request.base.sha }}
165
+ head : ${{ env.HEAD_COMMIT }}
261
166
262
167
- name : Check build cache
263
168
uses : actions/cache@v4
@@ -286,10 +191,31 @@ jobs:
286
191
env :
287
192
CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
288
193
run : yarn build
194
+
289
195
outputs :
290
- # this needs to be passed on, because the `needs` context only looks at direct ancestors (so steps which depend on
291
- # `job_build` can't see `job_install_deps` and what it returned)
292
- dependency_cache_key : ${{ needs.job_install_deps.outputs.dependency_cache_key }}
196
+ dependency_cache_key : ${{ steps.compute_lockfile_hash.outputs.hash }}
197
+ changed_node_integration : ${{ contains(steps.checkForAffected.outputs.affected, '@sentry-internal/node-integration-tests') }}
198
+ changed_remix : ${{ contains(steps.checkForAffected.outputs.affected, '@sentry/remix') }}
199
+ changed_node : ${{ contains(steps.checkForAffected.outputs.affected, '@sentry/node') }}
200
+ changed_deno : ${{ contains(steps.checkForAffected.outputs.affected, '@sentry/deno') }}
201
+ changed_bun : ${{ contains(steps.checkForAffected.outputs.affected, '@sentry/bun') }}
202
+ changed_browser_integration : ${{ contains(steps.checkForAffected.outputs.affected, '@sentry-internal/browser-integration-tests') }}
203
+ # If you are looking for changed_profiling_node, this is defined in job_get_metadata
204
+
205
+ job_check_branches :
206
+ name : Check PR branches
207
+ needs : job_get_metadata
208
+ runs-on : ubuntu-20.04
209
+ if : github.event_name == 'pull_request'
210
+ permissions :
211
+ pull-requests : write
212
+ steps :
213
+ - name : PR is opened against master
214
+ uses : mshick/add-pr-comment@dd126dd8c253650d181ad9538d8b4fa218fc31e8
215
+ if : ${{ github.base_ref == 'master' && !startsWith(github.head_ref, 'prepare-release/') }}
216
+ with :
217
+ message : |
218
+ ⚠️ This PR is opened against **master**. You probably want to open it against **develop**.
293
219
294
220
job_size_check :
295
221
name : Size Check
@@ -346,7 +272,7 @@ jobs:
346
272
347
273
job_check_format :
348
274
name : Check file formatting
349
- needs : [job_get_metadata, job_install_deps ]
275
+ needs : [job_get_metadata, job_build ]
350
276
timeout-minutes : 10
351
277
runs-on : ubuntu-20.04
352
278
steps :
@@ -362,7 +288,7 @@ jobs:
362
288
uses : actions/cache/restore@v4
363
289
with :
364
290
path : ${{ env.CACHED_DEPENDENCY_PATHS }}
365
- key : ${{ needs.job_install_deps .outputs.dependency_cache_key }}
291
+ key : ${{ needs.job_build .outputs.dependency_cache_key }}
366
292
fail-on-cache-miss : true
367
293
- name : Check file formatting
368
294
run : yarn lint:prettier && yarn lint:biome
@@ -437,6 +363,7 @@ jobs:
437
363
steps :
438
364
- name : Check out base commit (${{ github.event.pull_request.base.sha }})
439
365
uses : actions/checkout@v4
366
+ if : github.event_name == 'pull_request'
440
367
with :
441
368
ref : ${{ github.event.pull_request.base.sha }}
442
369
@@ -469,7 +396,7 @@ jobs:
469
396
job_bun_unit_tests :
470
397
name : Bun Unit Tests
471
398
needs : [job_get_metadata, job_build]
472
- if : needs.job_get_metadata .outputs.changed_bun == 'true' || github.event_name != 'pull_request'
399
+ if : needs.job_build .outputs.changed_bun == 'true' || github.event_name != 'pull_request'
473
400
timeout-minutes : 10
474
401
runs-on : ubuntu-20.04
475
402
strategy :
@@ -496,7 +423,7 @@ jobs:
496
423
job_deno_unit_tests :
497
424
name : Deno Unit Tests
498
425
needs : [job_get_metadata, job_build]
499
- if : needs.job_get_metadata .outputs.changed_deno == 'true' || github.event_name != 'pull_request'
426
+ if : needs.job_build .outputs.changed_deno == 'true' || github.event_name != 'pull_request'
500
427
timeout-minutes : 10
501
428
runs-on : ubuntu-20.04
502
429
strategy :
@@ -536,6 +463,7 @@ jobs:
536
463
steps :
537
464
- name : Check out base commit (${{ github.event.pull_request.base.sha }})
538
465
uses : actions/checkout@v4
466
+ if : github.event_name == 'pull_request'
539
467
with :
540
468
ref : ${{ github.event.pull_request.base.sha }}
541
469
- name : Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
@@ -571,7 +499,7 @@ jobs:
571
499
job_profiling_node_unit_tests :
572
500
name : Node Profiling Unit Tests
573
501
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'
502
+ if : needs.job_build .outputs.changed_node == 'true' || needs.job_get_metadata.outputs.changed_profiling_node == 'true' || github.event_name != 'pull_request'
575
503
runs-on : ubuntu-latest
576
504
timeout-minutes : 10
577
505
steps :
@@ -599,7 +527,7 @@ jobs:
599
527
job_browser_playwright_tests :
600
528
name : Playwright (${{ matrix.bundle }}${{ matrix.shard && format(' {0}/{1}', matrix.shard, matrix.shards) || ''}}) Tests
601
529
needs : [job_get_metadata, job_build]
602
- if : needs.job_get_metadata .outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
530
+ if : needs.job_build .outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
603
531
runs-on : ubuntu-20.04-large-js
604
532
timeout-minutes : 25
605
533
strategy :
@@ -690,11 +618,10 @@ jobs:
690
618
name : playwright-traces
691
619
path : dev-packages/browser-integration-tests/test-results
692
620
693
-
694
621
job_browser_loader_tests :
695
622
name : Playwright Loader (${{ matrix.bundle }}) Tests
696
623
needs : [job_get_metadata, job_build]
697
- if : needs.job_get_metadata .outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
624
+ if : needs.job_build .outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
698
625
runs-on : ubuntu-20.04
699
626
timeout-minutes : 15
700
627
strategy :
@@ -780,13 +707,12 @@ jobs:
780
707
exit 1
781
708
fi
782
709
783
-
784
710
job_node_integration_tests :
785
711
name :
786
712
Node (${{ matrix.node }})${{ (matrix.typescript && format(' (TS {0})', matrix.typescript)) || '' }} Integration
787
713
Tests
788
714
needs : [job_get_metadata, job_build]
789
- if : needs.job_get_metadata .outputs.changed_node_integration == 'true' || github.event_name != 'pull_request'
715
+ if : needs.job_build .outputs.changed_node_integration == 'true' || github.event_name != 'pull_request'
790
716
runs-on : ubuntu-20.04
791
717
timeout-minutes : 15
792
718
strategy :
@@ -828,7 +754,7 @@ jobs:
828
754
job_remix_integration_tests :
829
755
name : Remix v${{ matrix.remix }} (Node ${{ matrix.node }}) Tests
830
756
needs : [job_get_metadata, job_build]
831
- if : needs.job_get_metadata .outputs.changed_remix == 'true' || github.event_name != 'pull_request'
757
+ if : needs.job_build .outputs.changed_remix == 'true' || github.event_name != 'pull_request'
832
758
runs-on : ubuntu-20.04
833
759
timeout-minutes : 10
834
760
strategy :
@@ -896,7 +822,7 @@ jobs:
896
822
# Rebuild profiling by compiling TS and pull the precompiled binary artifacts
897
823
- name : Build Profiling Node
898
824
if : |
899
- (needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
825
+ (needs.job_get_metadata.outputs.changed_profiling_node == 'true') ||
900
826
(needs.job_get_metadata.outputs.is_release == 'true') ||
901
827
(github.event_name != 'pull_request')
902
828
run : yarn lerna run build:lib --scope @sentry/profiling-node
@@ -905,7 +831,7 @@ jobs:
905
831
# @TODO: v4 breaks convenient merging of same name artifacts
906
832
# https://github.com/actions/upload-artifact/issues/478
907
833
if : |
908
- (needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
834
+ (needs.job_get_metadata.outputs.changed_profiling_node == 'true') ||
909
835
(needs.job_get_metadata.outputs.is_release == 'true') ||
910
836
(github.event_name != 'pull_request')
911
837
uses : actions/download-artifact@v3
@@ -1192,7 +1118,7 @@ jobs:
1192
1118
always() && needs.job_e2e_prepare.result == 'success' &&
1193
1119
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) &&
1194
1120
(
1195
- (needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
1121
+ (needs.job_get_metadata.outputs.changed_profiling_node == 'true') ||
1196
1122
(needs.job_get_metadata.outputs.is_release == 'true') ||
1197
1123
(github.event_name != 'pull_request')
1198
1124
)
@@ -1342,11 +1268,11 @@ jobs:
1342
1268
1343
1269
job_compile_bindings_profiling_node :
1344
1270
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' }}
1345
- needs : [job_get_metadata, job_install_deps, job_build]
1271
+ needs : [job_get_metadata, job_build]
1346
1272
# Compiling bindings can be very slow (especially on windows), so only run precompile
1347
1273
# Skip precompile unless we are on a release branch as precompile slows down CI times.
1348
1274
if : |
1349
- (needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
1275
+ (needs.job_get_metadata.outputs.changed_profiling_node == 'true') ||
1350
1276
(needs.job_get_metadata.outputs.is_release == 'true') ||
1351
1277
(github.event_name != 'pull_request')
1352
1278
runs-on : ${{ matrix.os }}
@@ -1475,7 +1401,7 @@ jobs:
1475
1401
id : restore-dependencies
1476
1402
with :
1477
1403
path : ${{ env.CACHED_DEPENDENCY_PATHS }}
1478
- key : ${{ needs.job_install_deps .outputs.dependency_cache_key }}
1404
+ key : ${{ needs.job_build .outputs.dependency_cache_key }}
1479
1405
enableCrossOsArchive : true
1480
1406
1481
1407
- name : Restore build cache
0 commit comments