File: build-drone.sh

package info (click to toggle)
golang-github-go-openapi-runtime 0.0~git20160704.0.11e322e-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 896 kB
  • ctags: 802
  • sloc: sh: 16; makefile: 4
file content (25 lines) | stat: -rwxr-xr-x 829 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
set -e -o pipefail

 mkdir -p /drone/{testresults,coverage,dist}
 go test -race -timeout 20m -v ./... | go-junit-report -dir /drone/testresults

# Run test coverage on each subdirectories and merge the coverage profile.
echo "mode: ${GOCOVMODE-count}" > profile.cov

# Standard go tooling behavior is to ignore dirs with leading underscores
# skip generator for race detection and coverage
for dir in $(go list ./...)
do
  pth="$GOPATH/src/$dir"
  go test -covermode=${GOCOVMODE-count} -coverprofile=${pth}/profile.out $dir
  if [ -f $pth/profile.out ]
  then
      cat $pth/profile.out | tail -n +2 >> profile.cov
      # rm $pth/profile.out
  fi
done

go tool cover -func profile.cov
gocov convert profile.cov | gocov report
gocov convert profile.cov | gocov-html > /drone/coverage/coverage-${CI_BUILD_NUM-"0"}.html