Skip to content

Commit

Permalink
[CI] Add workflow to guard against increases in the binary size (jaeg…
Browse files Browse the repository at this point in the history
…ertracing#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 <chahatsagar2003@gmail.com>
Signed-off-by: chahat sagar <109112505+chahatsagarmain@users.noreply.github.com>
Signed-off-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
  • Loading branch information
chahatsagarmain and yurishkuro authored Jan 16, 2025
1 parent 3ba8e54 commit 2ee8e4c
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/ci-lint-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,70 @@ jobs:
- name: Run unit tests for scripts
run: |
SHUNIT2=.tools/shunit2 bash scripts/utils/compute-tags.test.sh
binary-size-check:
runs-on: ubuntu-latest
steps:
- uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
submodules: true

- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: 1.23.x

- name: Setup Node.js version
uses: ./.github/actions/setup-node.js

- name: Build jaeger binary
run: make build-jaeger

- name: Calculate jaeger binary size
run: |
TOTAL_SIZE=$(du -sb ./cmd/jaeger/jaeger-linux-amd64 | cut -f1)
echo "$TOTAL_SIZE" > ./new_jaeger_binary_size.txt
echo "Total binary size: $TOTAL_SIZE bytes"
- name: Restore previous binary size
id: cache-binary-size
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 #v4.2.0
with:
path: ./jaeger_binary_size.txt
key: jaeger_binary_size
restore-keys: |
jaeger_binary_size
- name: Compare jaeger binary sizes
if: steps.cache-binary-size.outputs.cache-hit == 'true'
run: |
OLD_BINARY_SIZE=$(cat ./jaeger_binary_size.txt)
NEW_BINARY_SIZE=$(cat ./new_jaeger_binary_size.txt)
echo "Previous binary size: $OLD_BINARY_SIZE bytes"
echo "New binary size: $NEW_BINARY_SIZE bytes"
SIZE_CHANGE=$(( $NEW_BINARY_SIZE - $OLD_BINARY_SIZE ))
PERCENTAGE_CHANGE=$(( SIZE_CHANGE * 100 / $OLD_BINARY_SIZE ))
echo "Size change: $PERCENTAGE_CHANGE%"
if [ $PERCENTAGE_CHANGE -gt 2 ]; then
echo "❌ binary size increased by more than 2% ($PERCENTAGE_CHANGE%)"
exit 1
else
echo "✅ binary size change is within acceptable range ($PERCENTAGE_CHANGE%)"
fi

- name: Remove previous *_binary_*.txt
run: |
rm -rf ./jaeger_binary_size.txt
mv ./new_jaeger_binary_size.txt ./jaeger_binary_size.txt
- name: Save new jaeger binary size
if: ${{ (github.event_name == 'push') && (github.ref == 'refs/heads/main') }}
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 #v4.2.0
with:
path: ./jaeger_binary_size.txt
key: jaeger_binary_size_${{ github.run_id }}

0 comments on commit 2ee8e4c

Please sign in to comment.