From f3a4c7a52d7ecb27682a4ff3482aa6f1532f50c9 Mon Sep 17 00:00:00 2001 From: Yang Hau Date: Wed, 8 Nov 2023 17:26:58 +0100 Subject: [PATCH] feat: Build wasp-cli for checking all arch --- .github/workflows/build-test.yml | 54 ++++++++++++++++++++++++++++++++ Makefile | 5 +++ 2 files changed, 59 insertions(+) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index da38b7a3f0..a4bd980b69 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -108,3 +108,57 @@ jobs: version: v1.54.2 args: --timeout 15m0s skip-pkg-cache: true + + build-wasp-cli: + runs-on: ubuntu-latest + steps: + - name: Set up Go 1.x + uses: actions/setup-go@v4 + with: + go-version: "1.21" + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + + - name: Get dependencies + run: | + make wasm + go get -v -t -d ./... + + - name: macos arm64 + run: | + GOOS=darwin GOARCH=arm64 make build-cli + if [ -f wasp-cli ]; then + rm wasp-cli + else + echo "error: can't compile wasp-cli" + exit 1 + fi + - name: macos amd64 + run: | + GOOS=darwin GOARCH=amd64 make build-cli + if [ -f wasp-cli ]; then + rm wasp-cli + else + echo "error: can't compile wasp-cli" + exit 1 + fi + - name: linux arm64 + run: | + GOOS=linux GOARCH=arm64 make build-cli + if [ -f wasp-cli ]; then + rm wasp-cli + else + echo "error: can't compile wasp-cli" + exit 1 + fi + - name: linux amd64 + run: | + GOOS=linux GOARCH=amd64 make build-cli + if [ -f wasp-cli ]; then + rm wasp-cli + else + echo "error: can't compile wasp-cli" + exit 1 + fi diff --git a/Makefile b/Makefile index 9e9586a377..685cc94013 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,15 @@ GIT_REF_TAG := $(shell git describe --tags) BUILD_TAGS = rocksdb +ifdef OS +# windows +BUILD_LD_FLAGS = "-X=github.com/iotaledger/wasp/components/app.Version=$(GIT_REF_TAG) +else ifeq ($(shell uname -m), arm64) BUILD_LD_FLAGS = "-X=github.com/iotaledger/wasp/components/app.Version=$(GIT_REF_TAG) -extldflags \"-Wa,--noexecstack\"" else BUILD_LD_FLAGS = "-X=github.com/iotaledger/wasp/components/app.Version=$(GIT_REF_TAG) -extldflags \"-z noexecstack\"" endif +endif DOCKER_BUILD_ARGS = # E.g. make docker-build "DOCKER_BUILD_ARGS=--tag wasp:devel" #