Skip to content

Commit

Permalink
unit tests: fixup, convert travis configuration to github workflow
Browse files Browse the repository at this point in the history
this could still do with some more attention, e.g. test against
multiple db versions
  • Loading branch information
risicle committed Oct 25, 2021
1 parent 9f656d8 commit 73e1c2c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 38 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/run_unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Go
on: [push, pull_request]
env:
GO_VERSION: 1.17
jobs:

build:
name: Build
runs-on: ubuntu-18.04
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: "Install Go ${{env.GO_VERSION}}"
uses: actions/setup-go@v2
with:
go-version: "${{env.GO_VERSION}}"

- name: Install Ginkgo CLI
run: |
go install github.com/onsi/ginkgo/ginkgo@latest
- name: Run tests
run: |
make start_docker_dbs test stop_docker_dbs
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: test unit integration start_docker_dbs stop_docker_dbs

TEST_POSTGRES_URL ?= postgres://postgres:@localhost:5432/?sslmode=disable
TETS_MYSQL_URL ?= root:@tcp(localhost:3306)/mysql?tls=false
export TEST_POSTGRES_URL ?= postgres://postgres:123abc@localhost:5432/?sslmode=disable
export TETS_MYSQL_URL ?= root:@tcp(localhost:3306)/mysql?tls=false

test: unit

Expand All @@ -12,8 +12,13 @@ integration:
ginkgo -v -r ci/blackbox

start_docker_dbs:
docker run --rm -p 5432:5432 --name postgres -e POSTGRES_PASSWORD= -d postgres:9.5
docker run --rm -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=123abc -d postgres:12
docker run --rm -p 3306:3306 --name mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -d mysql:5.7
echo "Waiting for postgres to come up"
until docker exec postgres pg_isready; do \
printf "."; sleep 1; \
done
echo "Waiting for mysql to come up"
until docker exec mysql mysqladmin ping --silent; do \
printf "."; sleep 1; \
done
Expand Down

0 comments on commit 73e1c2c

Please sign in to comment.