Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Makefile command to build example files #99

Merged
merged 4 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,21 @@ jobs:
- name: Test
shell: bash
run: |
PATH=$PWD/misc/wasm:$PATH GOOS=js GOARCH=wasm go test ./...
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 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion _examples/service-bindings/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading