internal/wasm: prototype package for wasm file manipulation #832
Workflow file for this run
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
name: Go | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
paths-ignore: | |
- '.prettier*' | |
- '.vscode/**' | |
- '*.md' | |
- 'docs/**' | |
- 'LICENSE' | |
env: | |
wasm-tools-version: "1.219.1" | |
wasmtime-version: "26.0.0" | |
jobs: | |
# Vet Go code | |
vet-go: | |
name: Vet Go code | |
runs-on: ubuntu-latest | |
timeout-minutes: 2 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Vet Go code | |
run: go vet ./... | |
# Test with Go | |
test-go: | |
name: Test with Go | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
strategy: | |
matrix: | |
go-version: ["1.22", "1.23"] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Set up wasm-tools | |
uses: bytecodealliance/actions/wasm-tools/setup@v1 | |
with: | |
version: ${{ env.wasm-tools-version }} | |
- name: Run Go tests | |
run: go test -v ./... | |
- name: Run Go tests with race detector | |
run: go test -v -race ./... | |
- name: Test Go without cgo | |
env: | |
CGO_ENABLED: 0 | |
run: go test -v ./... | |
- name: Verify repo is unchanged | |
run: git diff --exit-code HEAD | |
# Test with TinyGo | |
test-tinygo: | |
name: Test with TinyGo | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
strategy: | |
matrix: | |
go-version: ["1.22", "1.23"] | |
tinygo-version: ["0.32.0", "0.33.0", "0.34.0"] | |
exclude: | |
- go-version: "1.23" | |
tinygo-version: "0.32.0" | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Set up TinyGo | |
uses: acifani/setup-tinygo@v2 | |
with: | |
tinygo-version: ${{ matrix.tinygo-version }} | |
- name: Set up wasm-tools | |
uses: bytecodealliance/actions/wasm-tools/setup@v1 | |
with: | |
version: ${{ env.wasm-tools-version }} | |
- name: Test with TinyGo | |
run: tinygo test -v ./... | |
- name: Verify repo is unchanged | |
run: git diff --exit-code HEAD | |
# Test with WebAssembly | |
test-wasm: | |
name: Test with WebAssembly | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
strategy: | |
matrix: | |
go-version: ["1.22", "1.23"] | |
tinygo-version: ["0.32.0", "0.33.0", "0.34.0"] | |
exclude: | |
- go-version: "1.23" | |
tinygo-version: "0.32.0" | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Set up TinyGo | |
uses: acifani/setup-tinygo@v2 | |
with: | |
tinygo-version: ${{ matrix.tinygo-version }} | |
- name: Set up wasm-tools | |
uses: bytecodealliance/actions/wasm-tools/setup@v1 | |
with: | |
version: ${{ env.wasm-tools-version }} | |
- name: Set up Wasmtime | |
uses: bytecodealliance/actions/wasmtime/setup@v1 | |
with: | |
version: ${{ env.wasmtime-version }} | |
- name: Add Go wasm exec to $PATH | |
run: echo "$(go env GOROOT)/misc/wasm" >> $GITHUB_PATH | |
- name: Regenerate Go | |
run: make tests/generated | |
- name: Verify repo is unchanged | |
run: git diff --exit-code HEAD | |
- name: Test wasm/wasip1 with Go | |
env: | |
GOARCH: wasm | |
GOOS: wasip1 | |
run: go test -v ./... | |
- name: Test wasm/wasip1 with TinyGo 0.32.0 | |
if: ${{ matrix.tinygo-version == '0.32.0' }} | |
run: tinygo test -v -target=wasi ./... | |
- name: Test wasm/wasip1 with TinyGo >= 0.33.0 | |
if: ${{ matrix.tinygo-version != '0.32.0' }} | |
run: tinygo test -v -target=wasip1 ./... | |
- name: Test wasm/wasip2 with TinyGo >= 0.33.0 | |
if: ${{ matrix.tinygo-version != '0.32.0' }} | |
run: tinygo test -v -target=wasip2 ./... | |
- name: Test generated Go with TinyGo >= 0.34.0 | |
if: ${{ matrix.tinygo-version != '0.32.0' && matrix.tinygo-version != '0.33.0' }} | |
run: tinygo test -v -target wasip2 ./tests/... | |
- name: Verify repo is unchanged | |
run: git diff --exit-code HEAD |