-
Notifications
You must be signed in to change notification settings - Fork 111
129 lines (110 loc) · 4.3 KB
/
pack-perf.yml
File metadata and controls
129 lines (110 loc) · 4.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: utoopack-perf
on:
push:
branches: [ main, next ]
pull_request:
branches: [ main, next ]
workflow_dispatch:
permissions:
contents: read
pull-requests: write
jobs:
performance:
name: Run Performance Benchmarks
if: (github.event_name == 'push' && contains(github.event.head_commit.message, '(pack)')) || (github.event_name == 'pull_request' && contains(github.event.pull_request.title, '(pack)'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Init git submodules
run: git submodule update --init --recursive --depth 1
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf /usr/share/swift
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /usr/share/miniconda
sudo docker image prune --all --force
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly-2026-02-05
components: rustfmt, clippy
# - name: Cache cargo
# uses: Swatinem/rust-cache@v2
# with:
# shared-key: utoopack-perf
# cache-directories: |
# target/release-local
- name: Install dependencies
run: npm install
- name: Build Bundler
run: |
# Build packages
npm run build --workspace @utoo/pack-shared
npm run build:local --workspace @utoo/pack
npm run build --workspace @utoo/pack-cli
- name: Run Benchmark - with-antd
run: |
mkdir -p .trace
TRACING_CHROME=$PWD/.trace/trace_antd.json npm run build --prefix examples/with-antd
env:
NODE_ENV: production
- name: Analyze Traces
run: |
TRACE_PROJECT=examples/with-antd python3 agents/tools/analyze_trace.py .trace/trace_antd.json .trace/report_antd.md
# Prepare PR comment content
echo "## 📊 Performance Benchmark Report (with-antd)" > .trace/pr_comment.md
cat .trace/report_antd.md >> .trace/pr_comment.md
# Add to Job Summary
cat .trace/pr_comment.md >> $GITHUB_STEP_SUMMARY
- name: Find Current PR
id: findPr
run: |
echo "debug: Event name: ${{ github.event_name }}"
echo "debug: Ref: ${{ github.ref }}"
echo "debug: Ref name: ${{ github.ref_name }}"
PR_NUMBER=""
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
PR_NUMBER="${{ github.event.pull_request.number }}"
echo "debug: Found PR number from event: $PR_NUMBER"
else
# Try to match by branch name
echo "debug: Trying to find PR for branch '${{ github.ref_name }}'..."
PR_NUMBER=$(gh pr list --head "${{ github.ref_name }}" --state open --json number --jq '.[0].number')
# If not found, try to match by commit SHA
if [ -z "$PR_NUMBER" ] || [ "$PR_NUMBER" == "null" ]; then
echo "debug: Branch match failed, trying commit SHA match for ${{ github.sha }}..."
PR_NUMBER=$(gh pr list --search "${{ github.sha }}" --state open --json number --jq '.[0].number')
fi
fi
if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then
echo "debug: Final PR number: $PR_NUMBER"
echo "number=$PR_NUMBER" >> $GITHUB_OUTPUT
else
echo "debug: No PR number found."
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
- name: Post PR Comment
if: steps.findPr.outputs.number
uses: marocchino/sticky-pull-request-comment@v2
with:
header: utoopack-perf-report
path: .trace/pr_comment.md
number: ${{ steps.findPr.outputs.number }}
recreate: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Traces
uses: actions/upload-artifact@v4
with:
name: utoopack-perf-traces
path: .trace/
retention-days: 7