Skip to content

Commit 2ee8e4c

Browse files
[CI] Add workflow to guard against increases in the binary size (jaegertracing#6529)
## Which problem is this PR solving? - Resolves jaegertracing#6527 ## Description of the changes - Added CI github workflow ## How was this change tested? - ## Checklist - [ ] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [ ] I have signed all commits - [ ] I have added unit tests for the new functionality - [ ] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `npm run lint` and `npm run test` --------- Signed-off-by: chahatsagarmain <[email protected]> Signed-off-by: chahat sagar <[email protected]> Signed-off-by: Yuri Shkuro <[email protected]> Co-authored-by: Yuri Shkuro <[email protected]>
1 parent 3ba8e54 commit 2ee8e4c

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

.github/workflows/ci-lint-checks.yaml

+67
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,70 @@ jobs:
117117
- name: Run unit tests for scripts
118118
run: |
119119
SHUNIT2=.tools/shunit2 bash scripts/utils/compute-tags.test.sh
120+
121+
binary-size-check:
122+
runs-on: ubuntu-latest
123+
steps:
124+
- uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
125+
with:
126+
egress-policy: audit
127+
128+
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
129+
with:
130+
submodules: true
131+
132+
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
133+
with:
134+
go-version: 1.23.x
135+
136+
- name: Setup Node.js version
137+
uses: ./.github/actions/setup-node.js
138+
139+
- name: Build jaeger binary
140+
run: make build-jaeger
141+
142+
- name: Calculate jaeger binary size
143+
run: |
144+
TOTAL_SIZE=$(du -sb ./cmd/jaeger/jaeger-linux-amd64 | cut -f1)
145+
echo "$TOTAL_SIZE" > ./new_jaeger_binary_size.txt
146+
echo "Total binary size: $TOTAL_SIZE bytes"
147+
148+
- name: Restore previous binary size
149+
id: cache-binary-size
150+
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 #v4.2.0
151+
with:
152+
path: ./jaeger_binary_size.txt
153+
key: jaeger_binary_size
154+
restore-keys: |
155+
jaeger_binary_size
156+
157+
- name: Compare jaeger binary sizes
158+
if: steps.cache-binary-size.outputs.cache-hit == 'true'
159+
run: |
160+
OLD_BINARY_SIZE=$(cat ./jaeger_binary_size.txt)
161+
NEW_BINARY_SIZE=$(cat ./new_jaeger_binary_size.txt)
162+
echo "Previous binary size: $OLD_BINARY_SIZE bytes"
163+
echo "New binary size: $NEW_BINARY_SIZE bytes"
164+
165+
SIZE_CHANGE=$(( $NEW_BINARY_SIZE - $OLD_BINARY_SIZE ))
166+
PERCENTAGE_CHANGE=$(( SIZE_CHANGE * 100 / $OLD_BINARY_SIZE ))
167+
echo "Size change: $PERCENTAGE_CHANGE%"
168+
if [ $PERCENTAGE_CHANGE -gt 2 ]; then
169+
echo "❌ binary size increased by more than 2% ($PERCENTAGE_CHANGE%)"
170+
exit 1
171+
else
172+
echo "✅ binary size change is within acceptable range ($PERCENTAGE_CHANGE%)"
173+
fi
174+
175+
176+
- name: Remove previous *_binary_*.txt
177+
run: |
178+
rm -rf ./jaeger_binary_size.txt
179+
mv ./new_jaeger_binary_size.txt ./jaeger_binary_size.txt
180+
181+
- name: Save new jaeger binary size
182+
if: ${{ (github.event_name == 'push') && (github.ref == 'refs/heads/main') }}
183+
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 #v4.2.0
184+
with:
185+
path: ./jaeger_binary_size.txt
186+
key: jaeger_binary_size_${{ github.run_id }}

0 commit comments

Comments
 (0)