Skip to content

Commit 10a89a7

Browse files
authored
Merge pull request #64 from hashicorp/add-circle-config
add circleci config and move to circle
2 parents aa22b0d + 5d3ebb9 commit 10a89a7

File tree

3 files changed

+59
-14
lines changed

3 files changed

+59
-14
lines changed

.circleci/config.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
version: 2.1
2+
3+
references:
4+
images:
5+
go: &GOLANG_IMAGE circleci/golang:latest
6+
environments:
7+
tmp: &TEST_RESULTS_PATH /tmp/test-results # path to where test results are saved
8+
9+
# reusable 'executor' object for jobs
10+
executors:
11+
go:
12+
docker:
13+
- image: *GOLANG_IMAGE
14+
environment:
15+
- TEST_RESULTS: *TEST_RESULTS_PATH
16+
17+
jobs:
18+
go-test:
19+
executor: go
20+
steps:
21+
- checkout
22+
- run: mkdir -p $TEST_RESULTS
23+
24+
- restore_cache: # restore cache from dev-build job
25+
keys:
26+
- go-version-modcache-v1-{{ checksum "go.mod" }}
27+
28+
# Save go module cache if the go.mod file has changed
29+
- save_cache:
30+
key: go-version-modcache-v1-{{ checksum "go.mod" }}
31+
paths:
32+
- "/go/pkg/mod"
33+
34+
# check go fmt output because it does not report non-zero when there are fmt changes
35+
- run:
36+
name: check go fmt
37+
command: |
38+
files=$(go fmt ./...)
39+
if [ -n "$files" ]; then
40+
echo "The following file(s) do not conform to go fmt:"
41+
echo "$files"
42+
exit 1
43+
fi
44+
45+
# run go tests with gotestsum
46+
- run: |
47+
PACKAGE_NAMES=$(go list ./...)
48+
gotestsum --format=short-verbose --junitfile $TEST_RESULTS/gotestsum-report.xml -- $PACKAGE_NAMES
49+
- store_test_results:
50+
path: *TEST_RESULTS_PATH
51+
- store_artifacts:
52+
path: *TEST_RESULTS_PATH
53+
54+
workflows:
55+
version: 2
56+
test-and-build:
57+
jobs:
58+
- go-test

.travis.yml

-13
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Versioning Library for Go
2-
[![Build Status](https://travis-ci.org/hashicorp/go-version.svg?branch=master)](https://travis-ci.org/hashicorp/go-version)
2+
[![Build Status](https://circleci.com/gh/hashicorp/go-version/tree/master.svg?style=svg)](https://circleci.com/gh/hashicorp/go-version/tree/master)
33

44
go-version is a library for parsing versions and version constraints,
55
and verifying versions against a set of constraints. go-version

0 commit comments

Comments
 (0)