Skip to content

Commit

Permalink
Merge pull request #1 from psturc/RHTAP-1851
Browse files Browse the repository at this point in the history
feat: make it suitable for openshift-ci
  • Loading branch information
psturc authored Nov 2, 2023
2 parents f58d89e + b8c8972 commit 4e2b175
Show file tree
Hide file tree
Showing 22 changed files with 333 additions and 554 deletions.
32 changes: 32 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
time: "08:00"
labels:
- "dependencies"
commit-message:
prefix: "feat"
include: "scope"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
time: "08:00"
labels:
- "dependencies"
commit-message:
prefix: "chore"
include: "scope"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
time: "08:00"
labels:
- "dependencies"
commit-message:
prefix: "feat"
include: "scope"
37 changes: 0 additions & 37 deletions .github/workflows/goreleaser.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: golangci-lint
on:
push:
paths:
- '**.go'
branches:
- main
pull_request:

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
go-version: '1.19'

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.55.1
args: -v --timeout=5m
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
junit2html
43 changes: 0 additions & 43 deletions .goreleaser.yaml

This file was deleted.

47 changes: 0 additions & 47 deletions Formula/junit2html.rb

This file was deleted.

17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
projectname?=junit2html

export GOFLAGS := -mod=mod

default: help

.PHONY: help
help: ## list makefile targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: build
build: ## build golang binary
@go build -ldflags "-X main.version=$(shell git describe --abbrev=0 --tags --always)" -o $(projectname)

.PHONY: install
install: ## install golang binary
@go install -ldflags "-X main.version=$(shell git describe --abbrev=0 --tags --always)"
38 changes: 5 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,15 @@ Convert Junit XML reports (`junit.xml`) into HTML reports using a single standal

![screenshot](screenshot.png)

## Install

Like `jq`, `junit2html` is a tiny (8Mb) standalone binary. You can download it from the [releases page](https://github.com/kitproj/junit2html/releases/latest).

If you're on MacOS, you can use `brew`:

```bash
brew tap kitproj/junit2html --custom-remote https://github.com/kitproj/junit2html
brew install junit2html
```

Otherwise, you can use `curl`:

```bash
curl -q https://raw.githubusercontent.com/kitproj/junit2html/main/install.sh | sh
```

## Usage

Here is an example that uses trap to always created the test report:
### Build

```bash
go install github.com/alexec/junit2html@latest

trap 'go-junit-report < test.out > junit.xml && junit2html < junit.xml > test-report.html' EXIT

go test -v -cover ./... 2>&1 > test.out
make build
```

💡 Don't use pipes (i.e. `|`) in shell, pipes swallow exit codes. Use `<` and `>` which is POSIX compliant.

## Test

How to test this locally:

### Run
```bash
go test -v -cover ./... 2>&1 > test.out
go-junit-report < test.out > junit.xml
go run . < junit.xml > test-report.html
```
./junit2html < <junit-file.xml> > <output-report.html>
```
11 changes: 0 additions & 11 deletions example/coverage/coverage.go

This file was deleted.

7 changes: 0 additions & 7 deletions example/coverage/coverage_test.go

This file was deleted.

11 changes: 0 additions & 11 deletions example/example.go

This file was deleted.

19 changes: 0 additions & 19 deletions example/example_test.go

This file was deleted.

6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/alexec/junit2html
module github.com/redhat-appstudio-qe/junit2html

go 1.18
go 1.19

require github.com/jstemmer/go-junit-report v1.0.0
require github.com/jstemmer/go-junit-report/v2 v2.0.0
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
github.com/jstemmer/go-junit-report v1.0.0 h1:8X1gzZpR+nVQLAht+L/foqOeX2l9DTZoaIPbEQHxsds=
github.com/jstemmer/go-junit-report v1.0.0/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/jstemmer/go-junit-report/v2 v2.0.0 h1:bMZNO9B16VFn07tKyi4YJFIbZtVmJaa5Xakv9dcwK58=
github.com/jstemmer/go-junit-report/v2 v2.0.0/go.mod h1:mgHVr7VUo5Tn8OLVr1cKnLuEy0M92wdRntM99h7RkgQ=
9 changes: 0 additions & 9 deletions install.sh

This file was deleted.

Loading

0 comments on commit 4e2b175

Please sign in to comment.