@@ -3,26 +3,51 @@ name: performance
3
3
on : [pull_request]
4
4
5
5
jobs :
6
- runtime-size :
7
- name : runtime-size
6
+ size :
8
7
runs-on : ubuntu-latest
9
8
steps :
10
- - uses : actions/checkout@v4
11
- - uses : necolas/compressed-size-action@master
12
- with :
13
- name : ' runtime library'
14
- build-script : ' build -w @stylexjs/stylex'
15
- pattern : ' ./packages/stylex/lib/{stylex.js,StyleXSheet.js}'
16
- repo-token : ' ${{ secrets.GITHUB_TOKEN }}'
17
-
18
- bundle-size :
19
- name : bundle-size
20
- runs-on : ubuntu-latest
21
- steps :
22
- - uses : actions/checkout@v4
23
- - uses : necolas/compressed-size-action@master
24
- with :
25
- name : ' e2e bundles'
26
- build-script : ' build'
27
- pattern : ' ./apps/rollup-example/.build/{stylex.css,bundle.js}'
28
- repo-token : ' ${{ secrets.GITHUB_TOKEN }}'
9
+ - uses : actions/checkout@v4
10
+ with :
11
+ fetch-depth : 50
12
+ - uses : actions/setup-node@v4
13
+ with :
14
+ node-version : ' 20.x'
15
+ - name : ' Setup temporary files'
16
+ run : |
17
+ echo "BASE_JSON=$(mktemp)" >> $GITHUB_ENV
18
+ echo "PATCH_JSON=$(mktemp)" >> $GITHUB_ENV
19
+ - name : ' Benchmark base'
20
+ run : |
21
+ git checkout -f ${{ github.event.pull_request.base.sha }}
22
+ npm install --loglevel error
23
+ if npm run size -w @stylexjs/scripts -- -o ${{ env.BASE_JSON }}; then
24
+ echo "Ran successfully on base branch"
25
+ else
26
+ echo "{}" > ${{ env.BASE_JSON }} # Empty JSON as default
27
+ echo "Benchmark script not found on base branch, using default values"
28
+ fi
29
+ - name : ' Benchmark patch'
30
+ run : |
31
+ git checkout -f ${{ github.event.pull_request.head.sha }}
32
+ npm install --loglevel error
33
+ npm run size -w @stylexjs/scripts -- -o ${{ env.PATCH_JSON }}
34
+ echo "Ran successfully on patch branch"
35
+ - name : ' Collect results'
36
+ id : collect
37
+ run : |
38
+ echo "table<<EOF" >> $GITHUB_OUTPUT
39
+ npm run size:compare -w @stylexjs/scripts -- ${{ env.BASE_JSON }} ${{ env.PATCH_JSON }} >> markdown
40
+ cat markdown >> $GITHUB_OUTPUT
41
+ echo "EOF" >> $GITHUB_OUTPUT
42
+ - name : ' Post comment'
43
+ uses : edumserrano/find-create-or-update-comment@v3
44
+ with :
45
+ issue-number : ${{ github.event.pull_request.number }}
46
+ body-includes : ' <!-- workflow-benchmarks-size-data -->'
47
+ comment-author : ' github-actions[bot]'
48
+ body : |
49
+ <!-- workflow-benchmarks-size-data -->
50
+ ### workflow: benchmarks/size
51
+ Comparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.
52
+ ${{ steps.collect.outputs.table }}
53
+ edit-mode : replace
0 commit comments