fix(sdk): install wasm-opt from Github instead of apt#2701
fix(sdk): install wasm-opt from Github instead of apt#2701QuantumExplorer merged 3 commits intov2.1-devfrom
Conversation
WalkthroughThe workflow for installing Changes
Poem
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.github/workflows/wasm-sdk-build.yml (2)
86-90: Usejqinstead ofgrep -oPfor robust JSON parsingParsing the GitHub API response with
grep -oPrelies on PCRE support and brittle string matching.jqis already available on theubuntu-latestimage 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 tarballEach CI run now fetches a ~50 MB archive even when the latest version hasn’t changed. Adding an
actions/cachestep keyed by$WASM_OPT_VERSIONwould 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
📒 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
| 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 |
There was a problem hiding this comment.
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.
| 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.
|
New build with latest commits: https://github.com/dashpay/platform/actions/runs/16276920806/job/45957945068 |
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
.github/workflows/wasm-sdk-build.yml (1)
88-112: Remove trailing whitespace – still failingyamllintThe 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 ayamllintgate.- 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: Usejqfor robust JSON parsing instead of grepParsing GitHub-API output with
grep -oPis brittle (changes in formatting or escaping will break the command).
jqis 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
📒 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
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:
For repository code-owners and collaborators only
Summary by CodeRabbit
wasm-optdirectly from GitHub releases instead of using the system package manager.