Skip to content

Commit

Permalink
Merge pull request #1 from jerbob92/feature/emscripten-tests
Browse files Browse the repository at this point in the history
Implement Emscripten tests
  • Loading branch information
jerbob92 authored Sep 24, 2023
2 parents a492300 + a9590ee commit dbd7fcd
Show file tree
Hide file tree
Showing 70 changed files with 34,912 additions and 2,039 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/emscripten.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Emscripten

on:
push:
branches:
- main
- development
pull_request:
branches:
- main
- development

jobs:
test-emscripten:
strategy:
fail-fast: false
matrix:
emscripten: [ "3.1.44", "3.1.45", "3.1.46" ]
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- uses: mymindstorm/setup-emsdk@v11
with:
version: ${{ matrix.emscripten }}
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.21"
- name: Recompile examples
run: |
curdir=`pwd`
for example in $(find examples -mindepth 1 -maxdepth 1 -type d)
do
cd $curdir/$example/wasm
./compile.sh
done
cd $curdir
- name: Test generation of examples
run: |
go generate ./...
- name: Run examples
run: |
curdir=`pwd`
for example in $(find examples -mindepth 1 -maxdepth 1 -type d)
do
cd $curdir/$example
go run main.go
done
cd $curdir
- name: Recompile testdata
run: |
curdir=`pwd`
cd testdata/wasm
./compile.sh
cd $curdir
- name: Test all packages
run: |
go test -timeout 30m ./... -v
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Test implementation for coverage
if: matrix.os == 'ubuntu-latest' && matrix.go == env.COVERAGE_GO_VERSION
run: |
go test -timeout 30m `go list ./... | grep -v examples` -coverprofile=coverage.out -covermode=atomic -v
go test -timeout 30m `go list ./... | grep -v examples | grep -v generated` -coverpkg=-coverpkg=`go list ./... | grep -v examples | grep -v generated | tr '\n' ','` -coverprofile=coverage.out -covermode=atomic -v
- name: Archive code coverage results
if: matrix.os == 'ubuntu-latest' && matrix.go == env.COVERAGE_GO_VERSION
uses: actions/upload-artifact@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
vendor
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Go Reference](https://pkg.go.dev/badge/github.com/jerbob92/wazero-emscripten-embind.svg)](https://pkg.go.dev/github.com/jerbob92/wazero-emscripten-embind)
[![Build Status][build-status]][build-url]
<!--[![codecov](https://codecov.io/gh/jerbob92/wazero-emscripten-embind/graph/badge.svg?token=4SC2SOJNZK)](https://codecov.io/gh/jerbob92/wazero-emscripten-embind)-->
[![codecov](https://codecov.io/gh/jerbob92/wazero-emscripten-embind/graph/badge.svg?token=4SC2SOJNZK)](https://codecov.io/gh/jerbob92/wazero-emscripten-embind)

[build-status]:https://github.com/jerbob92/wazero-emscripten-embind/workflows/Go/badge.svg
[build-url]:https://github.com/jerbob92/wazero-emscripten-embind/actions
Expand All @@ -11,7 +11,7 @@

## Features

* Support for all [Embind](https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html) features
* Support for almost all [Embind](https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html) features
* Code generator for all Embind bindings:
* [Functions](https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#a-quick-example)
* [Classes](https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#classes)
Expand All @@ -23,6 +23,14 @@
* Communicate between guest and host without worrying about data encoding/decoding
* Direct access to memory
through [memory views](https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#memory-views)
* Tested with custom test C++ and standard tests from Emscripten

But not everything is supported:

* ASYNCIFY: does not make a lot of sense in Go, might come later to allow Async C++ implementations to work
* EM_ASM/EM_JS (and related methods): naturally, you can't run JS in Go/Wazero. Since Go is not an interpreted language,
I don't see much sense to add support for Go code in it, as that would require a Go interpreter.
* Binding class method names to well-known symbols (which is something JS specific).

## What does Embind do?

Expand Down
Loading

0 comments on commit dbd7fcd

Please sign in to comment.