Skip to content

Commit

Permalink
Use orbs in CI config
Browse files Browse the repository at this point in the history
  • Loading branch information
dnephin committed Mar 10, 2019
1 parent bf49092 commit 1b86808
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 87 deletions.
178 changes: 109 additions & 69 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,61 @@
version: 2
version: 2.1

workflows:
version: 2
ci:
jobs:
- test-go-1-10:
name: test-go-1.10

- go/test:
name: test-go-1.11
gotestsum-format: short-verbose
executor:
name: go/golang
tag: 1.11-alpine

- go/test:
name: test-go-1.12
gotestsum-format: short-verbose
executor:
name: go/golang
tag: 1.12-alpine

- lint
- build
- run

- build:
name: release
publish: true
filters:
tags: {only: '/v[0-9]+(\.[0-9]+)*/'}
branches: {ignore: '/.*/'}

orbs:
go: gotest/tools@0.0.7

commands:
install-deps:
description: Install dep and dependencies
steps:
- run:
name: Install dep
command: |
command -v dep && exit
wget -O- -q https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- run:
name: Install dependencies
command: dep ensure

install-goreleaser:
description: Install goreleaser
steps:
- run:
name: Install goreleaser
command: |
command -v goreleaser && exit
wget -O- -q https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh
jobs:

Expand Down Expand Up @@ -30,82 +87,65 @@ jobs:
--tag testsum-linter:$CIRCLE_BUILD_NUM .
docker run --rm testsum-linter:$CIRCLE_BUILD_NUM
test-golang-1.10:
working_directory: /work
docker: [{image: 'docker:17.06-git'}]
steps:
- checkout
- setup_remote_docker
- run:
name: "Unit Test GO 1.10"
command: |
scripts/ci/test 1.10.3-alpine
mkdir -p junit/gotest
docker cp \
test-$CIRCLE_BUILD_NUM:/go/src/gotest.tools/gotestsum/junit.xml \
junit/gotest/junit.xml
- store_test_results:
path: junit/

test-golang-1.11:
working_directory: /work
docker: [{image: 'docker:17.06-git'}]
build:
parameters:
publish:
type: boolean
default: false
executor: go/golang
steps:
- go/install-git
- go/install-ssh
- checkout
- setup_remote_docker
- run:
name: "Unit Test GO 1.11"
command: |
scripts/ci/test 1.11-alpine
mkdir -p junit/gotest
docker cp \
test-$CIRCLE_BUILD_NUM:/go/src/gotest.tools/gotestsum/junit.xml \
junit/gotest/junit.xml
- go/mod-download
- go/mod-tidy-check
- install-goreleaser
- unless:
condition: << parameters.publish >>
steps:
run:
name: build binaries
command: bin/goreleaser --rm-dist --snapshot
- when:
condition: << parameters.publish >>
steps:
run:
name: build and publish binaries
command: bin/goreleaser --rm-dist --skip-validate
- store_artifacts:
path: ./dist
destination: dist

- store_test_results:
path: junit/

test-golang-1.12:
working_directory: /work
docker: [{image: 'docker:17.06-git'}]
test-go-1-10:
executor:
name: go/golang
tag: 1.10-alpine
working_directory: /go/src/gotest.tools/gotestsum
steps:
- go/install-git
- go/install-ssh
- checkout
- setup_remote_docker
- go/install-gotestsum
- install-deps
- run:
name: "Unit Test GO 1.12"
name: go test
environment:
GOTESTSUM_JUNITFILE: /tmp/test-reports/unit/junit.xml
GOTESTSUM_FORMAT: short-verbose
command: |
scripts/ci/test 1.12rc1-alpine
mkdir -p junit/gotest
docker cp \
test-$CIRCLE_BUILD_NUM:/go/src/gotest.tools/gotestsum/junit.xml \
junit/gotest/junit.xml
mkdir -p /tmp/test-reports/unit
gotestsum
- store_test_results:
path: junit/
path: /tmp/test-reports

release:
docker: [{image: 'circleci/golang:1.11'}]
working_directory: /go/src/gotest.tools/gotestsum
run:
executor: go/golang
steps:
- go/install-git
- go/install-ssh
- checkout
- deploy:
name: "release"
command: |
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
go get github.com/goreleaser/goreleaser
goreleaser --rm-dist --skip-validate
workflows:
version: 2
ci:
jobs:
- lint
- test-golang-1.10
- test-golang-1.11
- test-golang-1.12
- release:
filters:
tags: {only: '/v[0-9]+(\.[0-9]+)*/'}
branches: {ignore: '/.*/'}
- go/mod-download
- run: |
mkdir -p dist
go build -o dist/gotestsum .
- run: dist/gotestsum
2 changes: 0 additions & 2 deletions scripts/build

This file was deleted.

16 changes: 0 additions & 16 deletions scripts/ci/test

This file was deleted.

0 comments on commit 1b86808

Please sign in to comment.