Skip to content

Commit

Permalink
Update README and contributing guidelines
Browse files Browse the repository at this point in the history
- Add new section for installing go-junit-report from pre-built
  binaries.
- The instructions for installing from source have been updated to use
  `go install`, now that `go get` is being deprecated, see #124.
- Move contributing guidelines to separate `CONTRIBUTING.md` file.
  • Loading branch information
jstemmer committed Feb 24, 2022
1 parent 26cb193 commit b61b86b
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 22 deletions.
21 changes: 21 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Contributing

## Bug reports

- Before reporting a bug, have a look at the [issue
list](https://github.com/jstemmer/go-junit-report/issues) to see if an issue
already exists for your problem.
- Include as much information as you can in the bug report, e.g.: the versions
of go-junit-report and the Go compiler, how go-junit-report was called, what
input was given to go-junit-report, what the actual output was, was the
expected output was.

## Pull requests

- Before sending a pull request for new features, open an issue to discuss it.
- Run `go fmt` to format your code.
- Add test coverage and run all tests.
- Prefer small PRs, avoid making unrelated changes in the same PR.
- Limit the first line of the commit message to 72 characters.
- Write commit messages in the imperative mood ("Fix bug", not "Fixed bug" or
"Fixes bug") .
51 changes: 29 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,56 @@
# go-junit-report

Converts `go test` output to an xml report, suitable for applications that
expect junit xml reports (e.g. [Jenkins](http://jenkins-ci.org)).
go-junit-report is a tool that converts [`go test`] output to an XML report,
suitable for applications that expect JUnit-style XML reports (e.g.
[Jenkins](http://jenkins-ci.org)).

The test output [parser] and JUnit report [formatter] are also available as Go
packages.

[![Build Status][travis-badge]][travis-link]
[![Report Card][report-badge]][report-link]

## Installation
## Install from package (recommended)

Pre-built packages for Windows, macOS and Linux are found on the [Releases]
page.

## Install from source

Go version 1.2 or higher is required. Install or update using the `go get`
command:
Download and install the latest stable version from source by running:

```bash
go get -u github.com/jstemmer/go-junit-report
go install github.com/jstemmer/go-junit-report@latest
```

## Usage

go-junit-report reads the `go test` verbose output from standard in and writes
junit compatible XML to standard out.
go-junit-report reads the full `go test` output from stdin and writes JUnit
compatible XML to stdout. In order to capture build errors as well as test
output, redirect both stdout and stderr to go-junit-report.

```bash
go test -v 2>&1 | go-junit-report > report.xml
```

Note that it also can parse benchmark output with `-bench` flag:
Parsing benchmark output is also supported, for example:

```bash
go test -v -bench . -count 5 2>&1 | go-junit-report > report.xml
```

## Contribution
If you want go-junit-report to exit with a non-zero exit code when it encounters
build errors or test failures, set the `-set-exit-code` flag.

Create an Issue and discuss the fix or feature, then fork the package.
Clone to github.com/jstemmer/go-junit-report. This is necessary because go import uses this path.
Fix or implement feature. Test and then commit change.
Specify #Issue and describe change in the commit message.
Create Pull Request. It can be merged by owner or administrator then.
Run `go-junit-report -help` for a list of all supported flags.

### Run Tests
## Contributing

```bash
go test
```
See [CONTRIBUTING.md].

[`go test`]: https://pkg.go.dev/cmd/go#hdr-Test_packages
[parser]: https://pkg.go.dev/github.com/jstemmer/go-junit-report/parser
[formatter]: https://pkg.go.dev/github.com/jstemmer/go-junit-report/formatter
[travis-badge]: https://travis-ci.org/jstemmer/go-junit-report.svg?branch=master
[travis-link]: https://travis-ci.org/jstemmer/go-junit-report
[report-badge]: https://goreportcard.com/badge/github.com/jstemmer/go-junit-report
[report-link]: https://goreportcard.com/report/github.com/jstemmer/go-junit-report
[Releases]: https://github.com/jstemmer/go-junit-report/releases
[CONTRIBUTING.md]: https://github.com/jstemmer/go-junit-report/blob/master/CONTRIBUTING.md

0 comments on commit b61b86b

Please sign in to comment.