Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

Commit

Permalink
add makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
mathetake committed Sep 10, 2020
1 parent 573f042 commit 10bb2dc
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 17 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
- name: run golangci-lint
uses: docker://golangci/golangci-lint:v1.31.0
with:
args: golangci-lint run --build-tags proxytest
args: make lint

- name: set up go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14

- name: run tests
run: go test -tags=proxytest -v -race ./proxywasm/...
run: make test.sdk

build-examples:
name: build examples
Expand Down Expand Up @@ -71,5 +71,4 @@ jobs:
run: getenvoy fetch wasm:1.15

- name: run e2e test
run: go test examples/e2e_test.go -v

run: make test.e2e
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.DEFAULT_GOAL := build.examples

.PHONY: help build.examples lint test test.sdk test.e2e
help:
grep -E '^[a-z0-9A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

build.example:
tinygo build -o ./examples/${name}/main.go.wasm -target=wasm -wasm-abi=generic ./examples/${name}/main.go

build.examples:
find ./examples -type f -name "main.go" | xargs -Ip tinygo build -o p.wasm -target=wasm -wasm-abi=generic p

lint:
golangci-lint run --build-tags proxytest

test:
go test -tags=proxytest -race -v ./...

test.sdk:
go test -tags=proxytest -race -v ./proxywasm/...

test.e2e:
go test -tags=proxytest -race -v ./e2e

run:
getenvoy run wasm:1.15 -- -c ./examples/${name}/envoy.yaml
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,25 @@ The target Envoy version is `release/v1.15`
build:

```bash
find ./examples -type f -name "main.go" | xargs -Ip tinygo build -o p.wasm -target=wasm -wasm-abi=generic p
make build.examples # build all examples

make build.example name=helloworld # build a specific example
```

run:

```bash
getenvoy run wasm:1.15 -- -c ./examples/${name}/envoy.yaml
make run name=helloworld
```

## sdk development

To run tests:

```bash
go test -tags=proxytest -v -race ./...
make test # run all tests

make test.e2e # run e2e tests only

make test.sdk # run sdk test only
```

## language and compiler limitations/considerations
Expand Down
7 changes: 7 additions & 0 deletions e2e/e2e_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package e2e

import (
"testing"
)

func Test_examples(t *testing.T) {}
8 changes: 0 additions & 8 deletions examples/e2e_test.go

This file was deleted.

0 comments on commit 10bb2dc

Please sign in to comment.