iansmith / parigot

Develop as a monolith, deploy as microservices.
https://parigot.info
BSD 3-Clause "New" or "Revised" License
12 stars 1 forks source link

build client side of APIs in the dagger pipeline #19

Closed cindyuc closed 1 year ago

cindyuc commented 1 year ago

bugs free

I made some changes in the Dockerfile to shorten the debugging time

What I've done so far is to use dagger to implement the `client side of api' section of the Makefile

## we just use a single representative file for all the generated code from
REP=g/file/$(API_VERSION)/file.pb.go
$(REP): $(API_PROTO) $(TEST_PROTO) build/protoc-gen-parigot
    @rm -rf g/*
    buf lint
    buf generate

#
# PROTOC EXTENSION
#
# protoc plugin
TEMPLATE=$(shell find command/protoc-gen-parigot -type f -regex ".*\.tmpl")
GENERATOR_SRC=$(shell find command/protoc-gen-parigot -type f -regex ".*\.go")
build/protoc-gen-parigot: $(TEMPLATE) $(GENERATOR_SRC)
    @rm -f $@
    $(GO_TO_HOST) build $(EXTRA_HOST_ARGS) -o $@ github.com/iansmith/parigot/command/protoc-gen-parigot

## client side of the file service
FILE_SERVICE=$(shell find apiwasm/file -type f -regex ".*\.go")
build/file.p.wasm: $(FILE_SERVICE) $(REP) $(SYSCALL_CLIENT_SIDE) 
    @rm -f $@
    $(GO_TO_WASM) build  $(EXTRA_WASM_COMP_ARGS) -tags "buildvcs=false" -o $@ github.com/iansmith/parigot/apiwasm/file

## client side of the test service
TEST_SERVICE=$(shell find apiwasm/test -type f -regex ".*\.go")
build/test.p.wasm: export GOOS=js
build/test.p.wasm: export GOARCH=wasm
build/test.p.wasm: $(TEST_SERVICE) $(REP) $(SYSCALL_CLIENT_SIDE) 
    @rm -f $@
    $(GO_TO_WASM) build $(EXTRA_WASM_COMP_ARGS) -tags "buildvcs=false" -o $@ github.com/iansmith/parigot/apiwasm/test

## client side of service impl
QUEUE_SERVICE=$(shell find apiwasm/queue -type f -regex ".*\.go")
build/queue.p.wasm: export GOOS=js
build/queue.p.wasm: export GOARCH=wasm
build/queue.p.wasm: $(QUEUE_SERVICE) $(REP) $(SYSCALL_CLIENT_SIDE) 
    @rm -f $@
    $(GO_TO_WASM) build $(EXTRA_WASM_COMP_ARGS) -tags "buildvcs=false" -o $@ github.com/iansmith/parigot/apiwasm/queue
iansmith commented 1 year ago

Merge at will! Great stuff!