Add test script

This commit is contained in:
Marc Di Luzio 2020-05-31 11:40:07 +01:00
parent 0f507cf4fd
commit 95963e9b29
2 changed files with 21 additions and 17 deletions

View file

@ -30,20 +30,5 @@ jobs:
dep ensure dep ensure
fi fi
- name: Build with go - name: Build and Test
run: go build -v ./... run: ./script/test.sh
- name: Run go unit tests
run: go test -v ./... -cover
- name: Build docker
run: docker build . --tag rove:$(date +%s)
- name: Deploy docker-compose
run: docker-compose up --build --detach
- name: Run go integration tests
run: go test ./... -tags integration -cover
- name: Take down docker-compose
run: docker-compose down

19
script/test.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash
set -e
cd "$(dirname "$0")"
cd ..
set -x
# Test the build
go build -v ./...
# Run unit tests
go test -v ./... -cover
# Verify docker build
docker build .
# Run the integration tests with docker-compose
docker-compose up --build --detach
go test -v ./... -tags integration -cover
docker-compose down