Report #69
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: Report | |
| on: | |
| schedule: | |
| - cron: 0 0 * * 1,3,5 | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| report-wasm-size: | |
| name: WASM size report | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| target: wasm32-unknown-unknown | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .node-version | |
| cache: npm | |
| - name: Install tooling dependencies | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-make,cargo-machete | |
| - name: Install Node.js dependencies | |
| run: npm ci --no-audit --no-fund | |
| - name: Build | |
| run: cargo make build | |
| env: | |
| RELEASE: true | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Show dist tree | |
| run: tree -ah -L 1 app/dist | |
| - name: Create WebAssembly report | |
| run: | | |
| echo "## 📦 WASM bundles sizes" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| App | Bytes | KB | MB |" >> $GITHUB_STEP_SUMMARY | |
| echo "|-----|-------|----|----|" >> $GITHUB_STEP_SUMMARY | |
| total_bytes=0 | |
| while IFS= read -r wasm_file; do | |
| app_name=$(basename "$wasm_file" _bg.wasm | sed 's/-[0-9]\+$//') | |
| size_in_bytes=$(wc -c < "$wasm_file") | |
| size_in_kb=$(echo "scale=2; $size_in_bytes / 1024" | bc -l) | |
| size_in_mb=$(echo "scale=2; $size_in_kb / 1024" | bc -l) | |
| echo "| \`$app_name\` | $size_in_bytes | $size_in_kb | $size_in_mb |" >> $GITHUB_STEP_SUMMARY | |
| total_bytes=$((total_bytes + size_in_bytes)) | |
| done < <(find app/dist -name "*_bg.wasm" -type f | sort) | |
| if [ $total_bytes -gt 0 ]; then | |
| total_kb=$(echo "scale=2; $total_bytes / 1024" | bc -l) | |
| total_mb=$(echo "scale=2; $total_kb / 1024" | bc -l) | |
| echo "| **Total** | **$total_bytes** | **$total_kb** | **$total_mb** |" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "| *No WASM files found* | - | - | - |" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| # Website (dist folder) | |
| website_size_bytes=$(du -sb app/dist | cut -f1) | |
| website_size_kb=$(echo "scale=2; $website_size_bytes / 1024" | bc -l) | |
| website_size_mb=$(echo "scale=2; $website_size_kb / 1024" | bc -l) | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "## Website's dist folder size" >> $GITHUB_STEP_SUMMARY | |
| echo "| Bytes | KB | MB |" >> $GITHUB_STEP_SUMMARY | |
| echo "|-------|----|----|" >> $GITHUB_STEP_SUMMARY | |
| echo "| $website_size_bytes | $website_size_kb | $website_size_mb |" >> $GITHUB_STEP_SUMMARY |