mirror of
https://github.com/syumai/workers.git
synced 2025-03-10 17:29:11 +00:00
Merge pull request #99 from syumai/fix-examples-build
add Makefile command to build example files
This commit is contained in:
commit
9710147e94
17
.github/workflows/pull_request.yaml
vendored
17
.github/workflows/pull_request.yaml
vendored
@ -23,3 +23,20 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
PATH=$PWD/misc/wasm:$PATH GOOS=js GOARCH=wasm go test ./...
|
||||
|
||||
examples:
|
||||
name: Build examples
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Golang
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
|
||||
- name: Build examples
|
||||
shell: bash
|
||||
run: make build-examples
|
||||
|
||||
|
8
Makefile
8
Makefile
@ -2,3 +2,11 @@
|
||||
test:
|
||||
@PATH=$(CURDIR)/misc/wasm:$(PATH) GOOS=js GOARCH=wasm go test ./...
|
||||
|
||||
.PHONY: build-examples
|
||||
build-examples:
|
||||
for dir in $(shell find ./_examples -maxdepth 1 -type d); do \
|
||||
if [ $$dir = "./_examples" ]; then continue; fi; \
|
||||
echo 'build:' $$dir; \
|
||||
cd $$dir && GOOS=js GOARCH=wasm go build -o ./build/app.wasm; \
|
||||
cd ../../; \
|
||||
done
|
||||
|
@ -16,7 +16,7 @@ func main() {
|
||||
bind := cloudflare.GetBinding(ctx, "hello")
|
||||
fc := fetch.NewClient(fetch.WithBinding(bind))
|
||||
|
||||
hc := fc.HTTPClient()
|
||||
hc := fc.HTTPClient(fetch.RedirectModeFollow)
|
||||
res, err := hc.Do(req)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user