Skip to content

fix(sdk): install wasm-opt from Github instead of apt#2701

Merged
QuantumExplorer merged 3 commits intov2.1-devfrom
fix/install-wasm-opt-from-github
Jul 24, 2025
Merged

fix(sdk): install wasm-opt from Github instead of apt#2701
QuantumExplorer merged 3 commits intov2.1-devfrom
fix/install-wasm-opt-from-github

Conversation

@ktechmidas
Copy link
Collaborator

@ktechmidas ktechmidas commented Jul 14, 2025

Issue being fixed or feature implemented

We are installing wasm-pack from latest release and installing an old version of wasm-opt from the Ubuntu repositories - this is causing version mismatch problems

What was done?

Install the latest wasm-opt instead of the one from apt

How Has This Been Tested?

CI - https://github.com/dashpay/platform/actions/runs/16276671946/job/45957134828

Breaking Changes

None

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • Chores
    • Updated the workflow to install the latest version of wasm-opt directly from GitHub releases instead of using the system package manager.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 14, 2025

Walkthrough

The workflow for installing wasm-opt in the GitHub Actions YAML file was updated. Instead of using the system package manager to install Binaryen, the process now dynamically fetches the latest Binaryen release from GitHub, detects system architecture, downloads and extracts the appropriate tarball, installs the wasm-opt binary manually, and handles unsupported architectures explicitly.

Changes

File(s) Change Summary
.github/workflows/wasm-sdk-build.yml Replaced apt-get install binaryen with dynamic GitHub API fetch of latest Binaryen release; added architecture detection, manual binary extraction, installation, and error handling for unsupported architectures.

Poem

In the burrow where workflows hop,
We fetch our tools right from the top!
No more apt-get, we go direct—
The latest wasm-opt, we now collect.
With binaries fresh and actions neat,
Our builds are swift, our hops complete! 🐇✨


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ktechmidas ktechmidas changed the title fix(actions): install wasm-opt from Github instead of apt fix(sdk): install wasm-opt from Github instead of apt Jul 14, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/wasm-sdk-build.yml (2)

86-90: Use jq instead of grep -oP for robust JSON parsing

Parsing the GitHub API response with grep -oP relies on PCRE support and brittle string matching. jq is already available on the ubuntu-latest image and gives safer error handling:

