feat: add new workflows for binary size tracking and spell checking; … #3
Workflow file for this run
This file contains hidden or 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
| name: Binary Size Tracker | |
| on: | |
| pull_request: | |
| branches: [ main, develop ] | |
| paths: | |
| - '**/*.go' | |
| - 'go.mod' | |
| - 'go.sum' | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| size: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout PR | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.24' | |
| cache: true | |
| - name: Build PR Binary | |
| run: | | |
| go build -o arc-pr ./cmd/arc | |
| PR_SIZE=$(stat -f%z arc-pr 2>/dev/null || stat -c%s arc-pr) | |
| echo "pr_size=$PR_SIZE" >> $GITHUB_OUTPUT | |
| id: pr | |
| - name: Checkout Base | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.base_ref }} | |
| - name: Build Base Binary | |
| run: | | |
| go build -o arc-base ./cmd/arc | |
| BASE_SIZE=$(stat -f%z arc-base 2>/dev/null || stat -c%s arc-base) | |
| echo "base_size=$BASE_SIZE" >> $GITHUB_OUTPUT | |
| id: base | |
| - name: Compare Sizes | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const prSize = ${{ steps.pr.outputs.pr_size }}; | |
| const baseSize = ${{ steps.base.outputs.base_size }}; | |
| const diff = prSize - baseSize; | |
| const diffPercent = ((diff / baseSize) * 100).toFixed(2); | |
| const prMB = (prSize / 1024 / 1024).toFixed(2); | |
| const baseMB = (baseSize / 1024 / 1024).toFixed(2); | |
| const diffMB = (Math.abs(diff) / 1024 / 1024).toFixed(2); | |
| let emoji = '📊'; | |
| let message = 'unchanged'; | |
| if (diff > 0) { | |
| emoji = diff > 1000000 ? '🔴' : '🟡'; | |
| message = `increased by ${diffMB} MB (+${diffPercent}%)`; | |
| } else if (diff < 0) { | |
| emoji = '🟢'; | |
| message = `decreased by ${diffMB} MB (${diffPercent}%)`; | |
| } | |
| const body = `## ${emoji} Binary Size Report | |
| | Metric | Size | | |
| |--------|------| | |
| | **Base** | ${baseMB} MB | | |
| | **PR** | ${prMB} MB | | |
| | **Change** | ${message} | | |
| ${diff > 1000000 ? '⚠️ Binary size increased by more than 1 MB. Consider investigating.' : ''}`; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: body | |
| }); | |