extism / js-pdk

Write Extism plugins in JavaScript & TypeScript
BSD 3-Clause "New" or "Revised" License
56 stars 16 forks source link

feat(release): add windows cli release workflow #81

Closed mtb0x1 closed 5 months ago

mtb0x1 commented 5 months ago

Closes #25

This PR enable windows support for js-pdk cli.

The approach is minimalist and use line-by-line translation for the existing configs/code to facilitate the change validation. This have an impact on performance in some case (Test CI for windows) takes ~15min, some rework would be need to reduce the build time but I hope this would be fine for now.

As discussed in discord, wasm-opt v117 seems to have a bug. In order to avoid running into it :

CI 'Install script for windows' will probably fail first run as it will try to install a version that doesn't exist yet windows v1.0.0-rc10

(1) Indirect positive consequence of this, cli binary size is reduced slightly AND I observed 2x speed improvement with versions having an already optimized core. (2) This doesn't grantee avoiding the issue, if Binaryen v117 is installed beforehand. Overall I don't think this is a high probability case (Windows manual build + Binaryen v117 already installed)

You can already check cli files for windows (x86_64 and arm64) https://github.com/mtb0x1/js-pdk/releases

bhelx commented 5 months ago

This is awesome! Will take a look

mtb0x1 commented 5 months ago

We need for now to freeze Binaryen's version to 116 and not upgrade it.

https://github.com/WebAssembly/binaryen/issues/6639 is solved, fix will most likely land in v118. (so we only need to avoid v117 on windows)

bhelx commented 5 months ago

The windows CI seems to still be failing:

Run powershell -executionpolicy bypass -File .\install-windows.ps1
ARCH is x86_64.
Downloading extism-js version v1.0.0-rc10.
Install Failed: Not Found.Exception.Message
extism-js: D:\a\_temp\69fb9ce1-c96d-4db0-9ca8-41fabb97bab3.ps1:3
Line |
   3 |  extism-js --version
     |  ~~~~~~~~~
     | The term 'extism-js' is not recognized as a name of a cmdlet, function, script file, or executable program.
     | Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Error: Process completed with exit code 1.

Perhaps extism-js is not making it on the path or something?

mtb0x1 commented 5 months ago

@bhelx

Downloading extism-js version v1.0.0-rc10.
Install Failed: Not Found.Exception.Message

The CI should've stopped at the install script, since it didn't find the gz to dl. (which is normal since it tries to dl https://github.com/extism/js-pdk/releases/download/v1.0.0-rc10/extism-js-x86_64-windows-v1.0.0-rc10.gz and it doesn't exist yet). This would be the first issue.

The second one is the content of PR and this would be my fault, I think we need at least to split this PR to two PRs:

PR2 would be merged only once PR1 is merged and a new release is available.

bhelx commented 5 months ago

Sounds good, I also don't mind merging and we can re-test the install script with a manual triggered action later. Let me know what you want to do.

mtb0x1 commented 5 months ago

Sounds good, I also don't mind merging and we can re-test the install script with a manual triggered action later. Let me know what you want to do.

go ahead and merge. if any issues later I will provide assistance.

bhelx commented 5 months ago

Awesome! thank you for the contribution!