feat: appearance #141
Workflow file for this run
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
name: 🧪 Size calculation | |
on: | |
pull_request: | |
paths-ignore: | |
- "example/**" | |
- "FabricExample/**" | |
- "docs/**" | |
permissions: | |
contents: read | |
jobs: | |
calculate-sizes: | |
name: 🔬 Calculate package sizes | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout to target branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.base.ref }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18.19.0 | |
cache: yarn | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Calculate size of package (target) | |
id: old-size | |
run: echo "OLD_SIZE=$(node scripts/size.js)" >> "$GITHUB_OUTPUT" | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Pack | |
run: npm pack --json | |
- name: Calculate size of package (current) | |
id: new-size | |
run: echo "NEW_SIZE=$(node scripts/size.js)" >> "$GITHUB_OUTPUT" | |
- name: Calculate difference | |
id: diff | |
env: | |
NEW_SIZE: ${{ steps.new-size.outputs.NEW_SIZE }} | |
OLD_SIZE: ${{ steps.old-size.outputs.OLD_SIZE }} | |
run: | | |
echo "DIFF=$((NEW_SIZE - OLD_SIZE))" >> "$GITHUB_OUTPUT" | |
echo "SIGN=$([ $((NEW_SIZE - OLD_SIZE)) -gt 0 ] && echo "📈" || echo "📉")" >> "$GITHUB_OUTPUT" | |
- name: Create size data files | |
run: | | |
echo "${{ steps.new-size.outputs.NEW_SIZE }}" > new-size.txt | |
echo "${{ steps.old-size.outputs.OLD_SIZE }}" > old-size.txt | |
echo "${{ steps.diff.outputs.DIFF }}" > diff.txt | |
echo "${{ steps.diff.outputs.SIGN }}" > sign.txt | |
echo "${{ github.event.pull_request.number }}" > pr-number.txt | |
- name: Upload size data | |
uses: actions/upload-artifact@v4 | |
with: | |
name: size-data | |
path: | | |
new-size.txt | |
old-size.txt | |
diff.txt | |
sign.txt | |
pr-number.txt | |
retention-days: 1 |