Skip to content

Commit

Permalink
Use orbs in CircleCI (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmiyake authored Jan 9, 2019
1 parent 2bae728 commit 7d94ed9
Showing 1 changed file with 31 additions and 106 deletions.
137 changes: 31 additions & 106 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,107 +1,16 @@
working_dir: &working_dir
working_directory: /go/src/github.com/palantir/godel-okgo-asset-outparamcheck
owner-repo: &owner-repo
owner-repo: palantir/godel-okgo-asset-outparamcheck

darwin-linux-no-cgo: &darwin-linux-no-cgo
<<: *working_dir
docker:
- image: nmiyake/go:go-darwin-linux-no-cgo-1.11-t133
environment:
CGO_ENABLED: 0
excutor: &executor
executor:
name: go/golang-1_11
<<: *owner-repo

godel-root-cache-restore: &godel-root-cache-restore
restore_cache:
keys:
- godel-root-cache-{{ checksum "godelw" }}-{{ checksum "godel/config/godel.yml" }}-v1
godel-root-cache-save: &godel-root-cache-save
save_cache:
key: godel-root-cache-{{ checksum "godelw" }}-{{ checksum "godel/config/godel.yml" }}-v1
paths:
- ~/.godel
version: 2.1

go-version: &go-version
run: go version

godel-cache-restore: &godel-cache-restore
restore_cache:
keys:
- godel-cache-{{ checksum "godelw" }}-v1

godel-version: &godel-version
run: ./godelw version

godel-cache-save: &godel-cache-save
save_cache:
key: godel-cache-{{ checksum "godelw" }}-v1
paths:
- ~/.godel

define-tests-dir: &define-tests-dir
run: echo 'export TESTS_DIR=/tmp/test-results' >> $BASH_ENV

mkdir-tests-dir: &mkdir-tests-dir
run: mkdir -p "${TESTS_DIR}"

go-install-packages: &go-install-packages
run: go install $(./godelw packages)

godelw-verify: &godelw-verify
run: ./godelw verify --apply=false --junit-output="$TESTS_DIR/$CIRCLE_PROJECT_REPONAME-tests.xml"

store-test-results: &store-test-results
type: test-results-store
path: /tmp/test-results

store-artifacts: &store-artifacts
type: artifacts-store
path: /tmp/test-results
destination: test-results

version: 2
jobs:
verify:
<<: *darwin-linux-no-cgo
steps:
- checkout
- *go-version
- *godel-cache-restore
- *godel-version
- *godel-cache-save
- *define-tests-dir
- *mkdir-tests-dir
- *go-install-packages
- *godelw-verify
- *store-test-results
- *store-artifacts
dist:
<<: *darwin-linux-no-cgo
steps:
- checkout
- *go-version
- *godel-cache-restore
- *godel-version
- *godel-cache-save
- run: ./godelw dist
- save_cache:
key: dist-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ .Environment.CIRCLE_SHA1 }}-v1
paths:
- dist
publish:
<<: *darwin-linux-no-cgo
steps:
- checkout
- *go-version
- *godel-root-cache-restore
- *godel-version
- *godel-root-cache-save
- restore_cache:
keys:
- dist-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ .Environment.CIRCLE_SHA1 }}-v1
- run: ./godelw publish bintray --url https://api.bintray.com --subject palantir --repository releases --product godel-okgo-asset-outparamcheck --username "$BINTRAY_USERNAME" --password "$BINTRAY_PASSWORD" --publish --downloads-list

### Workflows ###
requires_products: &requires_products
- verify
- dist
orbs:
go: palantir/go@0.0.5
godel: palantir/godel@0.0.2

all-tags-filter: &all-tags-filter
filters:
Expand All @@ -110,14 +19,30 @@ all-tags-filter: &all-tags-filter

workflows:
version: 2
build-publish:
verify-test-dist-publish:
jobs:
- verify:
- godel/verify:
name: verify
<<: *executor
<<: *all-tags-filter
- godel/test:
name: test
<<: *executor
<<: *all-tags-filter
- dist:
- godel/dist:
name: dist
<<: *executor
<<: *all-tags-filter
- publish:
requires: *requires_products
- godel/bintray-publish:
name: publish
<<: *executor
bintray-subject: palantir
bintray-repo: releases
bintray-product: godel-okgo-asset-outparamcheck
requires:
- verify
- test
- dist
filters:
tags:
only: /^v?[0-9]+(\.[0-9]+)+(-rc[0-9]+)?(-alpha[0-9]+)?$/
Expand Down

0 comments on commit 7d94ed9

Please sign in to comment.