Permalink
Browse files

Update release strategy and migrate to circle 2 (#355)

* Update building strategies

* We will build natively OS X binaries so it uses
  the system  DNS resolver
* For Linux, we will compile 2 binaries:
  * One with CGO disabled (which is how our current binary
    behaves)
  * One with CGO enabled and that forces the use of CGO for
    DNS resolution

* wip: circle 2.0

* update circle

* bump version to 0.6.3

* Add comment on make release
  • Loading branch information...
ale7714 committed Sep 5, 2018
1 parent 7edc41d commit 91112eb12ecb3c1cd1b91632a5fe120d6dfdc188
Showing with 157 additions and 41 deletions.
  1. +96 −0 .circleci/config.yml
  2. +7 −0 CHANGELOG.md
  3. +49 −12 Makefile
  4. +0 −25 circle.yml
  5. +1 −1 env/ci.go
  6. +3 −2 env/ci_test.go
  7. +1 −1 env/git_test.go
@@ -0,0 +1,96 @@
version: 2
jobs:
test_linux:
docker:
- image: circleci/golang
working_directory: /go/src/github.com/codeclimate/test-reporter
setup_remote_docker:
docker_layer_caching: true
steps:
- checkout
- run: make test

release_linux:
docker:
- image: circleci/golang
working_directory: /go/src/github.com/codeclimate/test-reporter
setup_remote_docker:
docker_layer_caching: true
steps:
- checkout
- run: sudo apt-get install awscli
- run: make build-linux-all VERSION=head
- run: make publish-head

test_macos:
macos:
xcode: "9.0"
steps:
- checkout
- run: brew install golang
- run:
name: Setup gopath
command: |
mkdir -p ~/gopath/src/github.com/codeclimate/test-reporter
echo 'export GOPATH=$HOME/gopath' >> "$BASH_ENV"
. "$BASH_ENV"
cd $GOPATH/src/github.com/codeclimate/test-reporter
cp -r ~/project/ $GOPATH/src/github.com/codeclimate/test-reporter/
- run:
name: Run tests
command: |
cd $GOPATH/src/github.com/codeclimate/test-reporter
make test
release_macos:
macos:
xcode: "9.0"
steps:
- checkout
- run: pip install awscli
- run: brew install golang
- run:
name: Setup gopath
command: |
mkdir -p ~/gopath/src/github.com/codeclimate/test-reporter
echo 'export GOPATH=$HOME/gopath' >> "$BASH_ENV"
. "$BASH_ENV"
cd $GOPATH/src/github.com/codeclimate/test-reporter
cp -r ~/project/ $GOPATH/src/github.com/codeclimate/test-reporter/
- run:
name: Build
command: |
cd $GOPATH/src/github.com/codeclimate/test-reporter
make build-darwin VERSION=head
- run:
name: Publish
command: |
cd $GOPATH/src/github.com/codeclimate/test-reporter
make publish-head
workflows:
version: 2
build_deploy:
jobs:
- test_linux
- test_macos
- release_linux:
requires:
- test_linux
- test_macos
filters:
branches:
only:
- master
- release_macos:
requires:
- test_linux
- test_macos
filters:
branches:
only:
- master

notify:
webhooks:
- url: https://cc-slack-proxy.herokuapp.com/circle
@@ -1,5 +1,12 @@
# Change log

## v0.6.3 [(2018-09-04)](https://github.com/codeclimate/test-reporter/releases/tag/v0.6.3)

* [NEW] Updates release strategy to build a new Linux binary that uses
`netcgo` [#355][]

[#355]: https://github.com/codeclimate/test-reporter/pull/355

## v0.6.2 [(2018-07-31)](https://github.com/codeclimate/test-reporter/releases/tag/v0.6.2)

* [NEW] Add support for multiple JaCoCo source paths [#348][]
@@ -1,4 +1,4 @@
.PHONY: test-docker build-docker build-all build-all-latest release test-excoveralls
.PHONY: test-docker build-docker build-linux-cgo release test-excoveralls

AWS ?= $(shell which aws)
DOCKER_RUN ?= $(shell which docker) run --rm
@@ -10,7 +10,7 @@ MAN_FILES = $(wildcard man/*.md)
MAN_PAGES = $(patsubst man/%.md,man/%,$(MAN_FILES))

PROJECT = github.com/codeclimate/test-reporter
VERSION ?= 0.6.2
VERSION ?= 0.6.3
BUILD_VERSION = $(shell git log -1 --pretty=format:'%H')
BUILD_TIME = $(shell date +%FT%T%z)
LDFLAGS = -ldflags "-X $(PROJECT)/version.Version=${VERSION} -X $(PROJECT)/version.BuildVersion=${BUILD_VERSION} -X $(PROJECT)/version.BuildTime=${BUILD_TIME}"
@@ -27,14 +27,40 @@ benchmark:
go test -bench . $(shell go list ./... | grep -v /vendor/)

build:
go build -v ${LDFLAGS} -o $(PREFIX)bin/test-reporter$(BINARY_SUFFIX)
if [ -z "${BUILD_TAGS}" ]; then \
go build -v ${LDFLAGS} -o $(PREFIX)bin/test-reporter$(BINARY_SUFFIX); \
else \
go build -v ${LDFLAGS} -tags ${BUILD_TAGS} -o $(PREFIX)bin/test-reporter$(BINARY_SUFFIX); \
fi

build-linux-all:
$(MAKE) build-linux
$(MAKE) build-linux-cgo

build-linux:
$(MAKE) build \
PREFIX=artifacts/ \
BINARY_SUFFIX=-$(VERSION)-linux-amd64 \
CGO_ENABLED=0

build-docker-linux:
$(MAKE) build-docker GOOS=linux GOARCH=amd64 CGO_ENABLED=0

build-docker-linux-cgo:
$(MAKE) build-docker GOOS=linux GOARCH=amd64 CGO_ENABLED=1 \
BUILD_TAGS="netcgo" BINARY_SUFFIX=-$(VERSION)-netcgo-linux-amd64

build-all:
$(MAKE) build-docker GOOS=darwin GOARCH=amd64
$(MAKE) build-docker GOOS=linux GOARCH=amd64
build-linux-cgo:
$(MAKE) build \
PREFIX=artifacts/ \
BINARY_SUFFIX=-$(VERSION)-netcgo-linux-amd64 \
CGO_ENABLED=1 \
BUILD_TAGS="netcgo"

build-all-latest:
$(MAKE) build-all VERSION=latest
build-darwin:
$(MAKE) build \
PREFIX=artifacts/ \
BINARY_SUFFIX=-$(VERSION)-darwin-amd64

test-docker:
$(DOCKER_RUN) \
@@ -50,18 +76,19 @@ benchmark-docker:
--workdir "/src/$(PROJECT)" \
golang:1.8 make benchmark

build-docker: BINARY_SUFFIX ?= -$(VERSION)-$$GOOS-$$GOARCH
build-docker:
$(DOCKER_RUN) \
--env PREFIX=/artifacts/ \
--env BINARY_SUFFIX=-$(VERSION)-$$GOOS-$$GOARCH \
--env BINARY_SUFFIX=${BINARY_SUFFIX} \
--env GOARCH \
--env GOOS \
--env GOPATH=/ \
--env CGO_ENABLED=0 \
--env CGO_ENABLED \
--volume "$(PWD)"/artifacts:/artifacts \
--volume "$(PWD)":"/src/$(PROJECT)":ro \
--workdir "/src/$(PROJECT)" \
golang:1.8 make build
golang:1.8 make build BUILD_TAGS=${BUILD_TAGS}

test-simplecov:
docker build -f integration-tests/simplecov/Dockerfile .
@@ -124,4 +151,14 @@ clean:
sudo $(RM) -r ./artifacts
$(RM) $(MAN_PAGES)

release: build-all build-all-latest publish-version publish-latest tag
# Must be run in a OS X machine. OS X binary is build natively.
release:
$(MAKE) build-docker-linux
$(MAKE) build-docker-linux-cgo
$(MAKE) build-darwin
$(MAKE) build-docker-linux VERSION=latest
$(MAKE) build-docker-linux-cgo VERSION=latest
$(MAKE) build-darwin VERSION=latest
$(MAKE) publish-version
$(MAKE) publish-latest
$(MAKE) tag

This file was deleted.

Oops, something went wrong.
@@ -31,4 +31,4 @@ var ciNameVars = []string{"CI_NAME", "APPVEYOR", "BUILDKITE", "CIRCLECI", "GITLA

var ciBuildIDVars = []string{"CI_BUILD_ID", "APPVEYOR_BUILD_ID", "BUILDKITE_JOB_ID", "BUILD_NUMBER", "CIRCLE_BUILD_NUM", "CI_BUILD_NUMBER", "DRONE_BUILD_NUMBER", "HEROKU_TEST_RUN_ID", "SEMAPHORE_BUILD_NUMBER", "TDDIUM_SESSION_ID", "TRAVIS_JOB_ID", "WERCKER_BUILD_ID"}

var ciBuildURLVars = []string{"CI_BUILD_URL", "APPVEYOR_API_URL", "BUILDKITE_BUILD_URL", "BUILD_URL", "CIRCLE_BUILD_NUM", "DRONE_BUILD_LINK", "WERCKER_BUILD_URL"}
var ciBuildURLVars = []string{"CI_BUILD_URL", "APPVEYOR_API_URL", "BUILDKITE_BUILD_URL", "BUILD_URL", "CIRCLE_BUILD_URL", "DRONE_BUILD_LINK", "WERCKER_BUILD_URL"}
@@ -23,9 +23,10 @@ func Test_loadCIFromENV(t *testing.T) {
func Test_loadCIFromENV_Alt_Vars(t *testing.T) {
r := require.New(t)
envy.Temp(func() {
envy.Set("CIRCLECI", "")
envy.Set("GITLAB_CI", "gitlab")
envy.Set("TDDIUM_SESSION_ID", "b12345")
envy.Set("BUILDKITE_BUILD_URL", "http://example.org")
envy.Set("CIRCLE_BUILD_NUM", "b12345")
envy.Set("CIRCLE_BUILD_URL", "http://example.org")
c := loadCIInfo()
r.Equal(c.Name, "gitlab")
r.Equal(c.BuildID, "b12345")
@@ -46,7 +46,7 @@ func Test_loadGitFromENV_Alt_Vars(t *testing.T) {
r := require.New(t)
envy.Temp(func() {
envy.Set("CIRCLE_BRANCH", "circle")
envy.Set("WERCKER_GIT_COMMIT", "b12345")
envy.Set("CIRCLE_SHA1", "b12345")
envy.Set("CI_COMMITED_AT", "1345")
g, err := findGitInfo()
r.NoError(err)

0 comments on commit 91112eb

Please sign in to comment.