From f1281ec303377b0b5c6fb042a260fc4d33e8b10a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quang=20T=C3=B9ng?= Date: Thu, 4 Apr 2024 14:34:26 +0700 Subject: [PATCH] Add CI Pipeline (#2) * Add CI Pipeline * Update readme --- .github/workflows/go.yml | 30 ++++++++++++++++++++++++++++++ .gitignore | 2 +- Makefile | 7 +++++-- README.md | 11 ++++------- go.mod | 2 +- todolist | 1 + 6 files changed, 42 insertions(+), 11 deletions(-) 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..64a5995 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,30 @@ +name: zk +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] +jobs: + build: + runs-on: ubuntu-20.04 + services: + zookeeper: + image: zookeeper:3.9.2 + ports: + - 2181:2181 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: "1.21.9" + - name: Lint + run: make lint + - name: Test + run: make test + - name: Convert coverage.out to coverage.lcov + uses: jandelgado/gcov2lcov-action@v1.0.6 + - name: Coveralls + uses: coverallsapp/github-action@v1.1.2 + with: + github-token: ${{ secrets.github_token }} + path-to-lcov: coverage.lcov diff --git a/.gitignore b/.gitignore index f1b1132..baf20c8 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,5 @@ /apache-zookeeper-*/ /apache-zookeeper-*.tar.gz /.idea -/coverage.cov +/coverage.out /bin diff --git a/Makefile b/Makefile index 67fecf1..af7ed72 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,10 @@ -.PHONY: test build coverage +.PHONY: test lint build coverage test: - go test -race -p 1 -count=1 -tags=integration -covermode=atomic -coverprofile=coverage.cov ./... + go test -race -p 1 -count=1 -tags=integration -covermode=atomic -coverprofile=coverage.out ./... + +lint: + echo "Do nothing" build: go build -o bin/lock test-examples/lock/main.go diff --git a/README.md b/README.md index 0028096..edd0d55 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,8 @@ -Native Go Zookeeper Client Library -=================================== +# Native Go Zookeeper Client Library -[![GoDoc](https://godoc.org/github.com/go-zookeeper/zk?status.svg)](https://godoc.org/github.com/go-zookeeper/zk) -[![Build Status](https://img.shields.io/github/workflow/status/go-zookeeper/zk/unittest/master)](https://github.com/go-zookeeper/zk/actions?query=branch%3Amaster) -[![Coverage Status](https://img.shields.io/codecov/c/github/go-zookeeper/zk/master)](https://codecov.io/gh/go-zookeeper/zk/branch/master) +[![zk](https://github.com/QuangTung97/zk/actions/workflows/go.yml/badge.svg)](https://github.com/QuangTung97/zk/actions/workflows/go.yml) +[![Coverage Status](https://coveralls.io/repos/github/QuangTung97/zk/badge.svg?branch=master)](https://coveralls.io/github/QuangTung97/zk?branch=master) -License -------- +## License 3-clause BSD. See LICENSE file. diff --git a/go.mod b/go.mod index 80d19c6..1135e73 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/QuangTung97/zk -go 1.19 +go 1.21.2 require github.com/stretchr/testify v1.9.0 diff --git a/todolist b/todolist index 2ad7e07..a16a2f9 100644 --- a/todolist +++ b/todolist @@ -1,4 +1,5 @@ *) Add CI Pipeline for Integration Tests +*) Add Lint *) Batching Read & Write to TCP (Need to do or not?) *) Stress Tests with Race Detector *) Add Multi-Ops Transactions