chore: release v0.6.1 #292
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: WASM CI | |
| on: | |
| pull_request: | |
| branches: ["main"] | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| cargo-test-wasm: | |
| runs-on: ubuntu-latest | |
| name: "cargo test (wasm)" | |
| steps: | |
| - name: "Checkout PR branch" | |
| uses: actions/checkout@v6 | |
| with: | |
| path: pr-branch | |
| - name: "Checkout base branch" | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.base_ref }} | |
| path: base-branch | |
| - name: "Install Rust toolchain" | |
| run: rustup target add wasm32-unknown-unknown | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "./pr-branch -> target" | |
| - name: "Get wasm-bindgen version" | |
| id: wasm-bindgen-version | |
| working-directory: ./pr-branch | |
| run: | | |
| VERSION=$(grep -A 1 'name = "wasm-bindgen"' Cargo.lock | grep version | sed 's/.*"\(.*\)".*/\1/') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "version=$VERSION" | |
| - name: "Install wasm-bindgen-cli" | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: wasm-bindgen-cli@${{ steps.wasm-bindgen-version.outputs.version }} | |
| - name: "Install wasm-opt" | |
| uses: jaxxstorm/action-install-gh-release@v2.1.0 | |
| with: | |
| repo: WebAssembly/binaryen | |
| tag: version_128 | |
| binaries-location: binaryen-version_128/bin | |
| chmod: 0755 | |
| - name: "Get wasm size on PR" | |
| working-directory: ./pr-branch | |
| run: | | |
| make playground | |
| SIZE_BYTES=$(stat -c %s playground/pkg/math_core_wasm_bg.wasm) | |
| echo "Wasm size on PR: $SIZE_BYTES bytes" | |
| echo "PR_SIZE_BYTES=$SIZE_BYTES" >> $GITHUB_ENV | |
| - name: "Get wasm size on base branch" | |
| working-directory: ./base-branch | |
| run: | | |
| make playground | |
| SIZE_BYTES=$(stat -c %s playground/pkg/math_core_wasm_bg.wasm) | |
| echo "Wasm size on base: $SIZE_BYTES bytes" | |
| echo "BASE_SIZE_BYTES=$SIZE_BYTES" >> $GITHUB_ENV | |
| - name: "Comment on PR with WASM sizes" | |
| uses: actions/github-script@v8 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const prSize = process.env.PR_SIZE_BYTES; | |
| const baseSize = process.env.BASE_SIZE_BYTES; | |
| const sizeDiff = prSize - baseSize; | |
| const sizeDiffPercent = (sizeDiff / baseSize) * 100; | |
| const sizeDiffPercentStr = sizeDiffPercent.toFixed(2); | |
| const sizeDiffStr = sizeDiff > 0 ? `+${sizeDiff}` : `${sizeDiff}`; | |
| const comment = `Wasm sizes:\nBase branch: ${baseSize} bytes\nPR: ${prSize} bytes\nSize diff: ${sizeDiffStr} bytes (${sizeDiffPercentStr}%)`; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: comment | |
| }) |