build(ci): add codecov

This commit is contained in:
Aiden X 2020-04-01 02:06:24 +08:00
parent 3266eefe41
commit c6429e6836
4 changed files with 54 additions and 23 deletions

View File

@ -7,28 +7,57 @@ on:
branches: [ master ]
jobs:
build:
name: Build
lint:
name: Run golanci-lint
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Run golangci-lint
uses: Mushus/golangci-linter@v1
- name: Get dependencies
run: |
go get -v -t -d ./...
bash scripts/prepare.sh
test:
name: Run unittest
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.13
- name: Run golangci-lint
uses: Mushus/golangci-linter@v1
- name: Check out code
uses: actions/checkout@v1
- name: Build
run: go build -v ./cmd/bitxhub
- name: Run Unit tests.
run: |
export PATH=$PATH:$(go env GOPATH)/bin
make prepare
make test-coverage
- name: Upload Coverage report to CodeCov
uses: codecov/codecov-action@v1.0.0
with:
token: ${{secrets.CODECOV_TOKEN}}
file: ./coverage.txt
build:
name: Build project
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Go build
run: go build -v ./cmd/bitxhub

4
.gitignore vendored
View File

@ -13,10 +13,10 @@ build_solo
build.tar.gz
cover.out
coverage.out
cover.html
pid
scripts/prepare
docs/.vuepress/dist
logs
mock_*/
.fabric-samples
.fabric-samples
coverage.txt

View File

@ -29,7 +29,7 @@ help: Makefile
## make prepare: Preparation before development
prepare:
@cd scripts && sh prepare.sh
@cd scripts && bash prepare.sh
## make test: Run go unittest
test:
@ -38,8 +38,9 @@ test:
## make test-coverage: Test project with cover
test-coverage:
@$(GO) test -coverprofile cover.out ${TEST_PKGS}
$(GO) tool cover -html=cover.out -o cover.html
go generate ./...
@go test -short -coverprofile cover.out -covermode=atomic ${TEST_PKGS}
@cat cover.out >> coverage.txt
## make tester: Run integration test
tester:

View File

@ -3,6 +3,7 @@
</p>
![build](https://github.com/meshplus/bitxhub/workflows/build/badge.svg)
[![codecov](https://codecov.io/gh/meshplus/bitxhub/branch/master/graph/badge.svg)](https://codecov.io/gh/meshplus/bitxhub)
BitXHub is committed to building a scalable, robust, and pluggable inter-blockchain
reference implementation, that can provide reliable technical support for the formation