Update Makefile to support WASM build and testing

- Added new targets for building and testing the WASM verifier.
- Updated the 'all' target to include 'build-wasm'.
- Modified 'build-frontend' to depend on 'build-wasm'.
- Introduced 'test-wasm' for running tests on the WASM verifier.
- Clean target now removes WASM output directory.
This commit is contained in:
2025-12-27 15:32:00 -06:00
parent 834a4a8c96
commit 6178ffd7f9

View File

@@ -1,19 +1,28 @@
.PHONY: all build-frontend build-go clean release run lint scan check format test dev docker-build
.PHONY: all build-frontend build-go build-wasm clean release run lint scan check format test test-wasm dev docker-build
BINARY_NAME=software-station
FRONTEND_DIR=frontend
BUILD_DIR=build
VERIFIER_DIR=software-verifier
WASM_OUT=frontend/static/verifier
VERSION=$(shell grep '"version":' $(FRONTEND_DIR)/package.json | cut -d'"' -f4)
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
VCS_REF=$(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
all: build-frontend build-go
all: build-wasm build-frontend build-go
dev:
@echo "Starting development environment..."
@pnpm --prefix $(FRONTEND_DIR) dev & go run main.go
build-frontend:
build-wasm:
@echo "Building WASM verifier..."
mkdir -p $(WASM_OUT)
cp "$(shell go env GOROOT)/lib/wasm/wasm_exec.js" $(WASM_OUT)/wasm_exec.js
cd $(VERIFIER_DIR) && GOOS=js GOARCH=wasm go build -o ../$(WASM_OUT)/verifier.wasm .
build-frontend: build-wasm
cd $(FRONTEND_DIR) && pnpm install && pnpm build
build-go:
@@ -40,11 +49,15 @@ scan:
check:
cd $(FRONTEND_DIR) && pnpm run check
test:
test: test-wasm
go test -v -coverpkg=./... ./...
test-wasm:
cd $(VERIFIER_DIR) && go test -v ./...
clean:
rm -rf $(FRONTEND_DIR)/build
rm -rf $(WASM_OUT)
rm -f $(BINARY_NAME)
rm -f coverage.out