Skip to content

Commit

Permalink
Merge branch 'develop' into nh/instrument-interceptors-after-route
Browse files Browse the repository at this point in the history
  • Loading branch information
nicohrubec committed Aug 13, 2024
2 parents 2081e1a + 51ef02d commit 763bcad
Show file tree
Hide file tree
Showing 317 changed files with 7,029 additions and 1,787 deletions.
5 changes: 5 additions & 0 deletions .craft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ targets:
- name: npm
id: '@sentry/remix'
includeNames: /^sentry-remix-\d.*\.tgz$/
- name: npm
id: '@sentry/solidstart'
includeNames: /^sentry-solidstart-\d.*\.tgz$/
- name: npm
id: '@sentry/sveltekit'
includeNames: /^sentry-sveltekit-\d.*\.tgz$/
Expand Down Expand Up @@ -203,6 +206,8 @@ targets:
onlyIfPresent: /^sentry-remix-\d.*\.tgz$/
'npm:@sentry/solid':
onlyIfPresent: /^sentry-solid-\d.*\.tgz$/
'npm:@sentry/solidstart':
onlyIfPresent: /^sentry-solidstart-\d.*\.tgz$/
'npm:@sentry/svelte':
onlyIfPresent: /^sentry-svelte-\d.*\.tgz$/
'npm:@sentry/sveltekit':
Expand Down
7 changes: 6 additions & 1 deletion .github/actions/install-playwright/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: "Install Playwright dependencies"
description: "Installs Playwright dependencies and caches them."
inputs:
browsers:
description: 'What browsers to install.'
default: 'chromium webkit firefox'

runs:
using: "composite"
Expand All @@ -17,12 +21,13 @@ runs:
~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}

# We always install all browsers, if uncached
- name: Install Playwright dependencies (uncached)
run: npx playwright install chromium webkit firefox --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
shell: bash

- name: Install Playwright system dependencies only (cached)
run: npx playwright install-deps chromium webkit firefox
run: npx playwright install-deps ${{ inputs.browsers || 'chromium webkit firefox' }}
if: steps.playwright-cache.outputs.cache-hit == 'true'
shell: bash
84 changes: 61 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ jobs:
profiling_node:
- 'packages/profiling-node/**'
- 'dev-packages/e2e-tests/test-applications/node-profiling/**'
any_code:
- '!**/*.md'
- name: Get PR labels
Expand All @@ -109,6 +111,8 @@ jobs:
is_release: ${{ startsWith(github.ref, 'refs/heads/release/') }}
changed_profiling_node: ${{ steps.changed.outputs.profiling_node == 'true' }}
changed_ci: ${{ steps.changed.outputs.workflow == 'true' }}
changed_any_code: ${{ steps.changed.outputs.any_code == 'true' }}

# When merging into master, or from master
is_gitflow_sync: ${{ github.head_ref == 'master' || github.ref == 'refs/heads/master' }}
has_gitflow_label:
Expand All @@ -123,6 +127,7 @@ jobs:
runs-on: ubuntu-20.04
timeout-minutes: 15
if: |
needs.job_get_metadata.outputs.changed_any_code == 'true' &&
(needs.job_get_metadata.outputs.is_gitflow_sync == 'false' && needs.job_get_metadata.outputs.has_gitflow_label == 'false')
steps:
- name: Check out base commit (${{ github.event.pull_request.base.sha }})
Expand Down Expand Up @@ -274,24 +279,37 @@ jobs:

job_check_format:
name: Check file formatting
needs: [job_get_metadata, job_build]
needs: [job_get_metadata]
timeout-minutes: 10
runs-on: ubuntu-20.04
steps:
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
uses: actions/checkout@v4
with:
ref: ${{ env.HEAD_COMMIT }}

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'

# we use a hash of yarn.lock as our cache key, because if it hasn't changed, our dependencies haven't changed,
# so no need to reinstall them
- name: Compute dependency cache key
id: compute_lockfile_hash
run: echo "hash=${{ hashFiles('yarn.lock', '**/package.json') }}" >> "$GITHUB_OUTPUT"

