Skip to content

Commit

Permalink
use acc
Browse files Browse the repository at this point in the history
  • Loading branch information
Konstantin8105 committed May 30, 2024
1 parent ad5b766 commit b29b928
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
1 change: 1 addition & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
- name: Coverage
run: |
go get -u github.com/wadey/gocovmerge
go install github.com/ory/go-acc@latest
# go get -u github.com/Konstantin8105/cs
go get -u golang.org/x/sys/unix
TRAVIS=true ./scripts/test.sh
Expand Down
48 changes: 26 additions & 22 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
# go list ./... | grep -v /cmd | grep -v /vendor | xargs -n1 -I{} sh -c 'go test -covermode=atomic -coverprofile=coverage.tmp -coverpkg $(go list ./... | grep -v /vendor | tr "\n" ",") {} && tail -n +2 coverage.tmp >> coverage.txt || exit 255' && rm coverage.tmp


set -e

echo "" > coverage.txt

mkdir -p ./testdata/
# set -e
#
# echo "" > coverage.txt
#
# mkdir -p ./testdata/

# github.com/Konstantin8105/c4go
# github.com/Konstantin8105/c4go/ast
Expand All @@ -29,31 +29,35 @@ mkdir -p ./testdata/

# Package list
# export PKGS="github.com/Konstantin8105/c4go github.com/Konstantin8105/c4go/ast github.com/Konstantin8105/c4go/noarch github.com/Konstantin8105/c4go/preprocessor github.com/Konstantin8105/c4go/program github.com/Konstantin8105/c4go/scripts github.com/Konstantin8105/c4go/transpiler github.com/Konstantin8105/c4go/types github.com/Konstantin8105/c4go/util github.com/Konstantin8105/c4go/version"
export PKGS='github.com/Konstantin8105/c4go github.com/Konstantin8105/c4go/ast'
# export PKGS=$(go list -e ./... | grep -v c4go/testdata | grep -v c4go/examples | grep -v c4go/tests | grep -v /vendor/ | tr '\n' ' ')
export PKGS='github.com/Konstantin8105/c4go github.com/Konstantin8105/c4go/ast github.com/Konstantin8105/c4go/version'
# export PKGS=$(go list -e ./... | grep -v testdata | grep -v examples | grep -v tests | grep -v vendor | tr '\n' ' ')

# Make comma-separated.
export PKGS_DELIM=$(echo "$PKGS" | tr ' ' ',')

echo "PKGS : $PKGS"
echo "PKGS_DELIM : $PKGS_DELIM"

go test \
-cover \
-covermode=atomic \
-timeout=30m \
-coverpkg=$PKGS_DELIM \
-coverprofile=./testdata/pkg.coverprofile $PKGS
touch ./coverage.tmp
echo 'mode: atomic' > coverage.txt
go list ./... | grep -v testdata | grep -v examples | grep -v tests | grep -v vendor | grep -v /cmd | grep -v /vendor | xargs -n1 -I{} sh -c 'go test -covermode=atomic -coverprofile=coverage.tmp -coverpkg $(go list ./... | grep -v /vendor | tr "\n" ",") {} && tail -n +2 coverage.tmp >> coverage.txt || exit 255' && rm coverage.tmp

# go test \
# -cover \
# -covermode=atomic \
# -timeout=30m \
# -coverpkg=$PKGS_DELIM \
# -coverprofile=./testdata/pkg.coverprofile $PKGS

# Merge coverage profiles.
COVERAGE_FILES=`ls -1 ./testdata/*.coverprofile 2>/dev/null | wc -l`
if [ $COVERAGE_FILES != 0 ]; then
# check program `gocovmerge` is exist
if which gocovmerge >/dev/null 2>&1; then
export FILES=$(ls testdata/*.coverprofile | tr '\n' ' ')
echo "Combine next coverprofiles : $FILES"
gocovmerge $FILES > coverage.txt
fi
fi
# COVERAGE_FILES=`ls -1 ./testdata/*.coverprofile 2>/dev/null | wc -l`
# if [ $COVERAGE_FILES != 0 ]; then
# # check program `gocovmerge` is exist
# if which gocovmerge >/dev/null 2>&1; then
# export FILES=$(ls testdata/*.coverprofile | tr '\n' ' ')
# echo "Combine next coverprofiles : $FILES"
# gocovmerge $FILES > coverage.txt
# fi
# fi

echo "End of coverage"

0 comments on commit b29b928

Please sign in to comment.