You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2020/06/06 18:26:07 UTC

[pulsar-client-go] branch master updated: Build and test with multiple versions of Go (#269)

This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-go.git


The following commit(s) were added to refs/heads/master by this push:
     new dc11c03  Build and test with multiple versions of Go (#269)
dc11c03 is described below

commit dc11c037187d3ad6107620a2debb56b148f50ea6
Author: Aaron Batilo <Aa...@gmail.com>
AuthorDate: Sat Jun 6 12:26:02 2020 -0600

    Build and test with multiple versions of Go (#269)
    
    Currently, the Pulsar Go Client is only tested against Go version 1.12. The motivation for this change is to help bring confidence that the Go client is compatible with multiple versions of Go, all being tested with each PR.
    
    I've modified the two GitHub Action workflows that are a part of this repo with a [matrix](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix) such that we test against multiple versions of Go.
    
    - [X] Make sure that the change passes the CI checks.
---
 .github/workflows/go.yml      | 25 +++++++++++++------------
 .github/workflows/project.yml |  9 +++++----
 Dockerfile                    |  4 ++--
 docker-ci.sh                  |  3 ++-
 4 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
index 8682423..f1f8658 100644
--- a/.github/workflows/go.yml
+++ b/.github/workflows/go.yml
@@ -1,21 +1,22 @@
 name: Go
 on: [pull_request]
 jobs:
-
   build:
     name: Build
     runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        go-version: [1.11, 1.12, 1.13, 1.14]
     steps:
+      - name: Set up Go
+        uses: actions/setup-go@v1
+        with:
+          go-version: ${{ matrix.go-version }}
+        id: go
 
-    - 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@v2
+      - name: Check out code into the Go module directory
+        uses: actions/checkout@v2
 
-    - name: Test
-      run: |
-        ./docker-ci.sh
+      - name: Test
+        run: |
+          ./docker-ci.sh ${{ matrix.go-version }}
diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml
index 60f7654..4b2ad32 100644
--- a/.github/workflows/project.yml
+++ b/.github/workflows/project.yml
@@ -1,16 +1,17 @@
 name: Project Style Check
 on: [pull_request]
 jobs:
-
   build:
     name: Build
     runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        go-version: [1.11, 1.12, 1.13, 1.14]
     steps:
-
-      - name: Set up Go 1.12
+      - name: Set up Go
         uses: actions/setup-go@v1
         with:
-          go-version: 1.12
+          go-version: ${{ matrix.go-version }}
         id: go
 
       - name: Check out code into the Go module directory
diff --git a/Dockerfile b/Dockerfile
index 9b597f9..1867959 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -17,9 +17,9 @@
 # under the License.
 #
 
+ARG GO_VERSION=golang:1.12
 FROM apachepulsar/pulsar:latest as pulsar
-
-FROM golang:1.12 as go
+FROM $GO_VERSION as go
 
 RUN apt-get update && apt-get install -y openjdk-11-jre-headless
 
diff --git a/docker-ci.sh b/docker-ci.sh
index d711ee8..9694c8b 100755
--- a/docker-ci.sh
+++ b/docker-ci.sh
@@ -25,7 +25,8 @@ cd ${SRC_DIR}
 
 IMAGE_NAME=pulsar-client-go-test:latest
 
-docker build -t ${IMAGE_NAME} .
+GO_VERSION=${1:-1.12}
+docker build -t ${IMAGE_NAME} --build-arg GO_VERSION="golang:${GO_VERSION}" .
 
 docker run -i -v ${PWD}:/pulsar-client-go ${IMAGE_NAME} \
        bash -c "cd /pulsar-client-go && ./run-ci.sh"