Skip to content

Commit 8176f01

Browse files
authored
ci(profiling): run compile only if bindings have changed (#10494)
Mitigates #10486 by skipping compilation unless binaries have changed or we are on release branch
1 parent 94cdd8b commit 8176f01

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ jobs:
137137
- *shared
138138
- 'packages/node/**'
139139
- 'packages/profiling-node/**'
140+
profiling_node_bindings:
141+
- 'packages/profiling-node/bindings/**'
140142
deno:
141143
- *shared
142144
- *browser
@@ -155,6 +157,7 @@ jobs:
155157
changed_remix: ${{ steps.changed.outputs.remix }}
156158
changed_node: ${{ steps.changed.outputs.node }}
157159
changed_profiling_node: ${{ steps.changed.outputs.profiling_node }}
160+
changed_profiling_node_bindings: ${{ steps.changed.outputs.profiling_node_bindings }}
158161
changed_deno: ${{ steps.changed.outputs.deno }}
159162
changed_browser: ${{ steps.changed.outputs.browser }}
160163
changed_browser_integration: ${{ steps.changed.outputs.browser_integration }}
@@ -976,13 +979,20 @@ jobs:
976979
- name: Build tarballs
977980
run: yarn build:tarball --ignore @sentry/profiling-node
978981

979-
# Rebuild profiling by compiling TS and pulling the precompiled binaries
982+
# Rebuild profiling by compiling TS and pull the precompiled binary artifacts
980983
- name: Build Profiling Node
984+
if: |
985+
(needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
986+
(needs.job_get_metadata.outputs.is_release == 'true') ||
987+
(github.event_name != 'pull_request')
981988
run: yarn lerna run build:lib --scope @sentry/profiling-node
982989

983990
- name: Extract Profiling Node Prebuilt Binaries
984991
# @TODO: v4 breaks convenient merging of same name artifacts
985992
# https://github.com/actions/upload-artifact/issues/478
993+
if: |
994+
(needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
995+
(github.event_name != 'pull_request')
986996
uses: actions/download-artifact@v3
987997
with:
988998
name: profiling-node-binaries-${{ github.sha }}
@@ -1086,13 +1096,20 @@ jobs:
10861096
env:
10871097
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
10881098

1089-
# Rebuild profiling by compiling TS and pulling the precompiled binaries
1099+
# Rebuild profiling by compiling TS and pull the precompiled binary artifacts
10901100
- name: Build Profiling Node
1101+
if: |
1102+
(needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
1103+
(needs.job_get_metadata.outputs.is_release == 'true') ||
1104+
(github.event_name != 'pull_request')
10911105
run: yarn lerna run build:lib --scope @sentry/profiling-node
10921106

10931107
- name: Extract Profiling Node Prebuilt Binaries
10941108
# @TODO: v4 breaks convenient merging of same name artifacts
10951109
# https://github.com/actions/upload-artifact/issues/478
1110+
if: |
1111+
(needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
1112+
(github.event_name != 'pull_request')
10961113
uses: actions/download-artifact@v3
10971114
with:
10981115
name: profiling-node-binaries-${{ github.sha }}
@@ -1226,9 +1243,9 @@ jobs:
12261243
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' }}
12271244
needs: [job_get_metadata, job_install_deps, job_build]
12281245
# Compiling bindings can be very slow (especially on windows), so only run precompile
1229-
# if profiling or profiling node package had changed or if we are on a release branch.
1246+
# Skip precompile unless we are on a release branch as precompile slows down CI times.
12301247
if: |
1231-
(needs.job_get_metadata.outputs.changed_profiling_node == 'true') ||
1248+
(needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') ||
12321249
(needs.job_get_metadata.outputs.is_release == 'true') ||
12331250
(github.event_name != 'pull_request')
12341251
runs-on: ${{ matrix.os }}

0 commit comments

Comments
 (0)