Coder Social home page Coder Social logo

Comments (4)

bmoffatt avatar bmoffatt commented on June 15, 2024

Good suggestion :) We'll investigate some options.

from aws-lambda-go.

darccio avatar darccio commented on June 15, 2024

This would also be great to ensure proper code coverage (and show it).

from aws-lambda-go.

darccio avatar darccio commented on June 15, 2024

I did a PoC. I forked the repository and configured it to use Travis CI and Coveralls. Please check these files:

.travis.yml

language: go
install:
  - go get golang.org/x/tools/cmd/cover
  - go get github.com/mattn/goveralls
  - go get -u github.com/golang/dep/cmd/dep
script:
  - $HOME/gopath/bin/dep ensure
  - /bin/bash ./test_coverage.sh
after_success:
  - $HOME/gopath/bin/goveralls -service=travis-ci -repotoken $COVERALLS_TOKEN

test_coverage.sh

#!/usr/bin/env bash
# Copied from https://raw.githubusercontent.com/coniks-sys/coniks-go/master/test_coverage.sh
DIR_SOURCE="$(find . -maxdepth 10 -type f -not -path '*/vendor*' -name '*.go' | xargs -I {} dirname {} | sort | uniq)"

# If you want to test in combination with the -race flag on you have to use the atomic mode:
# echo "mode: atomic" > profile.cov
echo "mode: count" > profile.cov

all_tests_passed=true
# Run test coverage on each subdirectories and merge the coverage profile
for dir in ${DIR_SOURCE};
do
    # change to -covermode=atomic if you want to run in combination with -race:
    go test -covermode=count -coverprofile=$dir/profile.tmp $dir
    if [ $? -ne 0 ]; then
        all_tests_passed=false
    fi
    if [ -f $dir/profile.tmp ]
    then
        cat $dir/profile.tmp | tail -n +2 >> profile.cov
        rm $dir/profile.tmp
    fi
done

if [[ $all_tests_passed = true ]]; then
    exit 0;
else
    exit 1;
fi

The result, at the time of my PoC, was: Coverage Status

from aws-lambda-go.

bmoffatt avatar bmoffatt commented on June 15, 2024

Enabled Travis with 9b2186b

from aws-lambda-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.