diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..3164ef6 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,83 @@ +# Golang CircleCI 2.0 configuration file +# +# Check https://circleci.com/docs/2.0/language-go/ for more details +version: 2 +jobs: + test: + docker: + - image: circleci/golang:1.12 + environment: + - GO111MODULE: "on" + - KIBANA_URL: "http://kb:5601" + - KIBANA_USERNAME: "elastic" + - KIBANA_PASSWORD: "changeme" + - image: docker.elastic.co/elasticsearch/elasticsearch:7.4.0 + name: es + environment: + - cluster.name: "test" + - discovery.type: "single-node" + - ELASTIC_PASSWORD: "changeme" + - xpack.security.enabled: "true" + - ES_JAVA_OPTS: "-Xms512m -Xmx512m" + - path.repo: "/tmp" + - image: docker.elastic.co/kibana/kibana:7.4.0 + name: kb + environment: + ELASTICSEARCH_HOSTS: http://es:9200 + ELASTICSEARCH_USERNAME: elastic + ELASTICSEARCH_PASSWORD: changeme + working_directory: /go/src/github.com/disaster37/terraform-provider-kibana + steps: + - checkout + - run: until $(curl --output /dev/null --silent --head --fail -u elastic:changeme http://kb:5601); do sleep 5; done + - run: curl -XPOST -u elastic:changeme http://es:9200/_license/start_trial?acknowledge=true + - run: make testacc + build: + docker: + - image: circleci/golang:1.12 + environment: + - GO111MODULE: "on" + working_directory: /go/src/github.com/disaster37/terraform-provider-kibana + steps: + - checkout + - run: make build + release: + docker: + - image: circleci/golang:1.12 + environment: + - GO111MODULE: "on" + - GITHUB_TOKEN: $GITHUB_TOKEN + - CIRCLE_PROJECT_USERNAME: $CIRCLE_PROJECT_USERNAME + - CIRCLE_PROJECT_REPONAME: $CIRCLE_PROJECT_REPONAME + - CIRCLE_TAG: $CIRCLE_TAG + working_directory: /go/src/github.com/disaster37/terraform-provider-kibana + steps: + - checkout + - run: go get github.com/mitchellh/gox + - run: go get github.com/tcnksm/ghr + - run: gox -os="freebsd darwin linux windows" -arch "386 amd64" -parallel=1 -output "dist/terraform-provider-kibana_${CIRCLE_TAG}_{{.OS}}_{{.Arch}}" + - run: CGO_ENABLED=0 gox -os="freebsd darwin linux windows" -arch "386 amd64" -parallel=1 -output "dist/terraform-provider-kibana_${CIRCLE_TAG}_{{.OS}}_{{.Arch}}_static" + - run: ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME $CIRCLE_TAG dist/ +workflows: + version: 2 + build-workflow: + jobs: + - test: + filters: + tags: + only: /.*/ + - build: + requires: + - test + filters: + tags: + only: /.*/ + - release: + context: Github + requires: + - build + filters: + tags: + only: /.*/ + branches: + ignore: /.*/ \ No newline at end of file