From cc1f2e60169f48bd8971a79a55673b897c315342 Mon Sep 17 00:00:00 2001 From: Achilleas Anagnostopoulos Date: Sun, 26 Mar 2017 09:48:12 +0100 Subject: [PATCH] Setup CI and coverage tools --- .travis.yml | 10 ++++++++++ README.md | 4 ++++ coverage.sh | 16 ++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 .travis.yml create mode 100644 coverage.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..583c83f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: go +sudo: required +go: + - 1.8 +before_install: + - go get -t -v ./... +script: + - bash coverage.sh +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md index d003d54..bb2ff85 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,6 @@ # gopheros +L[![Build Status](https://travis-ci.org/achilleasa/gopher-os.svg?branch=master)](https://travis-ci.org/achilleasa/gopher-os) +[![codecov](https://codecov.io/gh/achilleasa/gopher-os/branch/master/graph/badge.svg)](https://codecov.io/gh/achilleasa/gopher-os) +[![Go Report Card](https://goreportcard.com/badge/github.com/achilleasa/gopher-os)](https://goreportcard.com/report/github.com/achilleasa/gopher-os) + Let's write an experimental OS in Go! diff --git a/coverage.sh b/coverage.sh new file mode 100644 index 0000000..767dc9e --- /dev/null +++ b/coverage.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -e + +go test -v -race ./... + +echo "" > coverage.txt + +for d in $(go list ./... | grep -v vendor); do + # Running with -race and -covermode=atomic generates false positives so + # we run the -race bit separately + go test -coverprofile=profile.out -covermode=atomic $d + if [ -f profile.out ]; then + cat profile.out >> coverage.txt + rm profile.out + fi +done