diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..eee1e41 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,29 @@ +version: 2 +orbs: + codecov: codecov/codecov@1.0.2 +jobs: + build: + docker: + - image: circleci/golang:1.12 + environment: + GO111MODULE: "on" + working_directory: /hcl + steps: + - checkout + - run: + name: "Prepare Artifact Store" + command: | + mkdir -p /artifacts + - restore_cache: + keys: + - v1-mod-cache + - run: + name: "Tests" + command: | + .circleci/test.sh + - save_cache: + key: v1-mod-cache + paths: + - "/go/pkg/mod" + - codecov/upload: + file: /artifacts/coverage.txt diff --git a/.circleci/test.sh b/.circleci/test.sh new file mode 100755 index 0000000..abf6dfa --- /dev/null +++ b/.circleci/test.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -e +echo "" > coverage.txt + +for d in $(go list ./... | grep -v vendor); do + go test -coverprofile=/artifacts/profile.out -covermode=atomic $d + if [ -f /artifacts/profile.out ]; then + cat /artifacts/profile.out >> /artifacts/coverage.txt + rm /artifacts/profile.out + fi +done diff --git a/.travis.sh b/.travis.sh deleted file mode 100755 index 1770fa8..0000000 --- a/.travis.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -set -e -echo "" > coverage.txt - -for d in $(go list ./... | grep -v vendor); do - go test -coverprofile=profile.out -covermode=atomic $d - if [ -f profile.out ]; then - cat profile.out >> coverage.txt - rm profile.out - fi -done diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5395149..0000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: go - -go: - - 1.11.x - - 1.12.x - -env: - - GO111MODULE=on - -before_install: - - go get -v ./... - -script: - - ./.travis.sh - -after_success: - - bash <(curl -s https://codecov.io/bash)