Skip to content

Commit b94b37d

Browse files
committed
feat: Add benchmark workflows and actions for performance testing
- Implemented a new GitHub Action for benchmark execution, including steps for dependency installation, test execution, and result reporting. - Created benchmark monitoring workflow triggered on pushes to the develop branch, storing results and alerting on performance regressions. - Added a PR check workflow to compare benchmark results against the baseline and post comments on pull requests. - Introduced a new Angular sample project with custom elements and shadow DOM components, including various input types. - Established a React performance test scenario rendering multiple KoliBri components to evaluate performance. - Configured Tailwind CSS and PostCSS for styling in the Angular sample project. - Added comprehensive benchmark tests with Playwright, including result comparison and reporting. - Included necessary configuration files for Knip, Prettier, and Playwright in the benchmark tests package. Refs: #7656
1 parent f8a9999 commit b94b37d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3045
-2116
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Benchmark Execution
2+
runs:
3+
using: 'composite'
4+
steps:
5+
- name: Install dependencies
6+
uses: ./.github/actions/pnpm-setup
7+
8+
- name: Install playwright dependencies and browsers
9+
run: pnpm exec playwright install --with-deps chromium
10+
shell: bash
11+
working-directory: packages/tools/benchmark-tests
12+
13+
- name: Build required packages
14+
run: pnpm build:deps
15+
shell: bash
16+
working-directory: packages/tools/benchmark-tests
17+
18+
- name: Run benchmark tests
19+
run: pnpm test-benchmark
20+
shell: bash
21+
working-directory: packages/tools/benchmark-tests
22+
23+
- name: Outline benchmark result
24+
run: cat benchmark-result.json
25+
shell: bash
26+
working-directory: packages/tools/benchmark-tests
27+
28+
- name: Remove husky
29+
run: rm -rf .husky
30+
shell: bash
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Benchmark-Monitoring
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: 'workflow-${{ github.workflow }}-${{ github.ref }}'
11+
cancel-in-progress: true
12+
13+
jobs:
14+
benchmark:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
persist-credentials: false
22+
23+
- name: Install and execute benchmark
24+
uses: ./.github/actions/benchmark
25+
26+
- name: Store benchmark result
27+
uses: rhysd/github-action-benchmark@v1
28+
with:
29+
alert-threshold: 10%
30+
auto-push: true
31+
fail-threshold: 25%
32+
gh-pages-branch: benchmarks
33+
github-token: ${{ secrets.GITHUB_TOKEN }}
34+
output-file-path: packages/tools/benchmark-tests/benchmark-result.json
35+
tool: customSmallerIsBetter
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Benchmark-PR-Check
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
group: 'workflow-${{ github.workflow }}-${{ github.ref }}'
8+
cancel-in-progress: true
9+
10+
jobs:
11+
benchmark:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
persist-credentials: false
19+
20+
- name: Install and execute benchmark
21+
uses: ./.github/actions/benchmark
22+
23+
- name: Load benchmark from target branch
24+
run: |
25+
git fetch origin ${{ github.base_ref }}
26+
git show origin/${{ github.base_ref }}:packages/tools/benchmark-tests/benchmark-result.json > packages/tools/benchmark-tests/benchmark-baseline.json || echo "[]" > packages/tools/benchmark-tests/benchmark-baseline.json
27+
28+
- name: Compare benchmark with baseline
29+
run: node scripts/compare-benchmark.mjs
30+
working-directory: packages/tools/benchmark-tests
31+
32+
- name: Find comment
33+
uses: peter-evans/find-comment@v3
34+
id: fc
35+
with:
36+
body-includes: Hydration Benchmark Report
37+
issue-number: ${{ github.event.pull_request.number }}
38+
39+
- name: Post PR Comment
40+
uses: peter-evans/create-or-update-comment@v4
41+
with:
42+
body-path: packages/tools/benchmark-tests/benchmark-report.md
43+
edit-mode: replace
44+
issue-number: ${{ github.event.pull_request.number }}
45+
reactions: false
46+
token: ${{ secrets.GITHUB_TOKEN }}

packages/components/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@
6666
"lint:tsc": "tsc --noemit",
6767
"dev": "cross-env NODE_ENV=development stencil build --prod --watch",
6868
"test": "pnpm test:unit",
69+
"test:e2e": "playwright test",
6970
"test:unit": "cross-env NODE_ENV=test stencil test --spec --json --outputFile dist/jest-test-results.json",
7071
"test:watch": "cross-env NODE_ENV=test stencil test --spec --watchAll",
71-
"test:e2e": "playwright test",
7272
"postpack": "mv package.bak.json package.json",
7373
"prepack": "npm run build && cp package.json package.bak.json && rimraf dist/collection dist/kolibri/assets/@leanup dist/types/assets/@leanup && node scripts/anonymous.js && node scripts/minify.js",
7474
"xunused": "knip"
7575
},
7676
"dependencies": {
7777
"@floating-ui/dom": "1.6.13",
78-
"adopted-style-sheets": "1.1.8",
78+
"adopted-style-sheets": "1.1.9-rc.17",
7979
"clsx": "2.1.1",
8080
"color-convert": "2.0.1",
8181
"color-rgba": "2.4.0",
@@ -134,7 +134,7 @@
134134
"typescript": "5.8.2"
135135
},
136136
"peerDependencies": {
137-
"adopted-style-sheets": "1.1.8"
137+
"adopted-style-sheets": "1.1.9-rc.17"
138138
},
139139
"files": [
140140
"assets",

packages/components/stencil.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ const TAGS = [
4848
'kol-skip-nav',
4949
'kol-spin',
5050
'kol-split-button',
51-
'kol-table-settings-wc',
5251
'kol-table-stateful',
5352
'kol-table-stateless',
5453
'kol-tabs',
Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,2 @@
1-
# See http://help.github.com/ignore-files/ for more about ignoring files.
2-
3-
# Compiled output
4-
/dist
5-
/tmp
6-
/out-tsc
7-
/bazel-out
8-
9-
# Node
10-
/node_modules
11-
npm-debug.log
12-
yarn-error.log
13-
14-
# IDEs and editors
15-
.idea/
16-
.project
17-
.classpath
18-
.c9/
19-
*.launch
20-
.settings/
21-
*.sublime-workspace
22-
23-
# Visual Studio Code
24-
.vscode/*
25-
!.vscode/settings.json
26-
!.vscode/tasks.json
27-
!.vscode/launch.json
28-
!.vscode/extensions.json
29-
.history/*
30-
31-
# Miscellaneous
32-
/.angular/cache
33-
.sass-cache/
34-
/connect.lock
35-
/coverage
36-
/libpeerconnection.log
37-
testem.log
38-
/typings
39-
40-
# System files
41-
.DS_Store
42-
Thumbs.db
1+
.angular
2+
/src/assets/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "https://unpkg.com/knip@5/schema.json",
3+
"entry": ["src/main.ts"],
4+
"ignore": [],
5+
"ignoreDependencies": ["@public-ui/angular-v17", "@public-ui/components", "@public-ui/themes", "@tailwindcss/postcss", "adopted-style-sheets"],
6+
"project": ["src/**/*.{js,ts}"]
7+
}

packages/samples/angular/.vscode/extensions.json

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

packages/samples/angular/.vscode/launch.json

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

packages/samples/angular/.vscode/tasks.json

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

0 commit comments

Comments
 (0)