From 909e159aaa0080b63fb25416e135288b2bfc38ef Mon Sep 17 00:00:00 2001 From: Matthew Jaffee Date: Thu, 9 Sep 2021 09:09:53 -0500 Subject: [PATCH] attempt to build release artifacts in CI (using updated Go version) most of this is stolen from the 3.x branch for building the release artifacts I removed the restriction of only master branch, so we should be able to see if it works before the PR is merged. --- .circleci/config.yml | 29 ++++++++++++++++++++++++++++- Dockerfile | 2 +- Makefile | 7 ++++++- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ce623b054..57e117251 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -132,12 +132,23 @@ jobs: - checkout-plus - attach_workspace: at: . - - run: make release + - setup_remote_docker: + version: 19.03.13 # see https://support.circleci.com/hc/en-us/articles/360050934711 + - run: echo -n $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin + - run: make docker-release - store_artifacts: path: build - persist_to_workspace: root: . paths: build + publish_release: + executor: + name: golang + steps: + - attach_workspace: + at: . + - run: go get github.com/tcnksm/ghr + - run: ghr -t ${GITHUB_PERSONAL_ACCESS_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${CIRCLE_TAG} ./build/ prerelease-upload: docker: - image: circleci/python:2.7-jessie @@ -237,6 +248,22 @@ workflows: - linter - check-license-headers - test-golang-1.15.5 + - release: + context: molecula + requires: + - setup + filters: + tags: + only: /^v.*/ + - publish_release: + context: molecula + requires: + - release + filters: + tags: + only: /^v.*/ + branches: + ignore: /.*/ - dockerhub-upload-unstable: context: molecula requires: diff --git a/Dockerfile b/Dockerfile index 955f499ed..969396a74 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.14.10 as builder +FROM golang:latest as builder ARG BUILD_FLAGS ARG MAKE_FLAGS diff --git a/Makefile b/Makefile index 2e6cc7331..263a7a165 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ BUILD_TIME := $(shell date -u +%FT%T%z) SHARD_WIDTH = 20 COMMIT := $(shell git describe --exact-match >/dev/null 2>&1 || git rev-parse --short HEAD) LDFLAGS="-X github.com/pilosa/pilosa/v2.Version=$(VERSION) -X github.com/pilosa/pilosa/v2.BuildTime=$(BUILD_TIME) -X github.com/pilosa/pilosa/v2.Variant=$(VARIANT) -X github.com/pilosa/pilosa/v2.Commit=$(COMMIT) -X github.com/pilosa/pilosa/v2.LatticeCommit=$(LATTICE_COMMIT)" -GO_VERSION=1.14.10 +GO_VERSION=1.16.7 RELEASE ?= 0 RELEASE_ENABLED = $(subst 0,,$(RELEASE)) BUILD_TAGS += $(if $(RELEASE_ENABLED),release) @@ -205,6 +205,11 @@ docker-tag-push: vendor docker push $(DOCKER_TARGET) @echo Pushed docker image: $(DOCKER_TARGET) +docker-release: check-clean generate-statik + $(MAKE) docker-build GOOS=linux GOARCH=amd64 + $(MAKE) docker-build GOOS=darwin GOARCH=amd64 + $(MAKE) docker-build GOOS=darwin GOARCH=arm64 + # Compile Pilosa inside Docker container docker-build: vendor docker run --rm -v $(PWD):/go/src/$(CLONE_URL) -w /go/src/$(CLONE_URL) -e GOOS=$(GOOS) -e GOARCH=$(GOARCH) golang:$(GO_VERSION) make build FLAGS="$(FLAGS) -mod=vendor" RELEASE=$(RELEASE)