From b87644813f86ef70ffe80756bfbd44631f9a6e07 Mon Sep 17 00:00:00 2001 From: Huan Du Date: Tue, 21 Dec 2021 11:33:16 +0800 Subject: [PATCH 1/5] create go.yml for github actions --- .github/workflows/go.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..08d4d24 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,25 @@ +name: Go + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.17 + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -v ./... From 4412b222ffc2432d85cf7a6cf1684ec1771f25e7 Mon Sep 17 00:00:00 2001 From: Huan Du Date: Tue, 21 Dec 2021 11:48:55 +0800 Subject: [PATCH 2/5] update readme for github action badges --- .github/workflows/go.yml | 34 ++++++++++++++++++++++------------ .travis.yml | 7 ------- README.md | 2 +- 3 files changed, 23 insertions(+), 20 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 08d4d24..a45866d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -2,24 +2,34 @@ name: Go on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: - build: + name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: 1.17 + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.17 + - name: Get dependencies + run: | + go mod download + go get - - name: Build - run: go build -v ./... + - name: Test + run: go test -v -coverprofile=covprofile.cov ./... - - name: Test - run: go test -v ./... + - name: Send coverage + env: + COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + go get github.com/mattn/goveralls + go run github.com/mattn/goveralls -coverprofile=covprofile.cov -service=github diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d6460be..0000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: go -install: - - go get golang.org/x/tools/cmd/cover - - go get github.com/mattn/goveralls -script: - - go test -v -covermode=count -coverprofile=coverage.out - - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ ! -z "$COVERALLS_TOKEN" ]; then $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN; fi' diff --git a/README.md b/README.md index 0bde1bc..750c3c7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # xstrings -[![Build Status](https://travis-ci.com/huandu/xstrings.svg?branch=master)](https://travis-ci.com/huandu/xstrings) +[![Build Status](https://github.com/huandu/xstrings/workflows/Go/badge.svg)](https://github.com/huandu/xstrings/actions) [![Go Doc](https://godoc.org/github.com/huandu/xstrings?status.svg)](https://pkg.go.dev/github.com/huandu/xstrings) [![Go Report](https://goreportcard.com/badge/github.com/huandu/xstrings)](https://goreportcard.com/report/github.com/huandu/xstrings) [![Coverage Status](https://coveralls.io/repos/github/huandu/xstrings/badge.svg?branch=master)](https://coveralls.io/github/huandu/xstrings?branch=master) From a79a8a18e2537f0730cd52f7813f5d5da2d287d5 Mon Sep 17 00:00:00 2001 From: Huan Du Date: Tue, 21 Dec 2021 11:59:41 +0800 Subject: [PATCH 3/5] tweak github actions --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a45866d..90cd99b 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -31,5 +31,5 @@ jobs: env: COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - go get github.com/mattn/goveralls + go install github.com/mattn/goveralls go run github.com/mattn/goveralls -coverprofile=covprofile.cov -service=github From 05d8f1bd01244f02ad85d0cf8b2d6bb7ff79f48f Mon Sep 17 00:00:00 2001 From: Huan Du Date: Tue, 21 Dec 2021 12:01:04 +0800 Subject: [PATCH 4/5] tweak github actions --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 90cd99b..ab8c620 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -32,4 +32,4 @@ jobs: COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | go install github.com/mattn/goveralls - go run github.com/mattn/goveralls -coverprofile=covprofile.cov -service=github + goveralls -coverprofile=covprofile.cov -service=github From e2578a76ef66aeb58f140e00486fc443fcb3d12b Mon Sep 17 00:00:00 2001 From: Huan Du Date: Tue, 21 Dec 2021 12:02:04 +0800 Subject: [PATCH 5/5] tweak github actions --- .github/workflows/go.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index ab8c620..1aa67ba 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -31,5 +31,6 @@ jobs: env: COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | + go get github.com/mattn/goveralls go install github.com/mattn/goveralls goveralls -coverprofile=covprofile.cov -service=github