diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 31a53f6..ab68501 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -9,8 +9,12 @@ runs: # We depend on a more recent version, not available in current Ubuntu (20.04). Should be available in 22.04 # - run: sudo apt-get install wabt - run: | - curl -L -s https://github.com/WebAssembly/wabt/releases/download/1.0.27/wabt-1.0.27-ubuntu.tar.gz | tar xvz -C /tmp - sudo mv /tmp/wabt-1.0.27/bin/* /usr/local/bin + if [ "$RUNNER_OS" == "Linux" ]; then + curl -L -s https://github.com/WebAssembly/wabt/releases/download/1.0.27/wabt-1.0.27-ubuntu.tar.gz | tar xvz -C /tmp + sudo mv /tmp/wabt-1.0.27/bin/* /usr/local/bin + else + brew install wabt + fi shell: bash - run: yarnpkg --pure-lockfile shell: bash diff --git a/.github/workflows/publish-standalone.yml b/.github/workflows/build-standalone.yml similarity index 53% rename from .github/workflows/publish-standalone.yml rename to .github/workflows/build-standalone.yml index c6298d5..df1adc2 100644 --- a/.github/workflows/publish-standalone.yml +++ b/.github/workflows/build-standalone.yml @@ -1,12 +1,17 @@ -name: Publish Standalone +name: Build Standalone on: + push: + pull_request: workflow_dispatch: + workflow_call: jobs: publish-standalone: - needs: build - runs-on: macos-latest + strategy: + matrix: + os: [macos-latest, ubuntu-latest] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - uses: ./.github/actions/setup diff --git a/src/standalone/Makefile b/src/standalone/Makefile index 84a7dd4..09d7eea 100644 --- a/src/standalone/Makefile +++ b/src/standalone/Makefile @@ -1,9 +1,17 @@ +UNAME_S=$(shell uname -s) +UNAME_P=$(shell uname -p) +ifeq ($(UNAME_S),Darwin) WASMTIME_DIR=wasmtime-v0.37.0-x86_64-macos-c-api WASMTIME_RELEASE_URL=https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-x86_64-macos-c-api.tar.xz +else +WASMTIME_DIR=wasmtime-v0.37.0-x86_64-linux-c-api +WASMTIME_RELEASE_URL=https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-x86_64-linux-c-api.tar.xz +LIBS=-lpthread -lm -ldl +endif CFLAGS=-I$(WASMTIME_DIR)/include LDFLAGS= -LIBS=$(WASMTIME_DIR)/lib/libwasmtime.a +LIBS:=$(WASMTIME_DIR)/lib/libwasmtime.a $(LIBS) BIN2H=../../scripts/bin2h WAT2WASM=wat2wasm @@ -27,7 +35,7 @@ waforth_core.h: waforth_core.wasm .PHONY: install-deps install-deps: -rm -rf wasmtime-* - curl -L -s $(WASMTIME_RELEASE_URL) | tar xvz + curl -L -s $(WASMTIME_RELEASE_URL) | tar xJv .PHONY: clean