octocov

command module
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2021 License: MIT Imports: 1 Imported by: 0

README

octocov

coverage

octocov is a tool for collecting code coverage.

Key features of octocov are:

Usage

First, run test with coverage report output.

For example, in case of Go language, add -coverprofile=coverage.out option as follows

$ go test ./... -coverprofile=coverage.out

Add .octocov.yml ( or octocov.yml ) file to your repository, and run octocov

$ octocov
Check for acceptable coverage

By setting coverage.acceptable:, the minimum acceptable coverage is specified.

If it is less than that value, the command will exit with exit status 1.

# .octocov.yml
coverage:
  acceptable: 60%
$ octocov
Error: code coverage is 54.9%, which is below the accepted 60.0%
Generate coverage report badge self.

By setting coverage.badge.path:, generate the coverage report badge self.

# .octocov.yml
coverage:
  badge:
    path: docs/coverage.svg

You can display the coverage badge without external communication by setting a link to this badge image in README.md, etc.

# mytool

![coverage](docs/coverage.svg)

coverage

Store coverage report to central datastore

By setting datastore:, store the coverage reports to central datastore.

GitHub
# .octocov.yml
datastore:
  github:
    repository: owner/coverages # central datastore repository
    branch: main                # default: main
    path:                       # default: reports/${GITHUB_REPOSITORY}/report.json
S3

🚧

Central mode

By enabling central:, octocov acts as a central repository for collecting coverage reports ( example ).

# .octocov.yml
central:
  enable: true
  root: .          # root directory or index file path of collected coverage reports pages. default: .
  reports: reports # directory where reports are stored. default: reports
  badges: badges   # directory where badges are generated. default: badges

When central mode is enabled, other functions are automatically turned off.

Supported coverage report formats

Go coverage

Default path: coverage.out

LCOV

Default path: coverage/lcov.info

Support SF DA only

SimpleCov

Default path: coverage/.resultset.json

Clover

Default path: coverage.xml

Install

deb:

Use dpkg-i-from-url

$ export OCTOCOV_VERSION=X.X.X
$ curl -L https://git.io/dpkg-i-from-url | bash -s -- https://github.com/k1LoW/octocov/releases/download/v$OCTOCOV_VERSION/octocov_$OCTOCOV_VERSION-1_amd64.deb

RPM:

$ export OCTOCOV_VERSION=X.X.X
$ yum install https://github.com/k1LoW/octocov/releases/download/v$OCTOCOV_VERSION/octocov_$OCTOCOV_VERSION-1_amd64.rpm

apk:

Use apk-add-from-url

$ export OCTOCOV_VERSION=X.X.X
$ curl -L https://git.io/apk-add-from-url | sh -s -- https://github.com/k1LoW/octocov/releases/download/v$OCTOCOV_VERSION/octocov_$OCTOCOV_VERSION-1_amd64.apk

homebrew tap:

$ brew install k1LoW/tap/octocov

manually:

Download binary from releases page

go get:

$ go get github.com/k1LoW/octocov

docker:

$ docker pull ghcr.io/k1low/octocov:latest

Documentation

Overview

Copyright © 2021 Ken'ichiro Oyama <k1lowxb@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL