diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..57ffd52 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,38 @@ +name: build +on: [push] +jobs: + + test: + name: Test + runs-on: ubuntu-latest + container: + image: golang:buster + steps: + + - name: checkout + run: | + git clone https://github.com/$GITHUB_REPOSITORY /go/src/$GITHUB_REPOSITORY + cd /go/src/$GITHUB_REPOSITORY + git checkout $GITHUB_REF + + - name: Get dependencies + run: | + cd /go/src/$GITHUB_REPOSITORY + go get -v -t -d ./... + if [ -f Gopkg.toml ]; then + go get github.com/golang/dep/cmd/dep + go build github.com/golang/dep/cmd/dep + dep ensure + fi + + - name: unit tests + run: | + cd /go/src/$GITHUB_REPOSITORY + echo "" > coverage.txt + sh test.sh + + - name: code coverage + if: github.ref == 'refs/heads/master' + run: | + cd /go/src/$GITHUB_REPOSITORY + curl -s https://codecov.io/bash | bash diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c0d0a73..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: go -go: - - 1.x -install: - - go build -v ./... - -script: - - echo "" > coverage.txt - - sh test.sh - -after_success: - - test $TRAVIS_BRANCH = "master" && - bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md index 9839009..3ce865c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # rootfinding -[![GoDoc](https://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](https://godoc.org/github.com/khezen/rootfinding) -[![Build Status](http://img.shields.io/travis/khezen/rootfinding.svg?style=flat-square)](https://travis-ci.org/khezen/rootfinding) [![codecov](https://img.shields.io/codecov/c/github/khezen/rootfinding/master.svg?style=flat-square)](https://codecov.io/gh/khezen/rootfinding) -[![Go Report Card](https://goreportcard.com/badge/github.com/khezen/rootfinding?style=flat-square)](https://goreportcard.com/report/github.com/khezen/rootfinding) +[![GoDoc](https://img.shields.io/badge/go-documentation-blue.svg)](https://godoc.org/github.com/khezen/rootfinding) +[![Build Status](https://github.com/khezen/rootfinding/workflows/build/badge.svg?branch=master)](https://github.com/khezen/rootfinding/actions?query=workflow%3Abuild) [![codecov](https://img.shields.io/codecov/c/github/khezen/rootfinding/master.svg)](https://codecov.io/gh/khezen/rootfinding) +[![Go Report Card](https://goreportcard.com/badge/github.com/khezen/rootfinding)](https://goreportcard.com/report/github.com/khezen/rootfinding) `github.com/khezen/rootfinding` diff --git a/test.sh b/test.sh index 47653ca..7934cc1 100755 --- a/test.sh +++ b/test.sh @@ -4,7 +4,7 @@ unit_tests(){ local ret ret=0 for d in $(go list ./... | grep -v vendor); do - COV=$(go test -race -coverprofile=profile.out -covermode=atomic $d | sed 's/.*\[no test files\]/0/g' | sed 's/.*coverage//g' | sed 's/[^0-9.]*//g' | sed 's/\.[0-9.]*//g') + COV=$(go test -race -coverprofile=profile.out -covermode=atomic $d | sed 's/.*\[no test files\]/0/g' | sed 's/.*coverage//g' | sed 's/[^0-9.]*//g' | sed 's/\.[0-9.]*//g') if [ -f profile.out ]; then cat profile.out >> coverage.txt; rm profile.out;