-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
internal/wasmtools: run wasm-tools.wasm in embedded Wazero runtime #252
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
42ffde5
all: replace submodule with Cargo-managed wasm-tools CLI
Mossaka 787ab7e
internal/wasmtools: optimize for size
Mossaka 0e1c947
wit/testdata_test: implement code review comment
Mossaka 1caa745
internal/wasmtools, wit: change the type of fsMap in Executor.Run to …
Mossaka 10f2270
Makefile: change dir to '.'
Mossaka d59fbaf
internal/wasmtools, wit: enhance API, disable TinyGo tests, and impro…
Mossaka ff76f42
wit/testdata_test: change t.Skip to t.Log since Skip is not supported…
Mossaka b5ea977
internal/wasmtools: add comments to improve readability for the Insta…
Mossaka 8f0c740
CHANGELOG: Update with wasm-tools integration details
Mossaka 149d791
internal/wasmtools, Makefile: add gzip compression for wasm-tools.was…
Mossaka 1aa6f6e
.github: Add set-up wasm-tools.wasm to the test.yaml and release.yaml
Mossaka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,8 +34,13 @@ jobs: | |
with: | ||
go-version-file: go.mod | ||
|
||
- name: Set up wams-tools.wasm | ||
run: make internal/wasmtools/wasm-tools.wasm | ||
|
||
- name: Vet Go code | ||
run: go vet ${{ env.go-modules }} ./tests/... | ||
run: | | ||
make build | ||
go vet ${{ env.go-modules }} ./tests/... | ||
|
||
# Test with Go | ||
test-go: | ||
|
@@ -61,6 +66,9 @@ jobs: | |
with: | ||
version: ${{ env.wasm-tools-version }} | ||
|
||
- name: Set up wams-tools.wasm | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Necessary? Delete this and the step above? |
||
run: make internal/wasmtools/wasm-tools.wasm | ||
|
||
- name: Run Go tests | ||
run: go test -v ${{ env.go-modules }} | ||
|
||
|
@@ -147,6 +155,9 @@ jobs: | |
with: | ||
version: ${{ env.wasm-tools-version }} | ||
|
||
- name: Set up wams-tools.wasm | ||
run: make internal/wasmtools/wasm-tools.wasm | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this necessary? Should we delete the step above? |
||
|
||
- name: Set up Wasmtime | ||
uses: bytecodealliance/actions/wasmtime/setup@v1 | ||
with: | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ wit_files = $(sort $(shell find testdata -name '*.wit' ! -name '*.golden.*')) | |
json: $(wit_files) | ||
|
||
.PHONY: $(wit_files) | ||
$(wit_files): | ||
wasm-tools component wit -j --all-features $@ > [email protected] | ||
$(wit_files): internal/wasmtools/wasm-tools.wasm | ||
wasmtime --dir . internal/wasmtools/wasm-tools.wasm component wit -j --all-features $@ > [email protected] | ||
|
||
# golden recompiles the .golden.wit test files. | ||
.PHONY: golden | ||
|
@@ -21,12 +21,26 @@ generated: clean json | |
.PHONY: clean | ||
clean: | ||
rm -rf ./generated/* | ||
rm -f internal/wasmtools/wasm-tools.wasm.gz | ||
|
||
# tests/generated writes generated Go code to the tests directory | ||
.PHONY: tests/generated | ||
tests/generated: json | ||
go generate ./tests | ||
|
||
# build builds the cmd/wit-bindgen-go binary | ||
.PHONY: build | ||
build: internal/wasmtools/wasm-tools.wasm | ||
go build -o wit-bindgen-go ./cmd/wit-bindgen-go | ||
|
||
internal/wasmtools/wasm-tools.wasm: internal/wasmtools/wasm-tools.wasm.gz | ||
gzip -dc $< > $@ | ||
|
||
internal/wasmtools/wasm-tools.wasm.gz: | ||
cd internal/wasmtools && \ | ||
cargo build --target wasm32-wasip1 --release -p wasm-tools | ||
Mossaka marked this conversation as resolved.
Show resolved
Hide resolved
|
||
gzip -c internal/wasmtools/target/wasm32-wasip1/release/wasm-tools.wasm > $@ | ||
|
||
# test runs Go and TinyGo tests | ||
GOTESTARGS := | ||
GOTESTMODULES := ./... ./cm/... | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
target | ||
Mossaka marked this conversation as resolved.
Show resolved
Hide resolved
|
||
wasm-tools.wasm |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to do this?
The artifact should already be committed, and this adds a Rust dependency / build step to the release workflow.