Skip to content

Commit

Permalink
Merged pull request #20 from influxdata/nc-ci
Browse files Browse the repository at this point in the history
Add CircleCI config
  • Loading branch information
nathanielc committed Sep 12, 2018
2 parents f27aa09 + 56ef125 commit 55f1366
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 10 deletions.
66 changes: 66 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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
29 changes: 22 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,40 @@ 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 \
bin/$(GOOS)/cmpgen

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)

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
5 changes: 2 additions & 3 deletions parser/flux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 55f1366

Please sign in to comment.