diff --git a/.ci/setup_and_test.sh b/.ci/setup_and_test.sh deleted file mode 100755 index 93135dc6..00000000 --- a/.ci/setup_and_test.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -set -e - -mkdir -p /root/go/src/github.com/kuzzleio/sdk-go -cp -fr /mnt/* /root/go/src/github.com/kuzzleio/sdk-go/ -cd /root/go/src/github.com/kuzzleio/sdk-go/ -go get ./... -./test.sh -cp -fr /root/go/src/github.com/kuzzleio/sdk-go/.cover /mnt/ -cd /mnt diff --git a/.ci/test_with_coverage.sh b/.ci/test_with_coverage.sh new file mode 100755 index 00000000..290876b7 --- /dev/null +++ b/.ci/test_with_coverage.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +set -e + +cover_dir=".cover" +profile="$cover_dir/cover.out" +mode=count +timeout=${TIMEOUT:=1m} + +generate_cover_data() { + rm -rf "$cover_dir" + mkdir "$cover_dir" + go test -timeout "$timeout" -covermode="$mode" -coverprofile="$profile" ./... +} + +show_cover_report() { + go tool cover -${1}="$profile" +} + +linter_check() { + invalid_files=$(gofmt -l "$1") + + if [ -n "${invalid_files}" ]; then + echo "Lint errors on the following files:" + echo ${invalid_files} + exit 1 + fi +} + +linter_check . +generate_cover_data +show_cover_report func + +case "$1" in +"") + ;; +--html) + show_cover_report html ;; +*) + echo >&2 "error: invalid option: $1"; exit 1 ;; +esac diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 31936ac2..ad1bb24e 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -19,6 +19,10 @@ List any dependencies that are required for this change. --> + + ### How should this be manually tested?