diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6582fe73e..4bcdcde0b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,6 +7,33 @@ on: pull_request: jobs: + build: + name: Build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - goos: js + goarch: wasm + - goos: aix + goarch: ppc64 + + steps: + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.19 + + - name: Checkout code + uses: actions/checkout@v3 + + - name: Build + run: go build . + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + test: name: Test runs-on: ${{ matrix.os }} diff --git a/.github/workflows/wasm.yaml b/.github/workflows/wasm.yaml deleted file mode 100644 index 82da1d50a..000000000 --- a/.github/workflows/wasm.yaml +++ /dev/null @@ -1,26 +0,0 @@ -name: WASM - -on: - push: - branches: - - master - pull_request: - -jobs: - build: - name: Build - runs-on: ubuntu-latest - env: - GOFLAGS: -mod=readonly - - steps: - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: '1.17' - - - name: Checkout code - uses: actions/checkout@v3 - - - name: Ensure Viper compiles for WASM - run: GOOS=js GOARCH=wasm go build . diff --git a/watch.go b/watch.go index b5523b8f9..1ce84eaf8 100644 --- a/watch.go +++ b/watch.go @@ -1,5 +1,5 @@ -//go:build !js -// +build !js +//go:build darwin || dragonfly || freebsd || openbsd || linux || netbsd || solaris || windows +// +build darwin dragonfly freebsd openbsd linux netbsd solaris windows package viper diff --git a/watch_wasm.go b/watch_unsupported.go similarity index 54% rename from watch_wasm.go rename to watch_unsupported.go index 8e47e6a91..dbf74ef37 100644 --- a/watch_wasm.go +++ b/watch_unsupported.go @@ -1,13 +1,19 @@ -// +build js,wasm +//go:build !darwin && !dragonfly && !freebsd && !openbsd && !linux && !netbsd && !solaris && !windows +// +build !darwin,!dragonfly,!freebsd,!openbsd,!linux,!netbsd,!solaris,!windows package viper import ( - "errors" + "fmt" + "runtime" "github.com/fsnotify/fsnotify" ) +func newWatcher() (*watcher, error) { + return &watcher{}, fmt.Errorf("fsnotify not supported on %s", runtime.GOOS) +} + type watcher struct { Events chan fsnotify.Event Errors chan error @@ -24,7 +30,3 @@ func (*watcher) Add(name string) error { func (*watcher) Remove(name string) error { return nil } - -func newWatcher() (*watcher, error) { - return &watcher{}, errors.New("fsnotify is not supported on WASM") -}