- name: Check dependency cache
uses: actions/cache/restore@v4
uses: actions/cache@v4
id: cache_dependencies
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
fail-on-cache-miss: true
key: ${{ steps.compute_lockfile_hash.outputs.hash }}

- name: Install dependencies
if: steps.cache_dependencies.outputs.cache-hit != 'true'
run: yarn install --ignore-engines --frozen-lockfile

- name: Check file formatting
run: yarn lint:prettier && yarn lint:biome

Expand Down Expand Up @@ -528,7 +546,7 @@ jobs:
run: yarn lerna run test --scope @sentry/profiling-node

job_browser_playwright_tests:
name: Playwright (${{ matrix.bundle }}${{ matrix.shard && format(' {0}/{1}', matrix.shard, matrix.shards) || ''}}) Tests
name: Playwright ${{ matrix.bundle }}${{ matrix.project && matrix.project != 'chromium' && format(' {0}', matrix.project) || ''}}${{ matrix.shard && format(' ({0}/{1})', matrix.shard, matrix.shards) || ''}} Tests
needs: [job_get_metadata, job_build]
if: needs.job_build.outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
runs-on: ubuntu-20.04-large-js
Expand All @@ -548,31 +566,30 @@ jobs:
project:
- chromium
include:
# Only check all projects for esm & full bundle
# Only check all projects for full bundle
# We also shard the tests as they take the longest
- bundle: bundle_tracing_replay_feedback_min
project: ''
shard: 1
shards: 2
project: 'webkit'
- bundle: bundle_tracing_replay_feedback_min
project: ''
shard: 2
shards: 2
project: 'firefox'
- bundle: esm
project: ''
project: chromium
shard: 1
shards: 3
shards: 4
- bundle: esm
project: chromium
shard: 2
shards: 3
shards: 4
- bundle: esm
project: ''
project: chromium
shard: 3
shards: 3
shards: 4
- bundle: esm
project: chromium
shard: 4
shards: 4
exclude:
# Do not run the default chromium-only tests
- bundle: bundle_tracing_replay_feedback_min
project: 'chromium'
# Do not run the un-sharded esm tests
- bundle: esm
project: 'chromium'

Expand All @@ -592,12 +609,15 @@ jobs:

- name: Install Playwright
uses: ./.github/actions/install-playwright
with:
browsers: ${{ matrix.project }}

- name: Run Playwright tests
env:
PW_BUNDLE: ${{ matrix.bundle }}
working-directory: dev-packages/browser-integration-tests
run: yarn test:ci${{ matrix.project && format(' --project={0}', matrix.project) || '' }}${{ matrix.shard && format(' --shard={0}/{1}', matrix.shard, matrix.shards) || '' }}

- name: Upload Playwright Traces
uses: actions/upload-artifact@v3
if: always()
Expand All @@ -606,7 +626,7 @@ jobs:
path: dev-packages/browser-integration-tests/test-results

job_browser_loader_tests:
name: Playwright Loader (${{ matrix.bundle }}) Tests
name: PW ${{ matrix.bundle }} Tests
needs: [job_get_metadata, job_build]
if: needs.job_build.outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -639,6 +659,8 @@ jobs:

- name: Install Playwright
uses: ./.github/actions/install-playwright
with:
browsers: chromium

- name: Run Playwright Loader tests
env:
Expand Down Expand Up @@ -750,8 +772,12 @@ jobs:
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}

- name: Install Playwright
uses: ./.github/actions/install-playwright
with:
browsers: chromium

- name: Run integration tests
env:
NODE_VERSION: ${{ matrix.node }}
Expand Down Expand Up @@ -810,10 +836,10 @@ jobs:
pattern: profiling-node-binaries-${{ github.sha }}-*
path: ${{ github.workspace }}/packages/profiling-node/lib/
merge-multiple: true
# End rebuild profiling

