Skip to content

Commit

Permalink
Add circle config (#25)
Browse files Browse the repository at this point in the history
* add circleci config

* add status badge and remove travis config
  • Loading branch information
alvin-huang committed May 22, 2019
1 parent 5a8fb53 commit 0146a9a
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 4 deletions.
72 changes: 72 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,72 @@
version: 2.1

references:
images:
go: &GOLANG_IMAGE circleci/golang:latest

# reusable 'executor' object for jobs
executors:
go:
docker:
- image: *GOLANG_IMAGE
environment:
- TEST_RESULTS: /tmp/test-results # path to where test results are saved

jobs:
go-fmt-and-vet:
executor: go
steps:
- checkout

# Restore go module cache if there is one
- restore_cache:
keys:
- go-immutable-radix-modcache-v1-{{ checksum "go.mod" }}

- run: go mod download

# Save go module cache if the go.mod file has changed
- save_cache:
key: go-immutable-radix-modcache-v1-{{ checksum "go.mod" }}
paths:
- "/go/pkg/mod"

# check go fmt output because it does not report non-zero when there are fmt changes
- run:
name: check go fmt
command: |
files=$(go fmt ./...)
if [ -n "$files" ]; then
echo "The following file(s) do not conform to go fmt:"
echo "$files"
exit 1
fi
- run: go vet ./...

go-test:
executor: go
steps:
- checkout
- run: mkdir -p $TEST_RESULTS

- restore_cache: # restore cache from dev-build job
keys:
- go-immutable-radix-modcache-v1-{{ checksum "go.mod" }}

# run go tests with gotestsum
- run: |
PACKAGE_NAMES=$(go list ./...)
gotestsum --format=short-verbose --junitfile $TEST_RESULTS/gotestsum-report.xml -- $PACKAGE_NAMES
- store_test_results:
path: /tmp/test-results
- store_artifacts:
path: /tmp/test-results

workflows:
version: 2
test-and-build:
jobs:
- go-fmt-and-vet
- go-test:
requires:
- go-fmt-and-vet
3 changes: 0 additions & 3 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
go-immutable-radix [![Build Status](https://travis-ci.org/hashicorp/go-immutable-radix.png)](https://travis-ci.org/hashicorp/go-immutable-radix)
go-immutable-radix [![CircleCI](https://circleci.com/gh/hashicorp/go-immutable-radix/tree/master.svg?style=svg)](https://circleci.com/gh/hashicorp/go-immutable-radix/tree/master)
=========

Provides the `iradix` package that implements an immutable [radix tree](http://en.wikipedia.org/wiki/Radix_tree).
Expand Down

0 comments on commit 0146a9a

Please sign in to comment.