Skip to content

Commit

Permalink
Test WASM builds
Browse files Browse the repository at this point in the history
  • Loading branch information
theory committed Oct 28, 2024
1 parent 717d6f5 commit fda47ca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ jobs:
with: { go-version: "${{ matrix.go }}", check-latest: true }
- name: Run Tests
run: make test
- name: Test WASM
run: make _build/go.wasm
- name: Test TinyGo
uses: docker://tinygo/tinygo@latest
with: { args: make _build/tinygo.wasm }
lint:
name: 📊 Lint and Cover
runs-on: ubuntu-latest
Expand Down
21 changes: 12 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ GO ?= go
test:
$(GO) test ./... -count=1

.PHONY: wasm # Build a simple app with Go and TinyGo WASM compilation.
wasm: _build/go.wasm _build/tinygo.wasm

_build/go.wasm: internal/wasm/wasm.go
GOOS=js GOARCH=wasm $(GO) build -o $@ $<

_build/tinygo.wasm: internal/wasm/wasm.go
tinygo build -o $@ $<

.PHONY: cover # Run test coverage
cover: $(shell find . -name \*.go)
$(GO) test -v -coverprofile=cover.out -covermode=count ./...
Expand All @@ -27,6 +18,18 @@ clean:
$(GO) clean
@rm -rf cover.out _build

# WASM
.PHONY: wasm # Build a simple app with Go and TinyGo WASM compilation.
wasm: _build/go.wasm _build/tinygo.wasm

_build/go.wasm: internal/wasm/wasm.go
@mkdir -p $(@D)
GOOS=js GOARCH=wasm $(GO) build -o $@ $<

_build/tinygo.wasm: internal/wasm/wasm.go
@mkdir -p $(@D)
tinygo build -o $@ $<

############################################################################
# Utilities.
.PHONY: brew-lint-depends # Install linting tools from Homebrew
Expand Down

0 comments on commit fda47ca

Please sign in to comment.