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

Update GitHub Actions #150

Merged
merged 1 commit into from
May 15, 2024
Merged
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
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?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surround headings with blank lines for better readability.

- ## Is your feature request related to a problem?
+ 
+ ## Is your feature request related to a problem?

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
## Is your feature request related to a problem?
## 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surround headings with blank lines for better readability.

- ## Describe the solution you'd like
+ 
+ ## Describe the solution you'd like

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
## Describe the solution you'd like
## Describe the solution you'd like

A clear and concise description of what you want to happen.

## Describe alternatives you've considered
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surround headings with blank lines for better readability.

- ## Describe alternatives you've considered
+ 
+ ## Describe alternatives you've considered

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
## Describe alternatives you've considered
## Describe alternatives you've considered

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

## Additional context
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surround headings with blank lines for better readability.

- ## Additional context
+ 
+ ## Additional context

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
## Additional context
## 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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define the GO_INSTALL variable to avoid potential issues.

+ GO_INSTALL  = $(GO) install

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
.PHONY: build test clean vet fmt chkfmt changelog tools help coverage-tree
GO_INSTALL = $(GO) install
.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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surround headings with blank lines for better readability.

- ### Star History
+ 
+ ### Star History

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
### Star History
### 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surround headings with blank lines for better readability.

- ### For Developers
+ 
+ ### For Developers

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
### For Developers
### 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surround headings with blank lines for better readability.

- ## Contact
+ 
+ ## Contact

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
## Contact
## 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
Loading