build: Switch from Travis-CI to Circle-CI

This commit is contained in:
Martin Atkins 2019-09-10 15:20:42 -07:00
parent c29bdc1243
commit 76cda0e2aa
4 changed files with 41 additions and 29 deletions

29
.circleci/config.yml Normal file
View File

@ -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

12
.circleci/test.sh Executable file
View File

@ -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

View File

@ -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

View File

@ -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)