Enable Github Action CI (#170)
Signed-off-by: xiaolong.ran <rxl@apache.org>
Master Issue: #169
### Modifications
- Replace Apache Jenkins with Github Action CI
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
index 14bd4f2..81745e9 100644
--- a/.github/workflows/go.yml
+++ b/.github/workflows/go.yml
@@ -1,5 +1,5 @@
name: Go
-on: [push]
+on: [pull_request]
jobs:
build:
@@ -7,22 +7,15 @@
runs-on: ubuntu-latest
steps:
- - name: Set up Go 1.13
+ - name: Set up Go 1.12
uses: actions/setup-go@v1
with:
- go-version: 1.13
+ go-version: 1.12
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- - name: Get dependencies
+ - name: Test
run: |
- go get -v -t -d ./...
- if [ -f Gopkg.toml ]; then
- curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- dep ensure
- fi
-
- - name: Build
- run: go build -v .
+ ./docker-ci.sh
diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml
new file mode 100644
index 0000000..60f7654
--- /dev/null
+++ b/.github/workflows/project.yml
@@ -0,0 +1,29 @@
+name: Project Style Check
+on: [pull_request]
+jobs:
+
+ build:
+ name: Build
+ runs-on: ubuntu-latest
+ steps:
+
+ - name: Set up Go 1.12
+ uses: actions/setup-go@v1
+ with:
+ go-version: 1.12
+ id: go
+
+ - name: Check out code into the Go module directory
+ uses: actions/checkout@v1
+
+ - name: InstallTool
+ run: |
+ wget -O - -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s v1.18.0
+ ./bin/golangci-lint --version
+
+ - name: Build
+ run: go build ./pulsar
+
+ - name: CheckStyle
+ run: |
+ ./bin/golangci-lint run -c ./.golangci.yml ./...
diff --git a/docker-ci.sh b/docker-ci.sh
index f6924db..d711ee8 100755
--- a/docker-ci.sh
+++ b/docker-ci.sh
@@ -20,9 +20,6 @@
set -e -x
-# Project code style check
-docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.21.0 golangci-lint run -v -c ./.golangci.yml ./...
-
SRC_DIR=$(git rev-parse --show-toplevel)
cd ${SRC_DIR}
diff --git a/pulsar/consumer_partition.go b/pulsar/consumer_partition.go
index e8a8ebd..ae07e76 100644
--- a/pulsar/consumer_partition.go
+++ b/pulsar/consumer_partition.go
@@ -469,7 +469,7 @@
case clearQueueCb := <-pc.clearQueueCh:
// drain the message queue on any new connection by sending a
// special nil message to the channel so we know when to stop dropping messages
- var nextMessageInQueue *messageID = nil
+ var nextMessageInQueue *messageID
go func() {
pc.queueCh <- nil
}()