Update README and contributing guidelines

- 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.
This commit is contained in:
Joël Stemmer 2022-02-19 21:19:37 +00:00
parent 26cb193214
commit b61b86b9a7
2 changed files with 50 additions and 22 deletions

21
CONTRIBUTING.md Normal file
View File

@ -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") .

View File

@ -1,49 +1,56 @@
# go-junit-report # go-junit-report
Converts `go test` output to an xml report, suitable for applications that go-junit-report is a tool that converts [`go test`] output to an XML report,
expect junit xml reports (e.g. [Jenkins](http://jenkins-ci.org)). 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] [![Build Status][travis-badge]][travis-link]
[![Report Card][report-badge]][report-link]
## Installation ## Install from package (recommended)
Go version 1.2 or higher is required. Install or update using the `go get` Pre-built packages for Windows, macOS and Linux are found on the [Releases]
command: page.
## Install from source
Download and install the latest stable version from source by running:
```bash ```bash
go get -u github.com/jstemmer/go-junit-report go install github.com/jstemmer/go-junit-report@latest
``` ```
## Usage ## Usage
go-junit-report reads the `go test` verbose output from standard in and writes go-junit-report reads the full `go test` output from stdin and writes JUnit
junit compatible XML to standard out. 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 ```bash
go test -v 2>&1 | go-junit-report > report.xml 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 ```bash
go test -v -bench . -count 5 2>&1 | go-junit-report > report.xml 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. Run `go-junit-report -help` for a list of all supported flags.
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 Tests ## Contributing
```bash See [CONTRIBUTING.md].
go test
```
[`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-badge]: https://travis-ci.org/jstemmer/go-junit-report.svg?branch=master
[travis-link]: https://travis-ci.org/jstemmer/go-junit-report [travis-link]: https://travis-ci.org/jstemmer/go-junit-report
[report-badge]: https://goreportcard.com/badge/github.com/jstemmer/go-junit-report [Releases]: https://github.com/jstemmer/go-junit-report/releases
[report-link]: https://goreportcard.com/report/github.com/jstemmer/go-junit-report [CONTRIBUTING.md]: https://github.com/jstemmer/go-junit-report/blob/master/CONTRIBUTING.md