GithubHelp home page GithubHelp logo

appleboy / golang-testing Goto Github PK

View Code? Open in Web Editor NEW
30.0 4.0 17.0 261 KB

Docker image includes golang coverage tools for testing.

License: MIT License

Shell 16.81% Makefile 2.62% Go 1.78% Roff 78.33% Dockerfile 0.47%
golang-testing docker-image docker dockerfiles

golang-testing's Introduction

golang-testing

Golang Testing

Docker image includes golang coverage tools for testing.

Build Status codecov Go Report Card

Feature

The docker images includes the following golang tools.

  • go-junit-report Convert go test output to junit xml
  • gocov Coverage testing tool
  • gocov-xml XML (Cobertura) export
  • golint This is a linter for Go source code. (Golint requires Go 1.6 or later.)
  • glide Package Management for Golang
  • govendor Package Management for Golang
  • cloc Count Lines of Code.
  • blackfriday-tool a markdown processor for Go.

Install

Copy coverage.sh to /usr/local/bin/coverage and change permission.

$ curl https://raw.githubusercontent.com/appleboy/golang-testing/1.0.2/coverage.sh -o $GOPATH/bin/coverage
$ chmod +x $GOPATH/bin/coverage

Usage

coverage tool document:

Generate test coverage statistics for Go packages.

  -- Command Flag --
  -h | --help                    Display this help and exit
  -m | --mode                    Set coverage mode. default is "set" (set|count|atomic)
  -d | --dir                     Set store coverage folder (default is ".cover")

  -- Command Action --
  tool                           Install go dependency tools like gocov or golint.
  testing                        Run go testing for all packages
  coverage                       Generate coverage report for all packages
  junit                          Generate coverage xml report for junit plugin
  lint                           Generate Lint report for all packages
  vet                            Generate Vet report for all packages
  cloc                           Generate Count Lines of Code report for all files
  all                            Execute coverage、junit、lint、vet and cloc report

Contribute and source at https://github.com/appleboy/golang-testing

Run with docker

Pull the latest golang-testing docker image.

$ docker pull appleboy/golang-testing

docker command

Run testing in single docker command.

$ export PROJECT_PATH=/go/src/github.com/appleboy/golang-testing
$ docker run --rm \
    -v $(PWD):$PROJECT_PATH \
    -w=$PROJECT_PATH \
    appleboy/golang-testing \
    sh -c "coverage all"

Change PROJECT_PATH variable. Replace github.com/appleboy/golang-testing with your github path.

docker-compose command

Please see docker/docker-compose.yml example file. Run the following command.

$ export PROJECT_PATH=/go/src/github.com/appleboy/golang-testing
$ docker-compose -f docker/docker-compose.yml run golang-testing \
  sh -c "coverage all"

Demo

$ git clone https://github.com/appleboy/golang-testing.git
$ cd golang-testing
$ export PROJECT_PATH=/go/src/github.com/appleboy/golang-testing
$ docker run --rm \
    -v $(PWD):$(PROJECT_PATH) \
    -w=$(PROJECT_PATH) \
    appleboy/golang-testing \
    sh -c "make update && coverage all"
# or docker-compose command
$ docker-compose -f docker/docker-compose.yml \
    run golang-testing

Screenshot

Testing

golang-testing's People

Contributors

appleboy avatar coffeepac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

golang-testing's Issues

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.