Skip to content

Commit

Permalink
ci(profiling): run compile only if bindings have changed (#10494)
Browse files Browse the repository at this point in the history
Mitigates #10486 by
skipping compilation unless binaries have changed or we are on release
branch
  • Loading branch information
JonasBa committed Feb 5, 2024
1 parent 94cdd8b commit 8176f01
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ jobs:
- *shared
- 'packages/node/**'
- 'packages/profiling-node/**'
profiling_node_bindings:
- 'packages/profiling-node/bindings/**'
deno:
- *shared
- *browser
Expand All @@ -155,6 +157,7 @@ jobs:
changed_remix: ${{ steps.changed.outputs.remix }}
changed_node: ${{ steps.changed.outputs.node }}
changed_profiling_node: ${{ steps.changed.outputs.profiling_node }}
changed_profiling_node_bindings: ${{ steps.changed.outputs.profiling_node_bindings }}
changed_deno: ${{ steps.changed.outputs.deno }}
changed_browser: ${{ steps.changed.outputs.browser }}
changed_browser_integration: ${{ steps.changed.outputs.browser_integration }}
Expand Down Expand Up @@ -976,13 +979,20 @@ jobs:
- name: Build tarballs
run: yarn build:tarball --ignore @sentry/profiling-node

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

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

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

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

0 comments on commit 8176f01

Please sign in to comment.