Skip to content

Commit c7dd669

Browse files
authored
Merge pull request #27 from mdeggies/add-circleci
Add CircleCI & remove travis
2 parents 249b055 + e9c06a1 commit c7dd669

File tree

2 files changed

+59
-12
lines changed

2 files changed

+59
-12
lines changed

.circleci/config.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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-multierror-modcache-v1-{{ checksum "go.mod" }}
27+
28+
      - run: go mod download
29+
30+
      # Save go module cache if the go.mod file has changed
31+
      - save_cache:
32+
          key: go-multierror-modcache-v1-{{ checksum "go.mod" }}
33+
          paths:
34+
            - "/go/pkg/mod"
35+
36+
      # check go fmt output because it does not report non-zero when there are fmt changes
37+
      - run:
38+
          name: check go fmt
39+
          command: |
40+
            files=$(go fmt ./...)
41+
            if [ -n "$files" ]; then
42+
              echo "The following file(s) do not conform to go fmt:"
43+
              echo "$files"
44+
              exit 1
45+
            fi
46+
      # run go tests with gotestsum
47+
      - run: |
48+
          PACKAGE_NAMES=$(go list ./...)
49+
          gotestsum --format=short-verbose --junitfile $TEST_RESULTS/gotestsum-report.xml -- $PACKAGE_NAMES
50+
      - store_test_results:
51+
          path: *TEST_RESULTS_PATH
52+
      - store_artifacts:
53+
          path: *TEST_RESULTS_PATH
54+
55+
workflows:
56+
  version: 2
57+
  test-and-build:
58+
    jobs:
59+
      - go-test

.travis.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)