From d70b03ee909893a8e1dc581f21539d8a092537fb Mon Sep 17 00:00:00 2001 From: Luke Hinds Date: Mon, 28 Nov 2022 09:37:54 +0000 Subject: [PATCH] Implement CI testing for Golang Driver 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(+) create mode 100644 .github/workflows/go-driver.yml create mode 100644 drivers/golang/docker-compose.yml diff --git a/.github/workflows/go-driver.yml b/.github/workflows/go-driver.yml new file mode 100644 index 000000000..52febad64 --- /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 000000000..668eb19d3 --- /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