7373 # We need to check out not only the fake merge commit between the PR and the base branch which GH creates, but
7474 # also its parents, so that we can pull the commit message from the head commit of the PR
7575 fetch-depth : 2
76+
7677 - name : Get metadata
7778 id : get_metadata
7879 # We need to try a number of different options for finding the head commit, because each kind of trigger event
@@ -82,101 +83,28 @@ jobs:
8283 echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV
8384 echo "COMMIT_MESSAGE=$(git log -n 1 --pretty=format:%s $COMMIT_SHA)" >> $GITHUB_ENV
8485
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, ...)
8589 - name : Determine changed packages
86908791 id : changed
8892 with :
8993 filters : |
90- workflow: &workflow
91- - '.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/**'
14294 profiling_node:
143- - *shared
144- - 'packages/node/**'
145- - 'packages/profiling-node/**'
146- - 'dev-packages/e2e-tests/test-applications/node-profiling/**'
147- profiling_node_bindings:
14895 - 'packages/profiling-node/**'
14996 - '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'
15897
15998 - name : Get PR labels
16099 id : pr-labels
161100 uses : mydea/pr-labels-action@fn/bump-node20
162101
163102 outputs :
164103 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 }}
177104 # Note: These next three have to be checked as strings ('true'/'false')!
178105 is_develop : ${{ github.ref == 'refs/heads/develop' }}
179106 is_release : ${{ startsWith(github.ref, 'refs/heads/release/') }}
107+ changed_profiling_node : ${{ steps.changed.outputs.profiling_node == 'true' }}
180108 # When merging into master, or from master
181109 is_gitflow_sync : ${{ github.head_ref == 'master' || github.ref == 'refs/heads/master' }}
182110 has_gitflow_label :
@@ -185,22 +113,31 @@ jobs:
185113 ${{ github.event_name == 'schedule' || (github.event_name == 'pull_request' &&
186114 contains(steps.pr-labels.outputs.labels, ' ci-skip-cache ')) }}
187115
188- job_install_deps :
189- name : Install Dependencies
116+ job_build :
117+ name : Build
190118 needs : job_get_metadata
191119 runs-on : ubuntu-20.04
192120 timeout-minutes : 15
193121 if : |
194122 (needs.job_get_metadata.outputs.is_gitflow_sync == 'false' && needs.job_get_metadata.outputs.has_gitflow_label == 'false')
195123 steps :
124+ - name : Check out base commit (${{ github.event.pull_request.base.sha }})
125+ uses : actions/checkout@v4
126+ if : github.event_name == 'pull_request'
127+ with :
128+ ref : ${{ github.event.pull_request.base.sha }}
129+
196130 - name : ' Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})'
197131 uses : actions/checkout@v4
198132 with :
199133 ref : ${{ env.HEAD_COMMIT }}
134+
200135 - name : Set up Node
201136 uses : actions/setup-node@v4
202137 with :
203138 node-version-file : ' package.json'
139+ cache : ' yarn'
140+
204141 # we use a hash of yarn.lock as our cache key, because if it hasn't changed, our dependencies haven't changed,
205142 # so no need to reinstall them
206143 - name : Compute dependency cache key
@@ -217,46 +154,14 @@ jobs:
217154 - name : Install dependencies
218155 if : steps.cache_dependencies.outputs.cache-hit != 'true'
219156 run : yarn install --ignore-engines --frozen-lockfile
220- outputs :
221- dependency_cache_key : ${{ steps.compute_lockfile_hash.outputs.hash }}
222157
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-
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
158+ - name : Check for Affected Nx Projects
159+ 160+ id : checkForAffected
161+ if : github.event_name == 'pull_request'
256162 with :
257- path : ${{ env.CACHED_DEPENDENCY_PATHS }}
258- key : ${{ needs.job_install_deps.outputs.dependency_cache_key }}
259- fail-on-cache-miss : true
163+ base : ${{ github.event.pull_request.base.sha }}
164+ head : ${{ env.HEAD_COMMIT }}
260165
261166 - name : Check build cache
262167 uses : actions/cache@v4
@@ -285,10 +190,31 @@ jobs:
285190 env :
286191 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
287192 run : yarn build
193+
288194 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 }}
195+ dependency_cache_key : ${{ steps.compute_lockfile_hash.outputs.hash }}
196+ changed_node_integration : ${{ contains(steps.checkForAffected.outputs.affected, '@sentry-internal/node-integration-tests') }}
197+ changed_remix : ${{ contains(steps.checkForAffected.outputs.affected, '@sentry/remix') }}
198+ changed_node : ${{ contains(steps.checkForAffected.outputs.affected, '@sentry/node') }}
199+ changed_deno : ${{ contains(steps.checkForAffected.outputs.affected, '@sentry/deno') }}
200+ changed_bun : ${{ contains(steps.checkForAffected.outputs.affected, '@sentry/bun') }}
201+ changed_browser_integration : ${{ contains(steps.checkForAffected.outputs.affected, '@sentry-internal/browser-integration-tests') }}
202+ # If you are looking for changed_profiling_node, this is defined in job_get_metadata
203+
204+ job_check_branches :
205+ name : Check PR branches
206+ needs : job_get_metadata
207+ runs-on : ubuntu-20.04
208+ if : github.event_name == 'pull_request'
209+ permissions :
210+ pull-requests : write
211+ steps :
212+ - name : PR is opened against master
213+ uses : mshick/add-pr-comment@dd126dd8c253650d181ad9538d8b4fa218fc31e8
214+ if : ${{ github.base_ref == 'master' && !startsWith(github.head_ref, 'prepare-release/') }}
215+ with :
216+ message : |
217+ ⚠️ This PR is opened against **master**. You probably want to open it against **develop**.
292218
293219 job_size_check :
294220 name : Size Check
@@ -345,7 +271,7 @@ jobs:
345271
346272 job_check_format :
347273 name : Check file formatting
348- needs : [job_get_metadata, job_install_deps ]
274+ needs : [job_get_metadata, job_build ]
349275 timeout-minutes : 10
350276 runs-on : ubuntu-20.04
351277 steps :
@@ -361,7 +287,7 @@ jobs:
361287 uses : actions/cache/restore@v4
362288 with :
363289 path : ${{ env.CACHED_DEPENDENCY_PATHS }}
364- key : ${{ needs.job_install_deps .outputs.dependency_cache_key }}
290+ key : ${{ needs.job_build .outputs.dependency_cache_key }}
365291 fail-on-cache-miss : true
366292 - name : Check file formatting
367293 run : yarn lint:prettier && yarn lint:biome
@@ -437,6 +363,7 @@ jobs:
437363 steps :
438364 - name : Check out base commit (${{ github.event.pull_request.base.sha }})
439365 uses : actions/checkout@v4
366+ if : github.event_name == 'pull_request'
440367 with :
441368 ref : ${{ github.event.pull_request.base.sha }}
442369
@@ -469,7 +396,7 @@ jobs:
469396 job_bun_unit_tests :
470397 name : Bun Unit Tests
471398 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'
473400 timeout-minutes : 10
474401 runs-on : ubuntu-20.04
475402 strategy :
@@ -496,7 +423,7 @@ jobs:
496423 job_deno_unit_tests :
497424 name : Deno Unit Tests
498425 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'
500427 timeout-minutes : 10
501428 runs-on : ubuntu-20.04
502429 strategy :
@@ -536,6 +463,7 @@ jobs:
536463 steps :
537464 - name : Check out base commit (${{ github.event.pull_request.base.sha }})
538465 uses : actions/checkout@v4
466+ if : github.event_name == 'pull_request'
539467 with :
540468 ref : ${{ github.event.pull_request.base.sha }}
541469 - name : Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
@@ -571,7 +499,7 @@ jobs:
571499 job_profiling_node_unit_tests :
572500 name : Node Profiling Unit Tests
573501 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'
575503 runs-on : ubuntu-latest
576504 timeout-minutes : 10
577505 steps :
@@ -599,7 +527,7 @@ jobs:
599527 job_browser_playwright_tests :
600528 name : Playwright (${{ matrix.bundle }}${{ matrix.shard && format(' {0}/{1}', matrix.shard, matrix.shards) || ''}}) Tests
601529 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'
603531 runs-on : ubuntu-20.04-large-js
604532 timeout-minutes : 25
605533 strategy :
@@ -674,11 +602,10 @@ jobs:
674602 name : playwright-traces
675603 path : dev-packages/browser-integration-tests/test-results
676604
677-
678605 job_browser_loader_tests :
679606 name : Playwright Loader (${{ matrix.bundle }}) Tests
680607 needs : [job_get_metadata, job_build]
681- if : needs.job_get_metadata .outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
608+ if : needs.job_build .outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
682609 runs-on : ubuntu-20.04
683610 timeout-minutes : 15
684611 strategy :
@@ -748,13 +675,12 @@ jobs:
748675 exit 1
749676 fi
750677
751-
752678 job_node_integration_tests :
753679 name :
754680 Node (${{ matrix.node }})${{ (matrix.typescript && format(' (TS {0})', matrix.typescript)) || '' }} Integration
755681 Tests
756682 needs : [job_get_metadata, job_build]
757- if : needs.job_get_metadata .outputs.changed_node_integration == 'true' || github.event_name != 'pull_request'
683+ if : needs.job_build .outputs.changed_node_integration == 'true' || github.event_name != 'pull_request'
758684 runs-on : ubuntu-20.04
759685 timeout-minutes : 15
760686 strategy :
@@ -796,7 +722,7 @@ jobs:
796722 job_remix_integration_tests :
797723 name : Remix v${{ matrix.remix }} (Node ${{ matrix.node }}) Tests
798724 needs : [job_get_metadata, job_build]
799- if : needs.job_get_metadata .outputs.changed_remix == 'true' || github.event_name != 'pull_request'
725+ if : needs.job_build .outputs.changed_remix == 'true' || github.event_name != 'pull_request'
800726 runs-on : ubuntu-20.04
801727 timeout-minutes : 10
802728 strategy :
@@ -866,14 +792,14 @@ jobs:
866792 # Rebuild profiling by compiling TS and pull the precompiled binary artifacts
867793 - name : Build Profiling Node
868794 if : |
869- (needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
795+ (needs.job_get_metadata.outputs.changed_profiling_node == 'true') ||
870796 (needs.job_get_metadata.outputs.is_release == 'true') ||
871797 (github.event_name != 'pull_request')
872798 run : yarn lerna run build:lib --scope @sentry/profiling-node
873799
874800 - name : Extract Profiling Node Prebuilt Binaries
875801 if : |
876- (needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
802+ (needs.job_get_metadata.outputs.changed_profiling_node == 'true') ||
877803 (needs.job_get_metadata.outputs.is_release == 'true') ||
878804 (github.event_name != 'pull_request')
879805 uses : actions/download-artifact@v4
@@ -1167,7 +1093,7 @@ jobs:
11671093 always() && needs.job_e2e_prepare.result == 'success' &&
11681094 (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) &&
11691095 (
1170- (needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
1096+ (needs.job_get_metadata.outputs.changed_profiling_node == 'true') ||
11711097 (needs.job_get_metadata.outputs.is_release == 'true') ||
11721098 (github.event_name != 'pull_request')
11731099 )
@@ -1320,11 +1246,11 @@ jobs:
13201246
13211247 job_compile_bindings_profiling_node :
13221248 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]
1249+ needs : [job_get_metadata, job_build]
13241250 # Compiling bindings can be very slow (especially on windows), so only run precompile
13251251 # Skip precompile unless we are on a release branch as precompile slows down CI times.
13261252 if : |
1327- (needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
1253+ (needs.job_get_metadata.outputs.changed_profiling_node == 'true') ||
13281254 (needs.job_get_metadata.outputs.is_release == 'true') ||
13291255 (github.event_name != 'pull_request')
13301256 runs-on : ${{ matrix.os }}
@@ -1481,7 +1407,7 @@ jobs:
14811407 id : restore-dependencies
14821408 with :
14831409 path : ${{ env.CACHED_DEPENDENCY_PATHS }}
1484- key : ${{ needs.job_install_deps .outputs.dependency_cache_key }}
1410+ key : ${{ needs.job_build .outputs.dependency_cache_key }}
14851411 enableCrossOsArchive : true
14861412
14871413 - name : Restore build cache
0 commit comments