Skip to content
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: Report wheel sizes #20541

Merged
merged 9 commits into from
Jan 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 58 additions & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,63 @@ jobs:
working-directory: py-polars
run: maturin develop --release -- -C codegen-units=8 -C lto=thin -C target-cpu=native

- name: Set wheel size
run: |
WHEEL_SIZE=$(ls -l py-polars/polars/polars*.so | awk '{ print $5 }')
echo "WHEEL_SIZE=$WHEEL_SIZE" >> $GITHUB_ENV

- name: Upload wheel sizes artifact (main only)
if: github.ref_name == 'main'
uses: actions/upload-artifact@v3
with:
name: wheel-size
path: |
echo "$GITHUB_RUN_ID $WHEEL_SIZE" > wheel_sizes.txt
wheel_sizes.txt

- name: Download main wheel size
uses: actions/download-artifact@v3
with:
name: wheel-size
continue-on-error: true

- name: Extract previous wheel size
id: load_previous_size
run: |
if [[ -f wheel_sizes.txt ]]; then
PREVIOUS_WHEEL_SIZE=$(tail -n 1 wheel_sizes.txt | awk '{ print $2 }')
echo "PREVIOUS_WHEEL_SIZE=$PREVIOUS_WHEEL_SIZE" >> $GITHUB_ENV
else
echo "PREVIOUS_WHEEL_SIZE=Unknown" >> $GITHUB_ENV
fi

- name: Comment wheel size
uses: actions/github-script@v7
with:
script: |
const previousSize = process.env.PREVIOUS_WHEEL_SIZE || 'Unknown';
const currentSize = process.env.WHEEL_SIZE || 'Unknown';

// Convert to MB
const previousSizeMB = previousSize !== 'Unknown' ? (previousSize / 1024 / 1024).toFixed(4) : 'Unknown';
const currentSizeMB = currentSize !== 'Unknown' ? (currentSize / 1024 / 1024).toFixed(4) : 'Unknown';

let commentBody = `The previous wheel size was **${previousSizeMB} MB**.\nThe current wheel size after this PR is **${currentSizeMB} MB**.`;

// Calculate percentage increase if both sizes are available
if (previousSize !== 'Unknown' && currentSize !== '') {
const increase = ((currentSize - previousSize) / previousSize) * 100;
commentBody += `\nThis represents a **${increase.toFixed(2)}% increase** in size.`;
}

github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});


- name: Run benchmark tests
uses: CodSpeedHQ/action@v3
with:
Expand All @@ -87,4 +144,4 @@ jobs:
working-directory: py-polars
env:
POLARS_AUTO_NEW_STREAMING: 1
run: pytest -n auto --dist loadgroup -m "not may_fail_auto_streaming and not slow and not write_disk and not release and not docs and not hypothesis and not benchmark and not ci_only"
run: pytest -n auto --dist loadgroup -m "not may_fail_auto_streaming and not slow and not write_disk and not release and not docs and not hypothesis and not benchmark and not ci_only"
Loading