diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 6537271..b3e2434 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -34,7 +34,7 @@ jobs: fi - name: Build and Test - run: ./script/test.sh + run: make test - name: Upload test coverage result uses: actions/upload-artifact@v1 diff --git a/Makefile b/Makefile index aca7d01..2eb2b16 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,16 @@ install: go install -ldflags="-X 'github.com/mdiluz/rove/pkg/version.Version=${VERSION}'" ./... test: - ./script/test.sh + go mod download + go build ./... + + # Run the server and shut it down again to ensure our docker-compose works + ROVE_ARGS="--quit 1" docker-compose up --build --exit-code-from=rove-server --abort-on-container-exit + + # Run tests with coverage + go test -v ./... -cover -coverprofile=/tmp/c.out -count 1 + + # Convert the coverage data to html + go tool cover -html=/tmp/c.out -o /tmp/coverage.html .PHONY: install test \ No newline at end of file diff --git a/script/test.sh b/script/test.sh deleted file mode 100755 index 67acbe3..0000000 --- a/script/test.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -set -e -cd "$(dirname "$0")" -cd .. -set -x - -# Check we can build everything -go mod download -go build ./... - -# Run the server and shut it down again to ensure our docker-compose works -ROVE_ARGS="--quit 1" docker-compose up --build --exit-code-from=rove-server --abort-on-container-exit - -# Run tests with coverage -go test -v ./... -cover -coverprofile=/tmp/c.out -count 1 - -# Convert the coverage data to html -go tool cover -html=/tmp/c.out -o /tmp/coverage.html \ No newline at end of file