Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
nao1215 committed May 15, 2024
1 parent 2e97863 commit 4cf680e
Show file tree
Hide file tree
Showing 11 changed files with 371 additions and 108 deletions.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

## Is your feature request related to a problem?
A clear and concise description of what the problem is. E.g. I'm always frustrated when ...

## Describe the solution you'd like
A clear and concise description of what you want to happen.

## Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

## Additional context
Add any other context or screenshots about the feature request here.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: LinuxUnitTest
name: Coverage

on:
workflow_dispatch:
Expand All @@ -25,10 +25,7 @@ jobs:
go-version: "1"
check-latest: true

- name: Download dependencies
run: go mod download
- name: Run tests with coverage report output
run: go test -cover -coverpkg=./... -coverprofile=coverage.out ./...

- uses: nao1215/actions-hottest@v1
with:
args: '-cover -coverpkg=./... -coverprofile=coverage.out ./...'
- uses: k1LoW/octocov-action@v1
31 changes: 0 additions & 31 deletions .github/workflows/mac_test.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/multi_ver_unittest.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: MultiPlatformUnitTest

on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
unit_test:
name: Unit test (linux)

strategy:
matrix:
os:
- "ubuntu-latest"
- "windows-latest"
- "macos-latest"
go:
- "1"
- "1.22"
- "1.21"
- "1.20"
fail-fast: false
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

- name: Run tests with coverage report output
run: go test -cover -coverpkg=./... -coverprofile=coverage.out ./...

31 changes: 0 additions & 31 deletions .github/workflows/windows_test.yml

This file was deleted.

21 changes: 10 additions & 11 deletions .octocov.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
# generated by octocov init
coverage:
if: true
acceptable: 80%
testExecutionTime:
if: true
acceptable: 1:1.1
acceptable: current <= 1min && diff <= 2sec
exclude:
- "github.com/nao1215/gup/main.go"
- "github.com/nao1215/gup/cmd/root.go"
- "github.com/nao1215/gup/cmd/man.go"
- "github.com/nao1215/gup/cmd/bug_report.go"
- "github.com/nao1215/gup/internal/assets/asset.go"
- "github.com/nao1215/gup/internal/completion/completion.go"
badge:
path: docs/coverage.svg
diff:
datastores:
- artifact://${GITHUB_REPOSITORY}
comment:
if: is_pull_request
summary:
if: true
report:
if: is_default_branch
datastores:
- artifact://${GITHUB_REPOSITORY}
coverage:
badge:
path: docs/coverage.svg
codeToTestRatio:
badge:
path: docs/ratio.svg
testExecutionTime:
badge:
path: docs/time.svg
path: docs/time.svg
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: build test clean vet fmt chkfmt changelog tools help
.PHONY: build test clean vet fmt chkfmt changelog tools help coverage-tree

APP = gup
VERSION = $(shell git describe --tags --abbrev=0)
Expand Down Expand Up @@ -34,6 +34,12 @@ vet: ## Start go vet
fmt: ## Format go source code
$(GO_FORMAT) $(GO_PKGROOT)

coverage-tree: test ## Generate coverage tree
go-cover-treemap -statements -coverprofile cover.out > doc/img/cover-tree.svg

tools: ## Install dependency tools
$(GO_INSTALL) github.com/nikolaydubina/go-cover-treemap@latest

.DEFAULT_GOAL := help
help:
@grep -E '^[0-9a-zA-Z_-]+[[:blank:]]*:.*?## .*$$' $(MAKEFILE_LIST) | sort \
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
[![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)
[![MultiVersionUnitTest](https://github.com/nao1215/gup/actions/workflows/multi_ver_unittest.yml/badge.svg)](https://github.com/nao1215/gup/actions/workflows/multi_ver_unittest.yml)
[![WindowsUnitTest](https://github.com/nao1215/gup/actions/workflows/windows_test.yml/badge.svg)](https://github.com/nao1215/gup/actions/workflows/windows_test.yml)
[![MacUnitTest](https://github.com/nao1215/gup/actions/workflows/mac_test.yml/badge.svg)](https://github.com/nao1215/gup/actions/workflows/mac_test.yml)
[![LinuxUnitTest](https://github.com/nao1215/gup/actions/workflows/linux_test.yml/badge.svg)](https://github.com/nao1215/gup/actions/workflows/linux_test.yml)
[![reviewdog](https://github.com/nao1215/gup/actions/workflows/reviewdog.yml/badge.svg)](https://github.com/nao1215/gup/actions/workflows/reviewdog.yml)
![Coverage](https://raw.githubusercontent.com/nao1215/octocovs-central-repo/main/badges/nao1215/gup/coverage.svg)
[![gosec](https://github.com/nao1215/gup/actions/workflows/security.yml/badge.svg)](https://github.com/nao1215/gup/actions/workflows/security.yml)
Expand Down Expand Up @@ -197,6 +193,11 @@ Contributions are not only related to development. For example, GitHub Star moti
### Star History
[![Star History Chart](https://api.star-history.com/svg?repos=nao1215/gup&type=Date)](https://star-history.com/#nao1215/gup&Date)

### For Developers
When adding new features or fixing bugs, please write unit tests. The sqly is unit tested for all packages as the unit test tree map below shows.

![treemap](./doc/img/cover-tree.svg)

## Contact
If you would like to send comments such as "find a bug" or "request for additional features" to the developer, please use one of the following contacts.

Expand Down
3 changes: 2 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ func Execute() error {
return rootCmd.Execute()
}

func completeNCPUs(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
// completeNCPUs returns the number of CPU cores as a string.
func completeNCPUs(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
n := runtime.NumCPU()
ret := make([]string, 0, n)
for i := 1; i <= n; i++ {
Expand Down
Loading

0 comments on commit 4cf680e

Please sign in to comment.