Commit Graph

66 Commits

Author SHA1 Message Date
Benjamin Eckel
4ebd0eb372 chore: always run the publish of SDK 2023-09-18 19:17:47 -05:00
Benjamin Eckel
12820aecff fix: ignore already published manifest (#351) 2023-05-19 15:35:35 -05:00
zach
0f8954c203 feat!: add ability to create plugins without an existing Context (#335)
EIP: https://github.com/extism/proposals/pull/8

This PR makes minor breaking changes to several SDKs, but not to runtime
C API. The threadsafety updates in the Rust SDK are kind of specific to
Rust, I'm not sure if it makes sense to add the locks to all the other
SDKs at this point. For the most part the `Context` and `Plugin` types
in the SDKs should be safe to use protected by a mutex but they aren't
inherently threadsafe. That kind of locking should probably be done by
the user.

- Runtime 
  - improve thread safety
  - reinstantiates less
- fixes a potential resource exhaustion bug from re-instantiating using
the same store too many times
- Rust SDK
  - adds `Send` and `Sync` implementations for `Context`
  - adds test sharing a context between threads
- adds `Plugin::call_map` to call a plugin and handle the output with
the lock held
  - adds testing sharing an `Arc<Mutex<Plugin>>` between threads
- adds `Plugin::create` and `Plugin::create_from_manifest` to create a
plugin without a `Context`
- Python
  - BREAKING
- changes `Plugin` constructor to take `context` as an optional named
argument, to update use `Plugin(data, context=context)` instead
 - Ruby
   - BREAKING
- changes `Plugin` constructor to take `context` as an optional named
argument, to update use `Plugin.new(data, context=context)` instead
 - Go
   - adds `NewPlugin` and `NewPluginFromManifest` functions
 - Node
   - BREAKING
- changes `Plugin` constructor to take `context` as an optional named
argument, to update use `new Plugin(data, wasi, config, host, context)`
instead of `new Plugin(context, data, wasi, functions, config)` (most
people are probably using `context.plugin` instead of the Plugin
constructor anyway)
 - OCaml
   - BREAKING
- changes `Plugin.create` and `Plugin.of_manifest` to take `context` as
an optional named argument, to update `Plugin.create ~context data` and
`Plugin.of_manifest ~context data` instead
- Haskell
  - adds `createPlugin` and `createPluginFromManifest` functions
 - Elixir
- adds `Plugin.new` to make a plugin without going through
`Context.new_plugin`
 - Java
   - adds new `Plugin` constructors without a `Context` argument
- C++
  - BREAKING
- Updates `Plugin` constructor to take an optional context as the last
argument, instead of requiring it to be the first argument
- Use `Plugin(wasm, wasi, functions, ctx)` instead of `Plugin(ctx, wasm,
wasi, functions)`
 - Zig
- Adds `Plugin.create` and `Plugin.createWithManifest` to create plugins
in their own context.

---------

Co-authored-by: zach <zach@dylib.so>
Co-authored-by: Benjamin Eckel <bhelx@simst.im>
2023-05-17 11:35:16 -07:00
zach
a0ec6a3083 fix(rust): use CString for strings passed to to set_log_file (#341) 2023-05-12 09:23:31 -07:00
Doğu Us
f0f53c7827 feat(zig-sdk): Implement Host Functions (#249)
There are some breaking changes:

- Plugin.init now requires an allocator and functions slice
- Plugin.initFromManifest now requires a functions slice
- Plugin struct removed in favor of using the file as struct
- from @nilslice: https://zig.news/gowind/zig-files-are-structs-288j
(good reference!)

---------

Co-authored-by: Steve Manuel <steve@dylib.so>
2023-02-12 12:36:27 -07:00
Benjamin Eckel
beb83c697c test(browser): Comment out test so we stop failure (#238)
Can't quite figure out what is going on. Jest cannot resolves our code
fine but can't seem to resolve the NPM module:

```
 FAIL  src/index.test.ts
  ● Test suite failed to run

    Cannot find module '@bjorn3/browser_wasi_shim' from 'src/plugin.ts'

    Require stack:
      src/plugin.ts
      src/context.ts
      src/index.ts
      src/index.test.ts

      2 | import { PluginConfig } from './manifest';
      3 | //@ts-ignore TODO add types to this library
    > 4 | import { WASI, File } from "@bjorn3/browser_wasi_shim";
        | ^
      5 |
      6 | export default class ExtismPlugin {
      7 |   moduleData: ArrayBuffer;

      at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:425:11)
      at Object.<anonymous> (src/plugin.ts:4:1)
      at Object.<anonymous> (src/context.ts:2:1)
      at Object.<anonymous> (src/index.ts:1:1)
      at Object.<anonymous> (src/index.test.ts:1:1)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.916 s
Ran all test suites.
```


For now let's comment it out since it's not providing value anyway.
2023-01-23 14:25:14 -06:00
Benjamin Eckel
be3f324641 fix: Haskell release workflow had wrong display name 2023-01-19 12:45:42 -06:00
zach
aa04fd3e5c test: add more host function tests, cleanup tests to use wasm/code.wasm when possible (#219) 2023-01-19 10:09:16 -06:00
Benjamin Eckel
d73468a3ac ci(java-sdk): Test on multiple JREs (#221) 2023-01-18 10:43:59 -06:00
Etienne ANNE
ac7e1aeba3 Support jdk11 (#208)
Hi,

We want to use Extism on our project
[Otoroshi](https://github.com/MAIF/otoroshi) but we need to run it on
jdk11

This pull request makes everything run smoothly on jdk11

If you have any suggestion about this pull request, i'm open to it

Thanks for your time
2023-01-18 09:48:36 -06:00
Benjamin Eckel
87a403b7f3 Fix: Fixes Runtime problem with ESM module (#199)
Takes new version of the wasi shim and ensures that both CJS and ESM
distributions can be built.


Already published as 0.2.2

Co-authored-by: Steve Manuel <steve@dylib.so>
2023-01-04 18:01:48 -06:00
Doğu Us
6f534336f3 feat(zig-sdk): Create Zig Host Sdk (#186) 2023-01-02 15:30:34 -07:00
zach
094f51ba2b refactor(ocaml): Cleanup code, split out extism-manifest package, prepare to release with next runtime release (#182) 2022-12-22 10:43:24 -08:00
zach
9ccef562a9 ci: use glob for paths (#178) 2022-12-19 15:09:57 -08:00
zach
ba69d9fcc8 chore: move each language to separate workflow (#176)
- Moves each language into a separate workflow
- Only runs CI for languages when they're changed (or when the runtime
is changed)
2022-12-19 12:38:50 -08:00
Benjamin Eckel
f34fa8bed2 feat(java-sdk): Create Java Host SDK (#122)
Closes #117

Signed-off-by: Thomas Darimont <thomas.darimont@googlemail.com>
Co-authored-by: Thomas Darimont <thomas.darimont@googlemail.com>
2022-12-19 10:55:40 -06:00
zach
dd0c5757da chore: update OCaml version to latest release (#171) 2022-12-16 11:19:19 -08:00
Benjamin Eckel
95ccafb02b ci(dotnet-sdk): Package dotnet lib with native dll (#152)
Fix release for native windows nuget package
2022-12-12 11:08:10 -06:00
Muhammad Azeez
c3ffb25891 feat: Implement .NET Host SDK (#119)
I am working on a .NET host for extism. My plan is to do the following:
 - [x] Implement a proof of concept to make sure things are possible
- [x] Write docs for the C# API so that the users get a nice IDE
experience
 - [x] Create a github action to publish the NuGet packages
    - [x] Edit `ci.yml` to include .NET Sdk
- [x] Create `release-dotnet.yml` to release `Extism.Sdk` nuget package
- [x] Maybe Create `release-dotnet-native.yml` to release
`Extism.runtime.win` nuget package
 - [x] Test on Linux (Help needed)
 - [x] Test on Mac (Help needed)
 - [x] Expose all of the Extism functions
 - [x] Write automated tests
- [x] ~Edit README show that the there is a .NET SDK~. Probably we
should not do this until we have a docs page.
 - [x] ~Use the `Extism.runtime.win-x64` package in the sample project~

Out of scope for this PR:
 - Json Serialization/Desererialization support

Co-authored-by: Alistair Evans <alistairjevans@gmail.com>
Co-authored-by: Benjamin Eckel <bhelx@simst.im>
Co-authored-by: Benjamin Eckel <bhelx@users.noreply.github.com>
2022-12-08 12:42:27 -06:00
zach
e473d2cb7e refactor(haskell): cleanup haskell SDK to prepare for release (#138)
- Switches from `stack` to `cabal`
- Cleanup SDK code
- Adds release action (still waiting on Hackage upload approval)

Co-authored-by: Steve Manuel <steve@dylib.so>
2022-12-08 10:07:56 -08:00
zach
5a5b538855 fix(ci): don’t install Python dev dependencies on CI (#149) 2022-12-07 18:45:50 -08:00
Benjamin Eckel
339556597b chore(python-sdk): Put placeholder readme in python dir (#104) 2022-11-29 12:39:01 -06:00
Benjamin Eckel
34be80a7ad chore: Fix elixir release workflow (#77) 2022-11-29 11:47:30 -06:00
Benjamin Eckel
3e6a0071e9 fix: Fix the release action (#101) 2022-11-29 10:33:26 -06:00
Benjamin Eckel
f5cf4f184e chore: fix ruby release publish (#78) 2022-11-28 19:31:26 -06:00
Benjamin Eckel
28d16f2fa8 fix: Fix the python release workflow (#76) 2022-11-14 16:27:01 -06:00
Benjamin Eckel
b57acde149 test(browser-runtime): Add a simple test and runner (#73) 2022-11-09 12:11:59 -06:00
zach
e6499cab72 Make Rust SDK depend directly on extism-runtime (#65) 2022-11-07 12:45:56 -08:00
Benjamin Eckel
b45c04c13e ci: Workflow per SDK (#69) 2022-11-04 16:24:48 -05:00
Benjamin Eckel
33dbcafdb9 fix: Fix release workflow to use make (#68) 2022-11-04 15:46:25 -05:00
Benjamin Eckel
71110117e4 feat: Add workflow_dispatch to the release workflow (#33) 2022-11-04 15:18:58 -05:00
zach
ffc1a1af41 chore: update deps, add dependabot.yml (#61) 2022-11-02 10:51:42 -07:00
zach
08f5b84cd3 ci: fix ocaml build (#59) 2022-10-28 15:18:44 -07:00
zach
fa338dc670 ci: create workflow for each language (#51)
Creates a new workflow for each language, allowing all languages to run
tests even when one fails

Also disables running on `push` (but once this is merged the workflow
can be manually triggered)
2022-10-27 14:27:10 -07:00
Benjamin Eckel
7e1f700ecd fix(node-sdk): Upgrade CI node version to 18 to get around FFI bug (#54)
Related to Issue #53
2022-10-27 13:00:09 -05:00
zach
c76ff7c7b4 test(ocaml): Add inline unit tests and enable OCaml CI (#49)
We're using the OCaml 5.0 beta compiler on CI because we're bumping up
against this issue: https://github.com/ocaml/ocaml/issues/11489 and the
fix isn't released yet.
2022-10-25 19:21:37 -07:00
zach
83d3670f17 test(cpp): Add tests and missing functionality for C++ (#47) 2022-10-25 17:24:52 -07:00
Benjamin Eckel
77f13a6c10 test(go-sdk): Add some unit tests for the Go SDK (#45) 2022-10-25 18:13:22 -05:00
Benjamin Eckel
2fda372c50 test(node-sdk): Add basic unit tests and coverage (#44) 2022-10-25 18:11:37 -05:00
Benjamin Eckel
b8a22b3d37 refactor(node-sdk): Refactor Node SDK to Typescript (#43)
Closes issue #25
2022-10-25 10:42:32 -05:00
Benjamin Eckel
577debc82a fix(ruby-sdk): Fix bugs and add tests (#41) 2022-10-25 09:12:23 -05:00
Benjamin Eckel
6c8927cfea test(python-sdk): Add unit tests for python SDK and run in CI (#42) 2022-10-25 09:12:11 -05:00
Benjamin Eckel
7815d9aee6 Fix elixir publish pipeline 2022-10-20 17:04:26 -05:00
Benjamin Eckel
ec07d35ed2 dont check metadata 2022-10-20 12:59:29 -05:00
Benjamin Eckel
97a7c6607e Publish elixir and ruby sdks 2022-10-20 11:37:23 -05:00
Benjamin Eckel
1024bb6d12 Implement Elixir / Erlang Host SDK 2022-10-19 14:12:56 -05:00
zach
f10ace7c03 ci: run tests using --all-features 2022-10-11 12:01:43 -07:00
Steve Manuel
c298208e04 ci: finish pypi release step 2022-09-14 11:37:01 -06:00
Steve Manuel
4c8a6b0ecb Merge branch 'main' of github.com:extism/extism 2022-09-14 11:26:05 -06:00
zach
f473be9044 meta: add scripts directory with SDK coverage script (#16)
Adds a script to check which runtime API functions are not used in each host SDK. Provides a coverage report with percent of functions called in each SDK. 

Co-authored-by: Steve Manuel <steve@dylib.so>
2022-09-14 11:12:05 -06:00