7474 # We need to check out not only the fake merge commit between the PR and the base branch which GH creates, but
7575 # also its parents, so that we can pull the commit message from the head commit of the PR
7676 fetch-depth : 2
77+
7778 - name : Get metadata
7879 id : get_metadata
7980 # 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:
8384 echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV
8485 echo "COMMIT_MESSAGE=$(git log -n 1 --pretty=format:%s $COMMIT_SHA)" >> $GITHUB_ENV
8586
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, ...)
8690 - name : Determine changed packages
87918892 id : changed
8993 with :
9094 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/**'
14395 profiling_node:
144- - *shared
145- - 'packages/node/**'
146- - 'packages/profiling-node/**'
147- - 'dev-packages/e2e-tests/test-applications/node-profiling/**'
148- profiling_node_bindings:
14996 - 'packages/profiling-node/**'
15097 - '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'
15998
16099 - name : Get PR labels
161100 id : pr-labels
162101 uses : mydea/pr-labels-action@fn/bump-node20
163102
164103 outputs :
165104 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 }}
178105 # Note: These next three have to be checked as strings ('true'/'false')!
179106 is_develop : ${{ github.ref == 'refs/heads/develop' }}
180107 is_release : ${{ startsWith(github.ref, 'refs/heads/release/') }}
108+ changed_profiling_node : ${{ steps.changed.outputs.profiling_node == 'true' }}
181109 # When merging into master, or from master
182110 is_gitflow_sync : ${{ github.head_ref == 'master' || github.ref == 'refs/heads/master' }}
183111 has_gitflow_label :
@@ -186,22 +114,31 @@ jobs:
186114 ${{ github.event_name == 'schedule' || (github.event_name == 'pull_request' &&
187115 contains(steps.pr-labels.outputs.labels, ' ci-skip-cache ')) }}
188116
189- job_install_deps :
190- name : Install Dependencies
117+ job_build :
118+ name : Build
191119 needs : job_get_metadata
192120 runs-on : ubuntu-20.04
193121 timeout-minutes : 15
194122 if : |
195123 (needs.job_get_metadata.outputs.is_gitflow_sync == 'false' && needs.job_get_metadata.outputs.has_gitflow_label == 'false')
196124 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+
197131 - name : ' Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})'
198132 uses : actions/checkout@v4
199133 with :
200134 ref : ${{ env.HEAD_COMMIT }}
135+
201136 - name : Set up Node
202137 uses : actions/setup-node@v4
203138 with :
204139 node-version-file : ' package.json'
140+ cache : ' yarn'
141+
205142 # we use a hash of yarn.lock as our cache key, because if it hasn't changed, our dependencies haven't changed,
206143 # so no need to reinstall them
207144 - name : Compute dependency cache key
@@ -218,46 +155,14 @@ jobs:
218155 - name : Install dependencies
219156 if : steps.cache_dependencies.outputs.cache-hit != 'true'
220157 run : yarn install --ignore-engines --frozen-lockfile
221- outputs :
222- dependency_cache_key : ${{ steps.compute_lockfile_hash.outputs.hash }}
223158
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'
257163 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 }}
261166
262167 - name : Check build cache
263168 uses : actions/cache@v4
@@ -286,10 +191,31 @@ jobs:
286191 env :
287192 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
288193 run : yarn build
194+
289195 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**.
293219
294220 job_size_check :
295221 name : Size Check
@@ -346,7 +272,7 @@ jobs:
346272
347273 job_check_format :
348274 name : Check file formatting
349- needs : [job_get_metadata, job_install_deps ]
275+ needs : [job_get_metadata, job_build ]
350276 timeout-minutes : 10
351277 runs-on : ubuntu-20.04
352278 steps :
@@ -362,7 +288,7 @@ jobs:
362288 uses : actions/cache/restore@v4
363289 with :
364290 path : ${{ env.CACHED_DEPENDENCY_PATHS }}
365- key : ${{ needs.job_install_deps .outputs.dependency_cache_key }}
291+ key : ${{ needs.job_build .outputs.dependency_cache_key }}
366292 fail-on-cache-miss : true
367293 - name : Check file formatting
368294 run : yarn lint:prettier && yarn lint:biome
@@ -438,6 +364,7 @@ jobs:
438364 steps :
439365 - name : Check out base commit (${{ github.event.pull_request.base.sha }})
440366 uses : actions/checkout@v4
367+ if : github.event_name == 'pull_request'
441368 with :
442369 ref : ${{ github.event.pull_request.base.sha }}
443370
@@ -470,7 +397,7 @@ jobs:
470397 job_bun_unit_tests :
471398 name : Bun Unit Tests
472399 needs : [job_get_metadata, job_build]
473- if : needs.job_get_metadata .outputs.changed_bun == 'true' || github.event_name != 'pull_request'
400+ if : needs.job_build .outputs.changed_bun == 'true' || github.event_name != 'pull_request'
474401 timeout-minutes : 10
475402 runs-on : ubuntu-20.04
476403 strategy :
@@ -497,7 +424,7 @@ jobs:
497424 job_deno_unit_tests :
498425 name : Deno Unit Tests
499426 needs : [job_get_metadata, job_build]
500- if : needs.job_get_metadata .outputs.changed_deno == 'true' || github.event_name != 'pull_request'
427+ if : needs.job_build .outputs.changed_deno == 'true' || github.event_name != 'pull_request'
501428 timeout-minutes : 10
502429 runs-on : ubuntu-20.04
503430 strategy :
@@ -537,6 +464,7 @@ jobs:
537464 steps :
538465 - name : Check out base commit (${{ github.event.pull_request.base.sha }})
539466 uses : actions/checkout@v4
467+ if : github.event_name == 'pull_request'
540468 with :
541469 ref : ${{ github.event.pull_request.base.sha }}
542470 - name : Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
@@ -572,7 +500,7 @@ jobs:
572500 job_profiling_node_unit_tests :
573501 name : Node Profiling Unit Tests
574502 needs : [job_get_metadata, job_build]
575- if : needs.job_get_metadata .outputs.changed_node == 'true' || needs.job_get_metadata.outputs.changed_profiling_node == 'true' || github.event_name != 'pull_request'
503+ if : needs.job_build .outputs.changed_node == 'true' || needs.job_get_metadata.outputs.changed_profiling_node == 'true' || github.event_name != 'pull_request'
576504 runs-on : ubuntu-latest
577505 timeout-minutes : 10
578506 steps :
@@ -600,7 +528,7 @@ jobs:
600528 job_browser_playwright_tests :
601529 name : Playwright (${{ matrix.bundle }}${{ matrix.shard && format(' {0}/{1}', matrix.shard, matrix.shards) || ''}}) Tests
602530 needs : [job_get_metadata, job_build]
603- if : needs.job_get_metadata .outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
531+ if : needs.job_build .outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
604532 runs-on : ubuntu-20.04-large-js
605533 timeout-minutes : 25
606534 strategy :
@@ -691,11 +619,10 @@ jobs:
691619 name : playwright-traces
692620 path : dev-packages/browser-integration-tests/test-results
693621
694-
695622 job_browser_loader_tests :
696623 name : Playwright Loader (${{ matrix.bundle }}) Tests
697624 needs : [job_get_metadata, job_build]
698- if : needs.job_get_metadata .outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
625+ if : needs.job_build .outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
699626 runs-on : ubuntu-20.04
700627 timeout-minutes : 15
701628 strategy :
@@ -781,13 +708,12 @@ jobs:
781708 exit 1
782709 fi
783710
784-
785711 job_node_integration_tests :
786712 name :
787713 Node (${{ matrix.node }})${{ (matrix.typescript && format(' (TS {0})', matrix.typescript)) || '' }} Integration
788714 Tests
789715 needs : [job_get_metadata, job_build]
790- if : needs.job_get_metadata .outputs.changed_node_integration == 'true' || github.event_name != 'pull_request'
716+ if : needs.job_build .outputs.changed_node_integration == 'true' || github.event_name != 'pull_request'
791717 runs-on : ubuntu-20.04
792718 timeout-minutes : 15
793719 strategy :
@@ -829,7 +755,7 @@ jobs:
829755 job_remix_integration_tests :
830756 name : Remix v${{ matrix.remix }} (Node ${{ matrix.node }}) Tests
831757 needs : [job_get_metadata, job_build]
832- if : needs.job_get_metadata .outputs.changed_remix == 'true' || github.event_name != 'pull_request'
758+ if : needs.job_build .outputs.changed_remix == 'true' || github.event_name != 'pull_request'
833759 runs-on : ubuntu-20.04
834760 timeout-minutes : 10
835761 strategy :
@@ -897,14 +823,14 @@ jobs:
897823 # Rebuild profiling by compiling TS and pull the precompiled binary artifacts
898824 - name : Build Profiling Node
899825 if : |
900- (needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
826+ (needs.job_get_metadata.outputs.changed_profiling_node == 'true') ||
901827 (needs.job_get_metadata.outputs.is_release == 'true') ||
902828 (github.event_name != 'pull_request')
903829 run : yarn lerna run build:lib --scope @sentry/profiling-node
904830
905831 - name : Extract Profiling Node Prebuilt Binaries
906832 if : |
907- (needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
833+ (needs.job_get_metadata.outputs.changed_profiling_node == 'true') ||
908834 (needs.job_get_metadata.outputs.is_release == 'true') ||
909835 (github.event_name != 'pull_request')
910836 uses : actions/download-artifact@v4
@@ -1192,7 +1118,7 @@ jobs:
11921118 always() && needs.job_e2e_prepare.result == 'success' &&
11931119 (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) &&
11941120 (
1195- (needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
1121+ (needs.job_get_metadata.outputs.changed_profiling_node == 'true') ||
11961122 (needs.job_get_metadata.outputs.is_release == 'true') ||
11971123 (github.event_name != 'pull_request')
11981124 )
@@ -1342,11 +1268,11 @@ jobs:
13421268
13431269 job_compile_bindings_profiling_node :
13441270 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]
13461272 # Compiling bindings can be very slow (especially on windows), so only run precompile
13471273 # Skip precompile unless we are on a release branch as precompile slows down CI times.
13481274 if : |
1349- (needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
1275+ (needs.job_get_metadata.outputs.changed_profiling_node == 'true') ||
13501276 (needs.job_get_metadata.outputs.is_release == 'true') ||
13511277 (github.event_name != 'pull_request')
13521278 runs-on : ${{ matrix.os }}
@@ -1503,7 +1429,7 @@ jobs:
15031429 id : restore-dependencies
15041430 with :
15051431 path : ${{ env.CACHED_DEPENDENCY_PATHS }}
1506- key : ${{ needs.job_install_deps .outputs.dependency_cache_key }}
1432+ key : ${{ needs.job_build .outputs.dependency_cache_key }}
15071433 enableCrossOsArchive : true
15081434
15091435 - name : Restore build cache
0 commit comments