-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CI] Add workflow to guard against increases in the binary size #6529
Merged
yurishkuro
merged 17 commits into
jaegertracing:main
from
chahatsagarmain:jaeger-bundle-ci
Jan 16, 2025
Merged
Changes from 13 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
6951dae
added workflow to check bundle size
chahatsagarmain bc8c006
use only one binary
chahatsagarmain 614823e
minor fix
chahatsagarmain 4741a3b
Merge branch 'main' into jaeger-bundle-ci
chahatsagarmain 230171c
minor changes
chahatsagarmain 23b39ae
Merge branch 'jaeger-bundle-ci' of https://github.com/chahatsagarmain…
chahatsagarmain 1f4915f
minor change
chahatsagarmain 3cc8f37
fixes
chahatsagarmain 6d30ca1
changes
chahatsagarmain cd74eb3
changes
chahatsagarmain 9220d5d
changes
chahatsagarmain 0a8b747
Update .github/workflows/ci-check-bundle-size.yml
chahatsagarmain 943cd4d
Update .github/workflows/ci-check-bundle-size.yml
chahatsagarmain 48431a6
remove fetch tags
chahatsagarmain 5ee2456
move to lint checks
chahatsagarmain 98b8ca8
Update .github/workflows/ci-lint-checks.yaml
yurishkuro 864bad6
Merge branch 'main' into jaeger-bundle-ci
yurishkuro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,88 @@ | ||||
name: Check Binaries binary size | ||||
|
||||
on: | ||||
push: | ||||
branches: [main] | ||||
|
||||
pull_request: | ||||
branches: [main] | ||||
|
||||
concurrency: | ||||
group: ${{ github.workflow }}-${{ (github.event.pull_request && github.event.pull_request.number) || github.ref || github.run_id }} | ||||
cancel-in-progress: true | ||||
|
||||
# See https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions | ||||
permissions: | ||||
contents: read | ||||
|
||||
jobs: | ||||
build-and-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 | ||||
|
||||
- name: Fetch git tags | ||||
run: | | ||||
git fetch --prune --unshallow --tags | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this necessary? We don't rely on tags in this workflow There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we dont need it , this was used here
|
||||
|
||||
- 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 }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's move this as yet another job into .github/workflows/ci-lint-checks.yaml so that it runs as part of the overall lint group.