Skip to content

Commit

Permalink
Performance analysis workflow (#10625)
Browse files Browse the repository at this point in the history
* Performance analsysis workflow

* add `replayio install` step

* use proper preview deployment for pull_request runs

* enable metadata params

* parseInt pullRequest
  • Loading branch information
Andarist authored Dec 6, 2024
1 parent ec45e5a commit d89b497
Show file tree
Hide file tree
Showing 17 changed files with 881 additions and 254 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/perf_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Performance analysis

on:
pull_request:
workflow_dispatch:
schedule:
- cron: "0 */2 * * *" # every 2 hours

jobs:
perf-analysis:
name: Performance analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Get the yarn cache path.
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "{dir}={$(yarn config get cacheFolder)}" >> $GITHUB_OUTPUT
- name: Restore yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
**/node_modules
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
restore-keys: "yarn-cache-folder-"
# Actually install packages with Yarn
- name: Install packages
run: yarn install
env:
YARN_CHECKSUM_BEHAVIOR: "update"
- name: Install Replay Chromium
run: npx replayio@latest install
- name: Wait for Vercel preview deployment to be ready
uses: patrickedqvist/wait-for-vercel-preview@v1.3.1
if: github.event_name == 'pull_request'
id: wait-for-vercel-preview
with:
token: ${{ secrets.GITHUB_TOKEN }}
max_timeout: 240
- name: Run performance analysis
run: yarn run perf-analysis
env:
REPLAY_API_KEY: ${{ secrets.PERFORMANCE_ANALYSIS_REPLAY_API_KEY }}
DEVTOOLS_URL: ${{ steps.wait-for-vercel-preview.outputs.url }}
GITHUB_REPOSITORY: ${{ env.GITHUB_REPOSITORY }}
GITHUB_REF_NAME: ${{ env.GITHUB_REF_NAME }}
GITHUB_PR: ${{ github.event.pull_request && github.event.pull_request.number }}
GITHUB_SHA: ${{ env.GITHUB_SHA }}
7 changes: 5 additions & 2 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion packages/e2e-tests/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/e2e-tests/scripts/record-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ function getRecordingId(file: string) {
}
return contents;
}
return null;
return;
} catch (e) {
return null;
return;
}
}

export async function recordNodeExample(scriptPath: string): Promise<string> {
export async function recordNodeExample(scriptPath: string): Promise<string | undefined> {
const nodePath = config.nodePath || execSync("which replay-node").toString().trim();
if (!nodePath) {
console.warn("\x1b[1m\x1b[31m" + "Node e2e tests require @replayio/node" + "\x1b[0m");
Expand Down
102 changes: 0 additions & 102 deletions packages/e2e-tests/scripts/record-playwright.ts

This file was deleted.

Loading

0 comments on commit d89b497

Please sign in to comment.