- name: Build Profiling tarball
- name: Build tarballs
run: yarn build:tarball
# End rebuild profiling

- name: Stores tarballs in cache
uses: actions/cache/save@v4
Expand Down Expand Up @@ -859,6 +885,7 @@ jobs:
'create-remix-app-express',
'create-remix-app-express-legacy',
'create-remix-app-express-vite-dev',
'default-browser',
'node-express-esm-loader',
'node-express-esm-preload',
'node-express-esm-without-loader',
Expand All @@ -878,6 +905,7 @@ jobs:
'react-router-5',
'react-router-6',
'solid',
'solidstart',
'svelte-5',
'sveltekit',
'sveltekit-2',
Expand Down Expand Up @@ -949,9 +977,12 @@ jobs:
with:
path: ${{ github.workspace }}/packages/*/*.tgz
key: ${{ env.BUILD_CACHE_TARBALL_KEY }}
fail-on-cache-miss: true

- name: Install Playwright
uses: ./.github/actions/install-playwright
with:
browsers: chromium

- name: Get node version
id: versions
Expand Down Expand Up @@ -1046,9 +1077,12 @@ jobs:
with:
path: ${{ github.workspace }}/packages/*/*.tgz
key: ${{ env.BUILD_CACHE_TARBALL_KEY }}
fail-on-cache-miss: true

- name: Install Playwright
uses: ./.github/actions/install-playwright
with:
browsers: chromium

- name: Get node version
id: versions
Expand Down Expand Up @@ -1149,6 +1183,8 @@ jobs:

- name: Install Playwright
uses: ./.github/actions/install-playwright
with:
browsers: chromium

- name: Get node version
id: versions
Expand Down Expand Up @@ -1412,6 +1448,7 @@ jobs:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
enableCrossOsArchive: true
fail-on-cache-miss: true

- name: Restore build cache
uses: actions/cache/restore@v4
Expand All @@ -1420,6 +1457,7 @@ jobs:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
enableCrossOsArchive: true
fail-on-cache-miss: true

- name: Configure safe directory
run: |
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/cleanup-pr-caches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "Automation: Cleanup PR caches"
on:
pull_request:
types:
- closed

jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
# `actions:write` permission is required to delete caches
# See also: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id
actions: write
contents: read
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH=refs/pull/${{ github.event.pull_request.number }}/merge
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions .size-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module.exports = [
path: 'packages/browser/build/npm/esm/index.js',
import: createImport('init', 'browserTracingIntegration', 'replayIntegration', 'feedbackIntegration'),
gzip: true,
limit: '90 KB',
limit: '91 KB',
},
{
name: '@sentry/browser (incl. Tracing, Replay, Feedback, metrics)',
Expand Down Expand Up @@ -143,7 +143,7 @@ module.exports = [
name: 'CDN Bundle (incl. Tracing)',
path: createCDNPath('bundle.tracing.min.js'),
gzip: true,
limit: '37 KB',
limit: '38 KB',
},
{
name: 'CDN Bundle (incl. Tracing, Replay)',
Expand All @@ -170,7 +170,7 @@ module.exports = [
path: createCDNPath('bundle.tracing.min.js'),
gzip: false,
brotli: false,
limit: '110 KB',
limit: '111 KB',
},
{
name: 'CDN Bundle (incl. Tracing, Replay) - uncompressed',
Expand All @@ -193,7 +193,7 @@ module.exports = [
import: createImport('init'),
ignore: ['next/router', 'next/constants'],
gzip: true,
limit: '38 KB',
limit: '39 KB',
},
// SvelteKit SDK (ESM)
{
Expand Down
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@
],
"deno.enablePaths": ["packages/deno/test"],
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
"editor.defaultFormatter": "biomejs.biome",
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
}
},
"cSpell.words": ["arrayify", "OTEL"]
}
Loading

0 comments on commit 763bcad

Please sign in to comment.