Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CircleCI & remove travis #27

Merged
merged 1 commit into from Mar 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
59 changes: 59 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,59 @@
version: 2.1

references:
  images:
    go: &GOLANG_IMAGE circleci/golang:latest
  environments:
    tmp: &TEST_RESULTS_PATH /tmp/test-results # path to where test results are saved

# reusable 'executor' object for jobs
executors:
  go:
    docker:
      - image: *GOLANG_IMAGE
    environment:
      - TEST_RESULTS: *TEST_RESULTS_PATH

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

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

      - run: go mod download

      # Save go module cache if the go.mod file has changed
      - save_cache:
          key: go-multierror-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 tests with gotestsum
      - run: |
          PACKAGE_NAMES=$(go list ./...)
          gotestsum --format=short-verbose --junitfile $TEST_RESULTS/gotestsum-report.xml -- $PACKAGE_NAMES
      - store_test_results:
          path: *TEST_RESULTS_PATH
      - store_artifacts:
          path: *TEST_RESULTS_PATH

workflows:
  version: 2
  test-and-build:
    jobs:
      - go-test
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.