Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support grouping by package name #66

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "gomod"
directory: "/" # Location of package manifests
schedule:
interval: "daily"
88 changes: 88 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: CI

on:
push:
branches: [ master ]
pull_request:

jobs:
go-build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.5

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...

# https://golangci-lint.run/usage/quick-start/
# github action: https://golangci-lint.run/usage/install#github-actions
go-linter:
name: lint
runs-on: ubuntu-latest
needs: [go-build-and-test]
steps:
- name: Checkout Source
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.5

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
# see https://github.com/golangci/golangci-lint/releases
version: v1.55.2
args: --timeout=5m

# https://securego.io/
# https://github.com/securego/gosec
go-security:
name: gosec
runs-on: ubuntu-latest
needs: [go-build-and-test]
env:
GO111MODULE: on
steps:
- name: Checkout Source
uses: actions/checkout@v4

- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
args: ./...

# Vulnerability Management for Go
# https://go.dev/blog/vuln
# Full documentation: https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck
go-vulncheck:
name: "Govulncheck"
runs-on: ubuntu-latest
needs: [go-build-and-test]
steps:
- name: Checkout Source
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.5

- name: Get govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
shell: bash

- name: Run govulncheck
run: govulncheck ./...
shell: bash
64 changes: 64 additions & 0 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: releaser

# used:
# github-tag-bump - A Github Action to automatically bump and tag master, on merge, with the latest SemVer formatted version.
# github action: https://github.com/marketplace/actions/github-tag-bump
# source code: https://github.com/anothrNick/github-tag-action

# go releaser - Release Go projects as fast and easily as possible.
# website: https://goreleaser.com/
# github action: https://github.com/marketplace/actions/goreleaser-action
# source code: https://github.com/goreleaser/goreleaser-action
# goreleaser: https://github.com/goreleaser/goreleaser

# run only when CI pipeline finished
on:
workflow_run:
workflows: [ "CI" ]
branches: [ master ]
types:
- completed
workflow_dispatch:

concurrency:
group: "releaser"

jobs:
release:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Bump version and push tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
DEFAULT_BUMP: minor
WITH_V: true
RELEASE_BRANCHES: master
INITIAL_VERSION: 1.0.0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.5

- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ LIN_DIR := release_builds/linux-amd64/
MAC_DIR := release_builds/darwin-amd64/
WIN_DIR := release_builds/windows-amd64/

.PHONY: help
help: ## List of available commands
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

genbuild: gencode
go build

Expand Down Expand Up @@ -41,3 +45,7 @@ buildall: genbuild

dockertest: genbuild
docker build . -t go-test-report-test-runner:$(VERSION)

.PHONY: lint
lint: ## Run linter (https://github.com/golangci/golangci-lint/releases)
docker run --rm -v $(PWD):/app -w /app golangci/golangci-lint:v1.55.2 golangci-lint run -v --timeout 3m
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,22 @@


[![license: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://shields.io/)
[![version: 0.9.3](https://img.shields.io/badge/version-0.9.3-default.svg)](https://shields.io/)
[![version: 1.0.0](https://img.shields.io/badge/version-1.0.0-default.svg)](https://shields.io/)
[![platforms: macos,linux,windows](https://img.shields.io/badge/platforms-macos%20|%20linux%20|%20windows-orange.svg)](https://shields.io/)
[![goreportcard](https://goreportcard.com/badge/github.com/vakenbolt/go-test-report)](https://goreportcard.com/report/github.com/vakenbolt/go-test-report)
[![goreportcard](https://goreportcard.com/badge/github.com/DarkDrim/go-test-report)](https://goreportcard.com/report/github.com/DarkDrim/go-test-report)

`go-test-report` captures `go test` output and parses it into a _single_ self-contained HTML file.

## Main differences from the main library

[This is a fork of the library](https://github.com/vakenbolt/go-test-report)

The original version of the library has not been supported for more than three years.

This version has some improvements:
- support for the latest version of Golang
- ability to split groups by package (instead of splitting by number of tests)

## Installation

Install the go binary using `go get`.
Expand All @@ -22,7 +32,7 @@ Install the go binary using `go get`.


```shell
$ go get -u github.com/vakenbolt/go-test-report/
$ go get -u github.com/DarkDrim/go-test-report/
```

## Usage
Expand Down Expand Up @@ -121,6 +131,11 @@ The default number of tests in a _test group_ can be changed using the `-g` or `
$ go test -json | go-test-report -g 8
```

To group the tests by their package instead of by count, use the `-p` or `--groupPackage` flag.

```bash
$ go test -json | go-test-report -p
```


Use the `-s` or `--size` flag to change the default size of the _group size indicator_. For example, the following command will set both the width and height of the size of the indicator to 48 pixels.
Expand Down Expand Up @@ -181,10 +196,11 @@ $ gmake buildall
[@afbjorklund](https://github.com/afbjorklund)
[@quarckster](https://github.com/quarckster)
[@vakenbolt](https://github.com/vakenbolt)
[@DarkDrim](https://github.com/DarkDrim)


## Contribute & Support

- Add a GitHub Star
- Suggest [new features, ideas and optimizations](https://github.com/vakenbolt/go-test-report/issues)
- [Report issues](https://github.com/vakenbolt/go-test-report/issues)
- Suggest [new features, ideas and optimizations](https://github.com/DarkDrim/go-test-report/issues)
- [Report issues](https://github.com/DarkDrim/go-test-report/issues)
5 changes: 2 additions & 3 deletions embed_assets/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ import (
"bufio"
"encoding/hex"
"fmt"
"io/ioutil"
"os"
)

var htmlTemplate []byte
var jsCode []byte

func init() {
htmlTemplate, _ = ioutil.ReadFile("../test_report.html.template")
jsCode, _ = ioutil.ReadFile("../test_report.js")
htmlTemplate, _ = os.ReadFile("../test_report.html.template")
jsCode, _ = os.ReadFile("../test_report.js")
}

func main() {
Expand Down
Loading