From 49ed411c565fffcbe6112f775a7ba18304c1334b Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Mon, 4 Mar 2024 16:12:32 +0000 Subject: [PATCH 1/3] build(profiling-node): Ensure we fail on cache miss & cleanup --- .github/workflows/build.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0dc5bd89c249..3351215f7dd1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -410,7 +410,8 @@ jobs: uses: actions/cache/restore@v4 with: key: ${{ env.BUILD_PROFILING_NODE_CACHE_TARBALL_KEY }} - path: ${{ github.workspace }}/packages/*/*.tgz + path: ${{ github.workspace }}/packages/profiling-node/*.tgz + fail-on-cache-miss: true - name: Archive artifacts uses: actions/upload-artifact@v4 @@ -1014,7 +1015,7 @@ jobs: - name: Stores tarballs in cache uses: actions/cache/save@v4 with: - path: ${{ github.workspace }}/packages/*/*.tgz + path: ${{ github.workspace }}/packages/profiling-node/*.tgz key: ${{ env.BUILD_PROFILING_NODE_CACHE_TARBALL_KEY }} job_e2e_tests: @@ -1107,12 +1108,6 @@ jobs: env: DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }} - - name: Restore tarball cache - uses: actions/cache/restore@v4 - with: - path: ${{ github.workspace }}/packages/*/*.tgz - key: ${{ env.BUILD_PROFILING_NODE_CACHE_TARBALL_KEY }} - - name: Get node version id: versions run: | @@ -1202,13 +1197,13 @@ jobs: with: name: profiling-node-binaries-${{ github.sha }} path: ${{ github.workspace }}/packages/profiling-node/lib/ - - name: Build Profiling tarball - run: yarn build:tarball --scope @sentry/profiling-node + - name: Restore tarball cache uses: actions/cache/restore@v4 with: - path: ${{ github.workspace }}/packages/*/*.tgz + path: ${{ github.workspace }}/packages/profiling-node/*.tgz key: ${{ env.BUILD_PROFILING_NODE_CACHE_TARBALL_KEY }} + fail-on-cache-miss : true - name: Get node version id: versions From ff7d43285ba53a21f04c122a4c96399ba05c8417 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Mon, 4 Mar 2024 16:41:27 +0000 Subject: [PATCH 2/3] proper fix build??? This hopefully properly fixes this... --- .github/workflows/build.yml | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3351215f7dd1..02de64b00fbd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,7 +49,7 @@ env: ${{ github.workspace }}/packages/utils/esm BUILD_CACHE_KEY: build-cache-${{ github.event.inputs.commit || github.sha }} - BUILD_PROFILING_NODE_CACHE_TARBALL_KEY: profiling-node-tarball-${{ github.event.inputs.commit || github.sha }} + BUILD_CACHE_TARBALL_KEY: tarball-${{ github.event.inputs.commit || github.sha }} # GH will use the first restore-key it finds that matches # So it will start by looking for one from the same branch, else take the newest one it can find elsewhere @@ -402,16 +402,9 @@ jobs: uses: ./.github/actions/restore-cache env: DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }} - - name: Pack tarballs - # Profiling tarball is built separately as we assemble the precompiled binaries - run: yarn build:tarball --ignore @sentry/profiling-node - - name: Restore profiling tarball - uses: actions/cache/restore@v4 - with: - key: ${{ env.BUILD_PROFILING_NODE_CACHE_TARBALL_KEY }} - path: ${{ github.workspace }}/packages/profiling-node/*.tgz - fail-on-cache-miss: true + - name: Pack tarballs + run: yarn build:tarball - name: Archive artifacts uses: actions/upload-artifact@v4 @@ -986,8 +979,6 @@ jobs: key: nx-Linux-${{ github.ref }}-${{ env.HEAD_COMMIT }} # On develop branch, we want to _store_ the cache (so it can be used by other branches), but never _restore_ from it restore-keys: ${{ env.NX_CACHE_RESTORE_KEYS }} - - name: Build tarballs - run: yarn build:tarball --ignore @sentry/profiling-node # Rebuild profiling by compiling TS and pull the precompiled binary artifacts - name: Build Profiling Node @@ -1002,6 +993,7 @@ jobs: # https://github.com/actions/upload-artifact/issues/478 if: | (needs.job_get_metadata.outputs.changed_profiling_node_bindings == 'true') || + (needs.job_get_metadata.outputs.is_release == 'true') || (github.event_name != 'pull_request') uses: actions/download-artifact@v3 with: @@ -1009,14 +1001,14 @@ jobs: path: ${{ github.workspace }}/packages/profiling-node/lib/ - name: Build Profiling tarball - run: yarn build:tarball --scope @sentry/profiling-node + run: yarn build:tarball # End rebuild profiling - name: Stores tarballs in cache uses: actions/cache/save@v4 with: - path: ${{ github.workspace }}/packages/profiling-node/*.tgz - key: ${{ env.BUILD_PROFILING_NODE_CACHE_TARBALL_KEY }} + path: ${{ github.workspace }}/packages/*/*.tgz + key: ${{ env.BUILD_CACHE_TARBALL_KEY }} job_e2e_tests: name: E2E ${{ matrix.label || matrix.test-application }} Test @@ -1108,6 +1100,12 @@ jobs: env: DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }} + - name: Restore tarball cache + uses: actions/cache/restore@v4 + with: + path: ${{ github.workspace }}/packages/*/*.tgz + key: ${{ env.BUILD_CACHE_TARBALL_KEY }} + - name: Get node version id: versions run: | @@ -1201,8 +1199,8 @@ jobs: - name: Restore tarball cache uses: actions/cache/restore@v4 with: - path: ${{ github.workspace }}/packages/profiling-node/*.tgz - key: ${{ env.BUILD_PROFILING_NODE_CACHE_TARBALL_KEY }} + path: ${{ github.workspace }}/packages/*/*.tgz + key: ${{ env.BUILD_CACHE_TARBALL_KEY }} fail-on-cache-miss : true - name: Get node version From ba78462444b912d17523861d52e258a0c86a1e8c Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Mon, 4 Mar 2024 16:44:39 +0000 Subject: [PATCH 3/3] fix extract..? --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 02de64b00fbd..954734ad0ba0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -403,6 +403,12 @@ jobs: env: DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }} + - name: Extract Profiling Node Prebuilt Binaries + uses: actions/download-artifact@v3 + with: + name: profiling-node-binaries-${{ github.sha }} + path: ${{ github.workspace }}/packages/profiling-node/lib/ + - name: Pack tarballs run: yarn build:tarball