Files
fn-serverless/Makefile
Reed Allman 00c29b8bf3 datastore no longer implements logstore (#1013)
* datastore no longer implements logstore

the underlying implementation of our sql store implements both the datastore
and the logstore interface, however going forward we are likely to encounter
datastore implementers that would mock out the logstore interface and not use
its methods - signalling a poor interface. this remedies that, now they are 2
completely separate things, which our sqlstore happens to implement both of.

related to some recent changes around wrapping, this keeps the imposed metrics
and validation wrapping of a servers logstore and datastore, just moving it
into New instead of in the opts - this is so that a user can have the
underlying datastore in order to set the logstore to it, since wrapping it in
a validator/metrics would render it no longer a logstore implementer (i.e.
validate datastore doesn't implement the logstore interface), we need to do
this after setting the logstore to the datastore if one wasn't provided
explicitly.

* splits logstore and datastore metrics & validation logic
* `make test` should be `make full-test` always. got rid of that so that
nobody else has to wait for CI to blow up on them after the tests pass locally
ever again.

* fix new tests
2018-06-04 00:08:16 -07:00

113 lines
3.0 KiB
Makefile

# Just builds
.PHONY: all test dep build test-log-datastore checkfmt pull-images api-test fn-test-utils test-middleware test-extensions test-basic test-api
dep:
dep ensure --vendor-only
dep-up:
dep ensure
build: api/agent/grpc/runner.pb.go
go build -o fnserver ./cmd/fnserver
install:
go build -o ${GOPATH}/bin/fnserver ./cmd/fnserver
checkfmt:
./go-fmt.sh
clear-images:
-docker images -q -f dangling=true | xargs docker rmi -f
for i in fnproject/fn-test-utils fnproject/hello fnproject/dind fnproject/fnserver ; do \
docker images "$$i" --format '{{ .ID }}\t{{ .Repository }}\t{{ .Tag}}' | while read id repo tag; do \
if [ "$$tag" = "<none>" ]; then docker rmi "$$id"; else docker rmi "$$repo:$$tag"; fi; done; done
release-fnserver:
./release.sh
build-dind:
(cd images/dind && ./build.sh)
release-dind:
(cd images/dind && ./release.sh)
fn-test-utils: checkfmt
cd images/fn-test-utils && ./build.sh
test-middleware: test-basic
cd examples/middleware && go build
test-extensions: test-basic
cd examples/extensions && go build
test-basic: checkfmt pull-images fn-test-utils
./test.sh
test: checkfmt pull-images test-basic test-middleware test-extensions test-api test-system
test-api: test-basic
./api_test.sh sqlite3 4
./api_test.sh mysql 4 0
./api_test.sh postgres 4 0
test-system: test-basic
./system_test.sh sqlite3 4
./system_test.sh mysql 4 0
./system_test.sh postgres 4 0
img-busybox:
docker pull busybox
img-hello:
docker pull fnproject/hello
img-mysql:
docker pull mysql
img-postgres:
docker pull postgres:9.3-alpine
img-minio:
docker pull minio/minio
pull-images: img-hello img-mysql img-postgres img-minio img-busybox
test-datastore:
cd api/datastore && go test -v ./...
test-log-datastore:
cd api/logs && go test -v ./...
test-build-arm:
GOARCH=arm GOARM=5 $(MAKE) build
GOARCH=arm GOARM=6 $(MAKE) build
GOARCH=arm GOARM=7 $(MAKE) build
GOARCH=arm64 $(MAKE) build
%.pb.go: %.proto
protoc --proto_path=$(@D) --proto_path=./vendor --go_out=plugins=grpc:$(@D) $<
run: build
GIN_MODE=debug ./fnserver
docker-build:
docker build --build-arg HTTPS_PROXY --build-arg HTTP_PROXY -t fnproject/fnserver:latest .
docker-run: docker-build
docker run --rm --privileged -it -e NO_PROXY -e HTTP_PROXY -e FN_LOG_LEVEL=debug -e "FN_DB_URL=sqlite3:///app/data/fn.db" -v ${CURDIR}/data:/app/data -p 8080:8080 fnproject/fnserver
docker-test-run-with-sqlite3:
./api_test.sh sqlite3 4
docker-test-run-with-mysql:
./api_test.sh mysql 4
docker-test-run-with-postgres:
./api_test.sh postgres 4
docker-test:
docker run -ti --privileged --rm -e FN_LOG_LEVEL=debug \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ${CURDIR}:/go/src/github.com/fnproject/fn \
-w /go/src/github.com/fnproject/fn \
fnproject/go:dev go test \
-v $(shell docker run --rm -ti -v ${CURDIR}:/go/src/github.com/fnproject/fn -w /go/src/github.com/fnproject/fn -e GOPATH=/go golang:alpine sh -c 'go list ./... | grep -v vendor | grep -v examples | grep -v tool | grep -v fn')
all: dep build