Skip to content

perf(es/minifier): reduce usage analysis overhead #1871

perf(es/minifier): reduce usage analysis overhead

perf(es/minifier): reduce usage analysis overhead #1871

Workflow file for this run

name: Binary Size Check - Build
on:
pull_request:
types: ["opened", "reopened", "synchronize"]
env:
CI: 1
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: "always"
RUST_LOG: "off"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
measure-binary-size:
name: Measure Binary Size
runs-on: ubuntu-latest
# No special permissions needed - this workflow only reads and uploads artifacts
permissions:
contents: read
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
- name: Setup Node.js
uses: ./.github/actions/setup-node
id: setup-node
with:
node-version: "20"
install-dependencies: "false"
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Save pnpm cache
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
if: github.ref == 'refs/heads/main' && steps.setup-node.outputs.pnpm-cache-hit != 'true'
with:
path: ${{ steps.setup-node.outputs.pnpm-store-path }}
key: ${{ steps.setup-node.outputs.pnpm-cache-primary-key }}
- name: Build
run: pnpm build
- name: Measure binary sizes
id: measure
run: |
echo "## Binary Sizes" > size_report.md
echo "" >> size_report.md
echo "| File | Size |" >> size_report.md
echo "|------|------|" >> size_report.md
for file in ./packages/core/swc.*.node; do
if [ -f "$file" ]; then
filename=$(basename "$file")
size=$(ls -lh "$file" | awk '{print $5}')
size_bytes=$(stat -c%s "$file" 2>/dev/null || stat -f%z "$file")
echo "| \`$filename\` | $size ($size_bytes bytes) |" >> size_report.md
fi
done
echo "" >> size_report.md
echo "*Commit: ${{ github.sha }}*" >> size_report.md
- name: Upload size report
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: size-report
path: size_report.md
retention-days: 1