diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000000..287b39ce98 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,66 @@ +version: 2 +jobs: + test: + docker: + - image: circleci/golang:1.11 + environment: + GOCACHE: /tmp/go-cache + GOPATH: /tmp/go + GO111MODULE: 'on' # must be quoted to force string type instead of boolean type + steps: + - checkout + # Populate GOCACHE. + - restore_cache: + name: Restoring GOCACHE + keys: + - flux-gocache-{{ .Branch }}-{{ .Revision }} # Matches when retrying a single run. + - flux-gocache-{{ .Branch }}- # Matches a new commit on an existing branch. + - flux-gocache- # Matches a new branch. + # Populate GOPATH/pkg. + - restore_cache: + name: Restoring GOPATH/pkg/mod + keys: + - flux-gomod-{{ .Branch }}-{{ .Revision }} # Matches when retrying a single run. + - flux-gomod-{{ .Branch }}- # Matches a new commit on an existing branch. + - flux-gomod- # Matches a new branch. + # Run tests + - run: make vet + - run: make test + - save_cache: + name: Saving GOCACHE + key: flux-gocache-{{ .Branch }}-{{ .Revision }} + paths: + - /tmp/go-cache + when: always + - save_cache: + name: Saving GOPATH/pkg/mod + key: flux-gomod-{{ .Branch }}-{{ .Revision }} + paths: + - /tmp/go/pkg/mod + when: always + test-race: + docker: + - image: circleci/golang:1.11 + environment: + GOPATH: /tmp/go + GO111MODULE: 'on' # must be quoted to force string type instead of boolean type + steps: + - checkout + # Building go with -race does not use the cache + # Populate GOPATH/pkg. + - restore_cache: + name: Restoring GOPATH/pkg/mod + keys: + - flux-gomod-{{ .Branch }}-{{ .Revision }} # Matches when retrying a single run. + - flux-gomod-{{ .Branch }}- # Matches a new commit on an existing branch. + - flux-gomod- # Matches a new branch. + # Run tests + - run: make test-race + # No need to save the pkg/mod cache since the other job does it + +workflows: + version: 2 + build-and-test: + jobs: + - test + - test-race diff --git a/Makefile b/Makefile index fe2b4fc169..9a56adf69b 100644 --- a/Makefile +++ b/Makefile @@ -23,11 +23,6 @@ export GO_TEST=env GO111MODULE=on go test $(GO_ARGS) export GO_GENERATE=go generate $(GO_ARGS) export GO_VET=env GO111MODULE=on go vet $(GO_ARGS) -subdirs: $(SUBDIRS) - -$(SUBDIRS): - $(MAKE) -C $@ $(MAKECMDGOALS) - # List of utilities to build as part of the build process UTILS := \ bin/$(GOOS)/pigeon \ @@ -35,13 +30,33 @@ UTILS := \ all: $(UTILS) $(SUBDIRS) +$(SUBDIRS): $(UTILS) + $(MAKE) -C $@ $(MAKECMDGOALS) + clean: $(SUBDIRS) + rm -rf bin bin/$(GOOS)/pigeon: go.mod go.sum $(GO_BUILD) -o $@ github.com/mna/pigeon bin/$(GOOS)/cmpgen: ./ast/asttest/cmpgen/main.go - go build -i -o $@ ./ast/asttest/cmpgen + $(GO_BUILD) -o $@ ./ast/asttest/cmpgen + +fmt: $(SOURCES_NO_VENDOR) + goimports -w $^ + +test: + $(GO_TEST) ./... + +test-race: + $(GO_TEST) -race -count=1 ./... + +vet: + $(GO_VET) -v ./... + +bench: + $(GO_TEST) -bench=. -run=^$$ ./... + -.PHONY: all clean subdirs $(SUBDIRS) +.PHONY: all clean fmt test test-race vet bench $(SUBDIRS) diff --git a/README.md b/README.md index 0aa8544d2c..f66c1d6537 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Flux - Influx data language +[![CircleCI](https://circleci.com/gh/influxdata/flux/tree/master.svg?style=svg)](https://circleci.com/gh/influxdata/flux/tree/master) + `fluxd` is an HTTP server for running **Flux** queries to one or more InfluxDB servers. diff --git a/parser/flux.go b/parser/flux.go index e67057e1d3..b39adb42c8 100644 --- a/parser/flux.go +++ b/parser/flux.go @@ -1,3 +1,5 @@ +// Code generated by pigeon; DO NOT EDIT. + package parser import ( @@ -4742,9 +4744,6 @@ type parser struct { choiceNoMatch string // recovery expression stack, keeps track of the currently available recovery expression, these are traversed in reverse recoveryStack []map[string]interface{} - - // emptyState contains an empty storeDict, which is used to optimize cloneState if global "state" store is not used. - emptyState storeDict } // push a variable set on the vstack.