Skip to content

Commit

Permalink
Merge pull request #210 from oakmound/hotfix/js-audio-compilation
Browse files Browse the repository at this point in the history
audio: fix imports for unsupported writers
  • Loading branch information
200sc committed Jul 10, 2022
2 parents df66d92 + 0251eea commit aa57f92
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 11 deletions.
39 changes: 31 additions & 8 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
name: Go
env:
GO_VERSION: 1.18
on: [push]
jobs:
test-windows-x64:
name: Test (windows amd64)
runs-on: [self-hosted, windows, x64]
steps:

- name: Set up Go 1.18
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v1
with:
go-version: 1.18
go-version: ${{ env.GO_VERSION }}
id: go

- name: Check out code into the Go module directory
Expand All @@ -28,10 +30,10 @@ jobs:
runs-on: [self-hosted, linux, ARM64]
steps:

- name: Set up Go 1.18
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v1
with:
go-version: 1.18
go-version: ${{ env.GO_VERSION }}
id: go

- name: Check out code into the Go module directory
Expand All @@ -49,10 +51,10 @@ jobs:
runs-on: [self-hosted, linux, x64]
steps:

- name: Set up Go 1.18
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v1
with:
go-version: 1.18
go-version: ${{ env.GO_VERSION }}
id: go

- name: Check out code into the Go module directory
Expand All @@ -65,15 +67,36 @@ jobs:
- name: Test
run: ./test_examples.sh

test-js-compilation:
name: Test Examples (JS Compilation)
runs-on: ubuntu-latest
steps:

- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v1
with:
go-version: ${{ env.GO_VERSION }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Test
run: ./test_examples_js.sh

test:
name: Test
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.18
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v1
with:
go-version: 1.18
go-version: ${{ env.GO_VERSION }}
id: go

- name: Check out code into the Go module directory
Expand Down
7 changes: 5 additions & 2 deletions audio/writer_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@

package audio

import "github.com/oakmound/oak/v4/oakerr"
import (
"github.com/oakmound/oak/v4/audio/pcm"
"github.com/oakmound/oak/v4/oakerr"
)

func initOS(driver Driver) error {
return oakerr.UnsupportedPlatform{
Operation: "pcm.Init",
}
}

func newWriter(f Format) (Writer, error) {
func newWriter(f pcm.Format) (pcm.Writer, error) {
return nil, oakerr.UnsupportedPlatform{
Operation: "pcm.NewWriter",
}
Expand Down
2 changes: 1 addition & 1 deletion shake/shake.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (sk *Shaker) ShakeContext(ctx context.Context, sp ShiftPoser, dur time.Dura
}

type screenToPoser struct {
window.Window
window.App
}

func (stp screenToPoser) ShiftPos(x, y float64) {
Expand Down
24 changes: 24 additions & 0 deletions test_examples_js.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

set -e

examples=$(find ./examples | grep main.go$)
root=$(pwd)
for ex in $examples
do
echo "$ex"
dir=$(dirname "$ex")
# excluded because screenopts explicitly demonstrates
# desktop-specific features
if [[ "$dir" == "./examples/screenopts" ]]; then
continue
fi
# excluded because text includes a find-font dependency
# that does not compile in js
if [[ "$dir" == "./examples/text" ]]; then
continue
fi
cd "$dir"
GOOS=js GOARCH=wasm go build .
cd "$root"
done

0 comments on commit aa57f92

Please sign in to comment.