From 43fad9d3d80c5b385db9cebb2694b65ac4f06db0 Mon Sep 17 00:00:00 2001 From: Randy Reddig Date: Mon, 11 Nov 2024 10:47:46 -0700 Subject: [PATCH 1/2] internal/sysfs: add missing tinygo tags This enables running wazero under tinygo -target=wasip1 (wasm in wasm). To test: tinygo run -target=wasip1 examples/basic/add.go 7 9 --- internal/sysfs/datasync_unsupported.go | 2 +- internal/sysfs/open_file_unsupported.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/sysfs/datasync_unsupported.go b/internal/sysfs/datasync_unsupported.go index aa05719be6..bf3ec01a78 100644 --- a/internal/sysfs/datasync_unsupported.go +++ b/internal/sysfs/datasync_unsupported.go @@ -1,4 +1,4 @@ -//go:build !linux +//go:build !linux && !tinygo package sysfs diff --git a/internal/sysfs/open_file_unsupported.go b/internal/sysfs/open_file_unsupported.go index 9f7a6d0885..f52ffc0386 100644 --- a/internal/sysfs/open_file_unsupported.go +++ b/internal/sysfs/open_file_unsupported.go @@ -1,4 +1,4 @@ -//go:build !darwin && !linux && !windows && !illumos && !solaris && !freebsd +//go:build !darwin && !linux && !windows && !illumos && !solaris && !freebsd && !tinygo package sysfs From a4061ec516c4dca7c96c15266768e381f7f671ac Mon Sep 17 00:00:00 2001 From: Randy Reddig Date: Tue, 12 Nov 2024 12:06:04 -0700 Subject: [PATCH 2/2] .github/workflows: re-enable TinyGo in CI This may not work, due to potentially missing APIs in TinyGo. Partially reverts https://github.com/tetratelabs/wazero/pull/2304 --- .github/workflows/commit.yaml | 15 +++++++++++++++ .github/workflows/examples.yaml | 2 +- .github/workflows/integration.yaml | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/commit.yaml b/.github/workflows/commit.yaml index fc3027c726..a80e0ffb3f 100644 --- a/.github/workflows/commit.yaml +++ b/.github/workflows/commit.yaml @@ -15,6 +15,7 @@ on: env: # Update this prior to requiring a higher minor version in go.mod GO_VERSION: "1.23" + TINYGO_VERSION: "0.34.0" defaults: run: # use bash for all operating systems unless overridden @@ -152,6 +153,20 @@ jobs: # This runs all tests compiled above in sequence. Note: This mounts /tmp to allow t.TempDir() in tests. run: find . -name "*.test" | xargs -Itestbin docker run --platform linux/${{ matrix.arch }} -v $(pwd)/testbin:/test -v $(pwd)/wazerocli:/wazero -e WAZEROCLI=/wazero --tmpfs /tmp --rm -t wazero:test + test_tinygo: + name: "TinyGo on Ubuntu" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: # Use version consistent with TinyGo. + go-version: ${{ env.GO_VERSION }} + - uses: acifani/setup-tinygo@v2 + with: + tinygo-version: ${{ env.TINYGO_VERSION }} + - run: tinygo build ./cmd/wazero + - run: tinygo build -size short -target pico -stack-size=8kb ./cmd/wazero + # This ensures that internal/integration_test/fuzz is runnable, and is not intended to # run full-length fuzzing while trying to find low-hanging frontend bugs. fuzz: diff --git a/.github/workflows/examples.yaml b/.github/workflows/examples.yaml index b47a1885f5..958d2875f2 100644 --- a/.github/workflows/examples.yaml +++ b/.github/workflows/examples.yaml @@ -17,7 +17,7 @@ on: env: EMSDK_VERSION: "3.1.40" - TINYGO_VERSION: "0.33.0" + TINYGO_VERSION: "0.34.0" ZIG_VERSION: "0.11.0" concurrency: diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 95719ade48..aeb4594fa3 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -19,7 +19,7 @@ defaults: env: # Update this prior to requiring a higher minor version in go.mod GO_VERSION: "1.23" - TINYGO_VERSION: "0.33.0" + TINYGO_VERSION: "0.34.0" ZIG_VERSION: "0.11.0" BINARYEN_VERSION: "116" STDLIB_TESTS: "internal/integration_test/stdlibs"