You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@age.apache.org by jg...@apache.org on 2022/12/28 17:43:19 UTC

[age] 01/02: Implement CI testing for Golang Driver (#372)

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

jgemignani pushed a commit to branch PG12
in repository https://gitbox.apache.org/repos/asf/age.git

commit 1d1254a8938dd1cd87f82ad2849900d472ebb854
Author: Luke Hinds <70...@users.noreply.github.com>
AuthorDate: Mon Nov 28 18:51:52 2022 +0000

    Implement CI testing for Golang Driver (#372)
    
    This change will implement running of the go driver unit tests
    upon every pull commit made to the `drivers/golang` code.
    
    It uses the `paths` directive to ensure the github action workflow
    only runs when the go driver code is changed.
    
    The docker-compose file is required to instaniate a postgres
    instance, needed for unit testing.
---
 .github/workflows/go-driver.yml   | 33 +++++++++++++++++++++++++++++++++
 drivers/golang/docker-compose.yml | 10 ++++++++++
 2 files changed, 43 insertions(+)

diff --git a/.github/workflows/go-driver.yml b/.github/workflows/go-driver.yml
new file mode 100644
index 0000000..52febad
--- /dev/null
+++ b/.github/workflows/go-driver.yml
@@ -0,0 +1,33 @@
+name: Go Driver Tests
+
+on:
+  push:
+    branches: [ "master" ]
+    paths: 
+      - 'drivers/golang'
+  pull_request:
+    branches: [ "master" ]
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    defaults:
+      run:
+        working-directory: drivers/golang/age/
+  
+    steps:
+    - uses: actions/checkout@v3
+    
+    - name: Run apache/age docker image
+      run: docker-compose up -d
+
+    - name: Set up Go
+      uses: actions/setup-go@v3
+      with:
+        go-version: 1.16
+
+    - name: Build
+      run: go build -v ./...
+
+    - name: Test
+      run: go test . -v
diff --git a/drivers/golang/docker-compose.yml b/drivers/golang/docker-compose.yml
new file mode 100644
index 0000000..668eb19
--- /dev/null
+++ b/drivers/golang/docker-compose.yml
@@ -0,0 +1,10 @@
+version: "3.3"
+services:
+  db:
+    image: apache/age
+    environment:
+      - POSTGRES_USER=postgres
+      - POSTGRES_PASSWORD=agens
+      - POSTGRES_DB=postgres
+    ports:
+      - 5432:5432
\ No newline at end of file