-
Notifications
You must be signed in to change notification settings - Fork 322
129 lines (111 loc) Β· 5.58 KB
/
Copy pathwasm-size.yml
File metadata and controls
129 lines (111 loc) Β· 5.58 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: 'QE: WASM Query Engine size'
on:
pull_request:
paths-ignore:
- '.github/**'
- '!.github/workflows/wasm-size.yml'
- '!.github/workflows/include/rust-wasm-setup/action.yml'
- '.buildkite/**'
- '*.md'
- 'LICENSE'
- 'CODEOWNERS'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pr-wasm-size:
name: calculate module sizes (pr)
runs-on: ubuntu-latest
outputs:
postgresql_size: ${{ steps.measure.outputs.postgresql_size }}
postgresql_size_gz: ${{ steps.measure.outputs.postgresql_size_gz }}
mysql_size: ${{ steps.measure.outputs.mysql_size }}
mysql_size_gz: ${{ steps.measure.outputs.mysql_size_gz }}
sqlite_size: ${{ steps.measure.outputs.sqlite_size }}
sqlite_size_gz: ${{ steps.measure.outputs.sqlite_size_gz }}
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
- uses: ./.github/workflows/include/rust-wasm-setup
- name: Build and measure PR branch
id: measure
run: |
export ENGINE_SIZE_OUTPUT=$GITHUB_OUTPUT
make measure-qe-wasm
base-wasm-size:
name: calculate module sizes (base branch)
runs-on: ubuntu-latest
outputs:
postgresql_size: ${{ steps.measure.outputs.postgresql_size }}
postgresql_size_gz: ${{ steps.measure.outputs.postgresql_size_gz }}
mysql_size: ${{ steps.measure.outputs.mysql_size }}
mysql_size_gz: ${{ steps.measure.outputs.mysql_size_gz }}
sqlite_size: ${{ steps.measure.outputs.sqlite_size }}
sqlite_size_gz: ${{ steps.measure.outputs.sqlite_size_gz }}
steps:
- name: Checkout base branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}
- uses: ./.github/workflows/include/rust-wasm-setup
- name: Build and measure base branch
id: measure
run: |
export ENGINE_SIZE_OUTPUT=$GITHUB_OUTPUT
make measure-qe-wasm
report-diff:
name: report module size
runs-on: ubuntu-latest
needs:
- pr-wasm-size
- base-wasm-size
permissions:
pull-requests: write
steps:
- name: Compute difference
id: compute
run: |
fmt() {
echo "$1" | numfmt --format '%.3f' --to=iec-i --suffix=B
}
compute_diff() {
local provider="$1"
local base="$2"
local pr="$3"
local diff=$(fmt "$(($pr - $base))")
echo "${provider}_base=$(fmt "$base")" >> $GITHUB_OUTPUT
echo "${provider}_pr=$(fmt "$pr")" >> $GITHUB_OUTPUT
echo "${provider}_diff=$diff" >> $GITHUB_OUTPUT
}
compute_diff "postgresql" "${{ needs.base-wasm-size.outputs.postgresql_size }}" "${{ needs.pr-wasm-size.outputs.postgresql_size }}"
compute_diff "postgresql_gz" "${{ needs.base-wasm-size.outputs.postgresql_size_gz }}" "${{ needs.pr-wasm-size.outputs.postgresql_size_gz }}"
compute_diff "mysql" "${{ needs.base-wasm-size.outputs.mysql_size }}" "${{ needs.pr-wasm-size.outputs.mysql_size }}"
compute_diff "mysql_gz" "${{ needs.base-wasm-size.outputs.mysql_size_gz }}" "${{ needs.pr-wasm-size.outputs.mysql_size_gz }}"
compute_diff "sqlite" "${{ needs.base-wasm-size.outputs.sqlite_size }}" "${{ needs.pr-wasm-size.outputs.sqlite_size }}"
compute_diff "sqlite_gz" "${{ needs.base-wasm-size.outputs.sqlite_size_gz }}" "${{ needs.pr-wasm-size.outputs.sqlite_size_gz }}"
- name: Find past report comment
uses: peter-evans/find-comment@v3
id: findReportComment
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: '<!-- wasm-size -->'
- name: Create or update report
uses: peter-evans/create-or-update-comment@v4
# Only run on branches from our repository
# It avoids an expected failure on forks
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
with:
comment-id: ${{ steps.findReportComment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
<!-- wasm-size -->
### WASM Query Engine file Size
|Engine | This PR | Base branch | Diff
|------------------|----------------------------------------------|--------------------------------------------------|-----------------------------------------------
| Postgres | ${{ steps.compute.outputs.postgresql_pr}} | ${{ steps.compute.outputs.postgresql_base }} | ${{ steps.compute.outputs.postgresql_diff}}
| Postgres (gzip) | ${{ steps.compute.outputs.postgresql_gz_pr}} | ${{ steps.compute.outputs.postgresql_gz_base }} | ${{ steps.compute.outputs.postgresql_gz_diff}}
| Mysql | ${{ steps.compute.outputs.mysql_pr}} | ${{ steps.compute.outputs.mysql_base}} | ${{ steps.compute.outputs.mysql_diff}}
| Mysql (gzip) | ${{ steps.compute.outputs.mysql_gz_pr}} | ${{ steps.compute.outputs.mysql_gz_base}} | ${{ steps.compute.outputs.mysql_gz_diff}}
| Sqlite | ${{ steps.compute.outputs.sqlite_pr}} | ${{ steps.compute.outputs.sqlite_base}} | ${{ steps.compute.outputs.sqlite_diff}}
| Sqlite (gzip) | ${{ steps.compute.outputs.sqlite_gz_pr}} | ${{ steps.compute.outputs.sqlite_gz_base }} | ${{ steps.compute.outputs.sqlite_gz_diff}}
edit-mode: replace