Skip to content

Commit d89b497

Browse files
authored
Performance analysis workflow (#10625)
* Performance analsysis workflow * add `replayio install` step * use proper preview deployment for pull_request runs * enable metadata params * parseInt pullRequest
1 parent ec45e5a commit d89b497

File tree

17 files changed

+881
-254
lines changed

17 files changed

+881
-254
lines changed

.github/workflows/perf_analysis.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Performance analysis
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
schedule:
7+
- cron: "0 */2 * * *" # every 2 hours
8+
9+
jobs:
10+
perf-analysis:
11+
name: Performance analysis
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
# Get the yarn cache path.
16+
- name: Get yarn cache directory path
17+
id: yarn-cache-dir-path
18+
run: echo "{dir}={$(yarn config get cacheFolder)}" >> $GITHUB_OUTPUT
19+
- name: Restore yarn cache
20+
uses: actions/cache@v3
21+
id: yarn-cache
22+
with:
23+
path: |
24+
${{ steps.yarn-cache-dir-path.outputs.dir }}
25+
**/node_modules
26+
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
27+
restore-keys: "yarn-cache-folder-"
28+
# Actually install packages with Yarn
29+
- name: Install packages
30+
run: yarn install
31+
env:
32+
YARN_CHECKSUM_BEHAVIOR: "update"
33+
- name: Install Replay Chromium
34+
run: npx replayio@latest install
35+
- name: Wait for Vercel preview deployment to be ready
36+
uses: patrickedqvist/[email protected]
37+
if: github.event_name == 'pull_request'
38+
id: wait-for-vercel-preview
39+
with:
40+
token: ${{ secrets.GITHUB_TOKEN }}
41+
max_timeout: 240
42+
- name: Run performance analysis
43+
run: yarn run perf-analysis
44+
env:
45+
REPLAY_API_KEY: ${{ secrets.PERFORMANCE_ANALYSIS_REPLAY_API_KEY }}
46+
DEVTOOLS_URL: ${{ steps.wait-for-vercel-preview.outputs.url }}
47+
GITHUB_REPOSITORY: ${{ env.GITHUB_REPOSITORY }}
48+
GITHUB_REF_NAME: ${{ env.GITHUB_REF_NAME }}
49+
GITHUB_PR: ${{ github.event.pull_request && github.event.pull_request.number }}
50+
GITHUB_SHA: ${{ env.GITHUB_SHA }}

package.json

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/e2e-tests/package.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/e2e-tests/scripts/record-node.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ function getRecordingId(file: string) {
1515
}
1616
return contents;
1717
}
18-
return null;
18+
return;
1919
} catch (e) {
20-
return null;
20+
return;
2121
}
2222
}
2323

24-
export async function recordNodeExample(scriptPath: string): Promise<string> {
24+
export async function recordNodeExample(scriptPath: string): Promise<string | undefined> {
2525
const nodePath = config.nodePath || execSync("which replay-node").toString().trim();
2626
if (!nodePath) {
2727
console.warn("\x1b[1m\x1b[31m" + "Node e2e tests require @replayio/node" + "\x1b[0m");

packages/e2e-tests/scripts/record-playwright.ts

Lines changed: 0 additions & 102 deletions
This file was deleted.

0 commit comments

Comments
 (0)