Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Store build output as artifacts instead of cache #13487

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions .github/actions/restore-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ runs:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ env.DEPENDENCY_CACHE_KEY }}

- name: Check build cache
uses: actions/cache/restore@v4
id: build-cache
- name: Restore build artifacts
uses: actions/download-artifact@v4
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
name: build-output

- name: Check if caches are restored
uses: actions/github-script@v6
if: steps.dep-cache.outputs.cache-hit != 'true' || steps.build-cache.outputs.cache-hit != 'true'
if: steps.dep-cache.outputs.cache-hit != 'true'
with:
script: core.setFailed('Dependency or build cache could not be restored - please re-run ALL jobs.')
script: core.setFailed('Dependency cache could not be restored - please re-run ALL jobs.')
17 changes: 9 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ env:
${{ github.workspace }}/packages/utils/cjs
${{ github.workspace }}/packages/utils/esm

BUILD_CACHE_KEY: build-cache-${{ 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
Expand Down Expand Up @@ -160,13 +159,6 @@ jobs:
base: ${{ github.event.pull_request.base.sha }}
head: ${{ env.HEAD_COMMIT }}

- name: Check build cache
uses: actions/cache@v4
id: cache_built_packages
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}

- name: NX cache
uses: actions/cache@v4
# Disable cache when:
Expand All @@ -188,6 +180,15 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: yarn build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-output
path: ${{ env.CACHED_BUILD_PATHS }}
retention-days: 7
compression-level: 6
overwrite: true

outputs:
dependency_cache_key: ${{ steps.install_dependencies.outputs.cache_key }}
changed_node_integration: ${{ needs.job_get_metadata.outputs.changed_ci == 'true' || contains(steps.checkForAffected.outputs.affected, '@sentry-internal/node-integration-tests') }}
Expand Down
Loading