diff --git a/.github/workflows/c.yml b/.github/workflows/c.yml new file mode 100644 index 00000000..6ece9027 --- /dev/null +++ b/.github/workflows/c.yml @@ -0,0 +1,35 @@ +name: build and test + +on: + push: + branches: + - master + pull_request: + branches: + - '**' + +jobs: + check: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.21' + cache: true + + - name: file + run: | + touch ./coverage.txt + + - name: Upload + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + flags: unittests + name: venus-messager + files: ./coverage.txt + fail_ci_if_error: true + verbose: true diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml new file mode 100644 index 00000000..06e362d0 --- /dev/null +++ b/.github/workflows/common.yml @@ -0,0 +1,56 @@ +name: build and golangci-lint and test + +on: + push: + branches: + - master + pull_request: + branches: + - '**' + +jobs: + check: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.21' + cache: true + + - name: install default deps + run: sudo apt-get -o Acquire::Retries=3 update && sudo apt-get -o Acquire::Retries=3 install make ftp git bzr curl wget -y + + - name: Build + env: + GOPROXY: "https://proxy.golang.org,direct" + GO111MODULE: "on" + run: | + make + + - name: Lint + run: | + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.57.2 + golangci-lint run --timeout 10m + + - name: Detect changes + run: | + go mod tidy + git status --porcelain + test -z "$(git status --porcelain)" + + - name: Run coverage + run: | + go test -coverpkg=./... -race -coverprofile=coverage.txt -covermode=atomic ./... -v --timeout 10m + + - name: Upload + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.txt + flags: unittests + name: venus-messager + fail_ci_if_error: true + verbose: true diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index c4a4a23f..4fb9008d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -11,7 +11,7 @@ on: jobs: check: - uses: filecoin-project/venus/.github/workflows/common_go.yml@master + uses: filecoin-project/venus/.github/workflows/common_go.yml@chore/ci with: has_ffi: false test_timeout: 20 diff --git a/.golangci.yml b/.golangci.yml index cc31fd3b..ed8040b4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -5,7 +5,6 @@ linters: - govet - misspell - goconst - - revive - errcheck - unconvert - staticcheck diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a4b2d04..9c023914 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -112,3 +112,4 @@ * 使用 untrust 接口推送消息 [[#306](https://github.com/ipfs-force-community/sophon-messager/pull/306)] * 按从小到大查询 unchain 消息 [[#307](https://github.com/ipfs-force-community/sophon-messager/pull/307)] * 移除测试中的重复代码 [[#308](https://github.com/ipfs-force-community/sophon-messager/pull/308)] +