Skip to content

Commit

Permalink
add circleci integration.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhadfield committed May 16, 2018
1 parent 839ca66 commit 7ac22b9
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Golang CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-go/ for more details
version: 2
jobs:
build:
docker:
- image: circleci/golang:1.9
working_directory: /go/src/github.com/jonhadfield/subtocheck
steps:
- checkout
- run: go get -v -t -d ./...
- run: go test -v ./...
release:
docker:
- image: circleci/golang:1.9
working_directory: /go/src/github.com/jonhadfield/subtocheck
steps:
- checkout
- run: go get github.com/tcnksm/ghr
- run: go get github.com/mitchellh/gox
- run: mkdir dist
- run: echo "export BUILD_TAG=$(git describe --tags)" >> $BASH_ENV
- run: echo "export BUILD_SHA=$(git rev-parse --short HEAD)" >> $BASH_ENV
- run: echo "export BUILD_DATE=$(date -u '+%Y/%m/%d:%H:%M:%S')" >> $BASH_ENV
- run: gox -verbose -osarch="darwin/amd64 linux/amd64 linux/arm linux/arm64 netbsd/amd64 openbsd/amd64 freebsd/amd64" -ldflags "-X main.tag=$BUILD_TAG -X main.sha=$BUILD_SHA -X main.buildDate=$BUILD_DATE" -output "dist/subtocheck_{{.OS}}_{{.Arch}}" ./...
- run: ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME --replace `git describe --tags` dist/

workflows:
version: 2
build-release:
jobs:
- build:
filters:
tags:
only: /.*/
- release:
requires:
- build
filters:
tags:
only: /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)/
branches:
ignore: /.*/

0 comments on commit 7ac22b9

Please sign in to comment.