-WASM_OPT_VERSION=$(curl -s https://api.github.com/repos/WebAssembly/binaryen/releases/latest | grep -oP '"tag_name": "\K[^"]+')
+WASM_OPT_VERSION=$(curl -s https://api.github.com/repos/WebAssembly/binaryen/releases/latest \
+                   | jq -r '.tag_name')

This avoids false matches if the JSON layout changes and fails fast when the field is missing.


90-98: Consider caching the downloaded Binaryen tarball

Each CI run now fetches a ~50 MB archive even when the latest version hasn’t changed. Adding an actions/cache step keyed by $WASM_OPT_VERSION would cut ~25 s off the job wall-time and reduce bandwidth costs.

If you need a snippet, let me know.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between efd8cb1 and a2de60a.

📒 Files selected for processing (1)
  • .github/workflows/wasm-sdk-build.yml (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: shumkov
PR: dashpay/platform#2329
File: .github/workflows/tests-build-js.yml:16-19
Timestamp: 2024-11-15T07:06:20.391Z
Learning: In GitHub Actions workflows, if you need to check for the existence of an artifact without downloading it, the official `actions/download-artifact@v4` doesn't provide this capability. Using a third-party action like `softwareforgood/check-artifact-v4-existence@v0` is acceptable for this purpose.
.github/workflows/wasm-sdk-build.yml (1)
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/lib.rs:13-17
Timestamp: 2025-01-23T09:43:25.080Z
Learning: The codebase uses tracing_wasm for WebAssembly tracing as it provides sufficient functionality for the project's needs.
🪛 YAMLlint (1.37.1)
.github/workflows/wasm-sdk-build.yml

[error] 88-88: trailing spaces

(trailing-spaces)


[error] 92-92: trailing spaces

(trailing-spaces)


[error] 96-96: trailing spaces

(trailing-spaces)


[error] 99-99: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build-wasm-sdk
  • GitHub Check: Build JS packages / Build JS

Comment on lines +84 to 101
echo "Installing wasm-opt from GitHub releases..."
# Get the latest release version
WASM_OPT_VERSION=$(curl -s https://api.github.com/repos/WebAssembly/binaryen/releases/latest | grep -oP '"tag_name": "\K[^"]+')
echo "Installing wasm-opt version: $WASM_OPT_VERSION"

# Download and extract binaryen
curl -L "https://github.com/WebAssembly/binaryen/releases/download/${WASM_OPT_VERSION}/binaryen-${WASM_OPT_VERSION}-x86_64-linux.tar.gz" -o /tmp/binaryen.tar.gz
tar -xzf /tmp/binaryen.tar.gz -C /tmp

# Move wasm-opt to PATH
sudo mv /tmp/binaryen-${WASM_OPT_VERSION}/bin/wasm-opt /usr/local/bin/
sudo chmod +x /usr/local/bin/wasm-opt

# Clean up
rm -rf /tmp/binaryen.tar.gz /tmp/binaryen-${WASM_OPT_VERSION}

echo "wasm-opt installed successfully"
else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove trailing whitespace – YAML-lint is currently flagging 4 errors

The CI lint step reports trailing-space violations on lines 88, 92, 96 and 99. They are harmless to the runner but will keep the workflow from passing a yamllint gate.

-            echo "Installing wasm-opt version: $WASM_OPT_VERSION"␠
+            echo "Installing wasm-opt version: $WASM_OPT_VERSION"
@@
-            tar -xzf /tmp/binaryen.tar.gz -C /tmp␠
+            tar -xzf /tmp/binaryen.tar.gz -C /tmp
@@
-            sudo chmod +x /usr/local/bin/wasm-opt␠
+            sudo chmod +x /usr/local/bin/wasm-opt
@@
-            rm -rf /tmp/binaryen.tar.gz /tmp/binaryen-${WASM_OPT_VERSION}␠
+            rm -rf /tmp/binaryen.tar.gz /tmp/binaryen-${WASM_OPT_VERSION}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
echo "Installing wasm-opt from GitHub releases..."
# Get the latest release version
WASM_OPT_VERSION=$(curl -s https://api.github.com/repos/WebAssembly/binaryen/releases/latest | grep -oP '"tag_name": "\K[^"]+')
echo "Installing wasm-opt version: $WASM_OPT_VERSION"
# Download and extract binaryen
curl -L "https://github.com/WebAssembly/binaryen/releases/download/${WASM_OPT_VERSION}/binaryen-${WASM_OPT_VERSION}-x86_64-linux.tar.gz" -o /tmp/binaryen.tar.gz
tar -xzf /tmp/binaryen.tar.gz -C /tmp
# Move wasm-opt to PATH
sudo mv /tmp/binaryen-${WASM_OPT_VERSION}/bin/wasm-opt /usr/local/bin/
sudo chmod +x /usr/local/bin/wasm-opt
# Clean up
rm -rf /tmp/binaryen.tar.gz /tmp/binaryen-${WASM_OPT_VERSION}
echo "wasm-opt installed successfully"
else
echo "Installing wasm-opt from GitHub releases..."
# Get the latest release version
WASM_OPT_VERSION=$(curl -s https://api.github.com/repos/WebAssembly/binaryen/releases/latest | grep -oP '"tag_name": "\K[^"]+')
echo "Installing wasm-opt version: $WASM_OPT_VERSION"
# Download and extract binaryen
curl -L "https://github.com/WebAssembly/binaryen/releases/download/${WASM_OPT_VERSION}/binaryen-${WASM_OPT_VERSION}-x86_64-linux.tar.gz" -o /tmp/binaryen.tar.gz
tar -xzf /tmp/binaryen.tar.gz -C /tmp
# Move wasm-opt to PATH
sudo mv /tmp/binaryen-${WASM_OPT_VERSION}/bin/wasm-opt /usr/local/bin/
sudo chmod +x /usr/local/bin/wasm-opt
# Clean up
rm -rf /tmp/binaryen.tar.gz /tmp/binaryen-${WASM_OPT_VERSION}
echo "wasm-opt installed successfully"
else
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 88-88: trailing spaces

(trailing-spaces)


[error] 92-92: trailing spaces

(trailing-spaces)


[error] 96-96: trailing spaces

(trailing-spaces)


[error] 99-99: trailing spaces

(trailing-spaces)

🤖 Prompt for AI Agents
In .github/workflows/wasm-sdk-build.yml between lines 84 and 101, remove any
trailing whitespace characters at the end of lines 88, 92, 96, and 99 to fix the
yamllint trailing-space violations. Ensure each line ends immediately after the
last visible character without extra spaces or tabs.

@ktechmidas
Copy link
Collaborator Author

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
.github/workflows/wasm-sdk-build.yml (1)

88-112: Remove trailing whitespace – still failing yamllint

The CI lint step is again flagging trailing-space violations on the lines shown below.
This was pointed out in an earlier review but the whitespace is still present, so the workflow will continue to fail a yamllint gate.

-            echo "Installing wasm-opt version: $WASM_OPT_VERSION"␠
+            echo "Installing wasm-opt version: $WASM_OPT_VERSION"
@@
-              echo "Unsupported architecture: $ARCH"␠
+              echo "Unsupported architecture: $ARCH"
@@
-            echo "Detected architecture: $ARCH, using binaryen arch: $BINARYEN_ARCH"␠
+            echo "Detected architecture: $ARCH, using binaryen arch: $BINARYEN_ARCH"
@@
-            tar -xzf /tmp/binaryen.tar.gz -C /tmp␠
+            tar -xzf /tmp/binaryen.tar.gz -C /tmp
@@
-            sudo chmod +x /usr/local/bin/wasm-opt␠
+            sudo chmod +x /usr/local/bin/wasm-opt
@@
-            rm -rf /tmp/binaryen.tar.gz /tmp/binaryen-${WASM_OPT_VERSION}␠
+            rm -rf /tmp/binaryen.tar.gz /tmp/binaryen-${WASM_OPT_VERSION}

Please strip the trailing spaces to unblock the lint job.

🧹 Nitpick comments (1)
.github/workflows/wasm-sdk-build.yml (1)

86-87: Use jq for robust JSON parsing instead of grep

Parsing GitHub-API output with grep -oP is brittle (changes in formatting or escaping will break the command).
jq is pre-installed on the Ubuntu runner and gives a safer one-liner:

-WASM_OPT_VERSION=$(curl -s https://api.github.com/repos/WebAssembly/binaryen/releases/latest | grep -oP '"tag_name": "\K[^"]+')
+WASM_OPT_VERSION=$(curl -s https://api.github.com/repos/WebAssembly/binaryen/releases/latest | jq -r .tag_name)

This avoids relying on PCRE look-behind and makes the script easier to maintain.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a2de60a and b423c75.

📒 Files selected for processing (1)
  • .github/workflows/wasm-sdk-build.yml (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: shumkov
PR: dashpay/platform#2329
File: .github/workflows/tests-build-js.yml:16-19
Timestamp: 2024-11-15T07:06:20.391Z
Learning: In GitHub Actions workflows, if you need to check for the existence of an artifact without downloading it, the official `actions/download-artifact@v4` doesn't provide this capability. Using a third-party action like `softwareforgood/check-artifact-v4-existence@v0` is acceptable for this purpose.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/lib.rs:13-17
Timestamp: 2025-01-23T09:43:25.080Z
Learning: The codebase uses tracing_wasm for WebAssembly tracing as it provides sufficient functionality for the project's needs.
.github/workflows/wasm-sdk-build.yml (6)
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/lib.rs:13-17
Timestamp: 2025-01-23T09:43:25.080Z
Learning: The codebase uses tracing_wasm for WebAssembly tracing as it provides sufficient functionality for the project's needs.
Learnt from: lklimek
PR: dashpay/platform#2344
File: .github/workflows/release-docker-image.yml:66-70
Timestamp: 2024-11-25T12:59:11.416Z
Learning: In the CI workflows (e.g., `.github/workflows/release-docker-image.yml` and `tests-build-image.yml`), we do not add validation steps for cache configuration variables. We rely on the build process to quickly reveal any misconfigurations.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-01T13:35:47.879Z
Learning: Applies to **/*.{js,ts,tsx} : Lint JavaScript/TypeScript code using `yarn lint`
Learnt from: shumkov
PR: dashpay/platform#2346
File: .github/workflows/release-docker-image.yml:57-59
Timestamp: 2024-11-25T08:31:59.900Z
Learning: In `.github/workflows/prebuild-devcontainers.yml`, the QEMU setup step is intentionally enabled unconditionally because devcontainers are built for both platforms (`linux/amd64` and `linux/arm64`), so QEMU is needed regardless of platform.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: lklimek
PR: dashpay/platform#2344
File: .github/actions/sccache/action.yaml:0-0
Timestamp: 2024-11-26T12:46:54.812Z
Learning: In the `.github/actions/sccache/action.yaml` file, the environment variables `CC` and `CXX` need quotes around their values (e.g., `CC="sccache cc"`) to be interpreted correctly.
🪛 YAMLlint (1.37.1)
.github/workflows/wasm-sdk-build.yml

[error] 88-88: trailing spaces

(trailing-spaces)


[error] 99-99: trailing spaces

(trailing-spaces)


[error] 101-101: trailing spaces

(trailing-spaces)


[error] 105-105: trailing spaces

(trailing-spaces)


[error] 109-109: trailing spaces

(trailing-spaces)


[error] 112-112: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build-wasm-sdk
  • GitHub Check: Build JS packages / Build JS

@QuantumExplorer QuantumExplorer merged commit dde8678 into v2.1-dev Jul 24, 2025
20 checks passed
@QuantumExplorer QuantumExplorer deleted the fix/install-wasm-opt-from-github branch July 24, 2025 14:20
@thephez thephez added this to the v2.1.0 milestone Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants