From 86a1a2f981b0aff0418e9d028117d7ee746a8829 Mon Sep 17 00:00:00 2001 From: liwei Date: Thu, 25 Mar 2021 19:47:59 +0800 Subject: [PATCH] ci: support --- .github/workflows/build.yml | 47 +++++++++++++++++++++++++++++++++++ README.md | 3 +++ cmd/{cli => gopeed}/flags.go | 0 cmd/{cli => gopeed}/gopeed.go | 0 4 files changed, 50 insertions(+) create mode 100644 .github/workflows/build.yml rename cmd/{cli => gopeed}/flags.go (100%) rename cmd/{cli => gopeed}/gopeed.go (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..d2fe1f4f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,47 @@ +name: build + +on: + pull_request: + push: + branches: + - dev + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v2 + with: + go-version: '^1.15.2' + - uses: actions/checkout@v2 + - name: Lint Go Code + run: | + export PATH=$PATH:$(go env GOPATH)/bin # temporary fix. See https://github.com/actions/setup-go/issues/14 + go get -u golang.org/x/lint/golint + golint -set_exit_status ./... + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v2 + with: + go-version: '^1.15.2' + - uses: actions/checkout@v2 + - name: Run Unit tests. + run: go test ./... -v -covermode=count -coverprofile=coverage.txt + - uses: codecov/codecov-action@v1 + with: + file: ./coverage.txt + fail_ci_if_error: true + build: + name: Build + runs-on: ubuntu-latest + needs: [lint, test] + steps: + - uses: actions/setup-go@v2 + with: + go-version: '^1.15.2' + - uses: actions/checkout@v2 + - name: Build + run: go build -ldflags="-s -w" -o bin/gopeed cmd/gopeed/gopeed.go \ No newline at end of file diff --git a/README.md b/README.md index 2bf72494..4c201685 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +[![Build Status](https://github.com/monkeyWie/gopeed-core/workflows/build/badge.svg)](https://github.com/monkeyWie/gopeed-core/actions?query=workflow%3Abuild) +[![Codecov](https://codecov.io/gh/monkeyWie/gopeed-core/branch/master/graph/badge.svg)](https://codecov.io/gh/monkeyWie/gopeed-core) + ## gopeed 支持多协议(HTTP、BitTorrent)下载的客户端,提供命令行、RESTful API、WebSocket、Go 类库方式来使用。 diff --git a/cmd/cli/flags.go b/cmd/gopeed/flags.go similarity index 100% rename from cmd/cli/flags.go rename to cmd/gopeed/flags.go diff --git a/cmd/cli/gopeed.go b/cmd/gopeed/gopeed.go similarity index 100% rename from cmd/cli/gopeed.go rename to cmd/gopeed/gopeed.go