Giter Site home page Giter Site logo

k1low / octocov Goto Github PK

View Code? Open in Web Editor NEW
320.0 3.0 20.0 4.46 MB

octocov is a toolkit for collecting code metrics (code coverage, code to test ratio, test execution time and your own custom metrics).

Makefile 0.44% Go 99.44% Dockerfile 0.11% Shell 0.01%
code-coverage code-to-test-ratio badge test-execution-time hacktoberfest code-metrics testing coverage-report custom-metrics

octocov's Introduction

octocov

Coverage Code to Test Ratio Test Execution Time build

octocov is a toolkit for collecting code metrics (code coverage, code to test ratio, test execution time and your own custom metrics).

Key features of octocov are:

Getting Started

On GitHub Actions

:octocat: GitHub Actions for octocov is here !!

First, run test with coverage report output.

For example, in case of Go language, add -coverprofile=coverage.out option as follows

$ go test ./... -coverprofile=coverage.out

And generete .octocov.yml to your repository.

$ octocov init
.octocov.yml is generated

And set up a workflow file as follows and run octocov on GitHub Actions.

# .github/workflows/ci.yml
name: Test

on:
  pull_request:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      -
        uses: actions/checkout@v3
      -
        uses: actions/setup-go@v4
        with:
          go-version-file: go.mod
      -
        name: Run tests with coverage report output
        run: go test ./... -coverprofile=coverage.out
      -
        uses: k1LoW/octocov-action@v0

Then, octocov comment the report of the code metrics to the pull request.

comment

It is also possible to add reports to GitHub Actions Job Summaries by editing .octocov.yml.

summary

It can also be inserted into the body of a pull request.

body

Note that only pull requests from the same repository can be commented on (Reporting to GitHub Actions Job Summaries is permitted). This is because the workflow token of a forked pull request does not have write permission.

On Terminal

octocov acts as a code metrics viewer on the terminal.

For example, in case of Go language, add -coverprofile=coverage.out option as follows

$ go test ./... -coverprofile=coverage.out

And run octocov ls-files , octocov view [FILE...] and octocov diff [REPORT_A] [REPORT_B]

term

Usage example

Comment report to pull request

By setting comment:, comment the reports to pull request.

comment

# .octocov.yml
comment:
  hideFooterLink: false # hide octocov link

octocov checks for "Code Coverage" by default. If it is running on GitHub Actions, it will also measure "Test Execution Time".

If you want to measure "Code to Test Ratio", set codeToTestRatio:.

comment:
codeToTestRatio:
  code:
    - '**/*.go'
    - '!**/*_test.go'
  test:
    - '**/*_test.go'

By setting report: ( report.path: or report.datastores ) and diff: ( diff.path: or diff.datastores ) additionally, it is possible to show differences from previous reports as well.

comment:
report:
  datastores:
    - artifact://${GITHUB_REPOSITORY}
diff:
  datastores:
    - artifact://${GITHUB_REPOSITORY}

img

Check for acceptable score

By setting coverage.acceptable:, the condition of acceptable coverage is specified.

If this condition is not met, the command will exit with exit status 1.

# .octocov.yml
coverage:
  acceptable: 60%
$ octocov
Error: code coverage is 54.9%. the condition in the `coverage.acceptable:` section is not met (`60%`)

By setting codeToTestRatio.acceptable:, the condition of acceptable "Code to Test Ratio" is specified.

If this condition is not met, the command will exit with exit status 1.

# .octocov.yml
codeToTestRatio:
  acceptable: 1:1.2
  code:
    - '**/*.go'
    - '!**/*_test.go'
  test:
    - '**/*_test.go'
$ octocov
Error: code to test ratio is 1:1.1, the condition in the `codeToTestRatio.acceptable:` section is not met (`1:1.2`)

By setting testExecutionTime.acceptable:, the condition of acceptable "Test Execution Time" is specified (on GitHub Actions only) .

If this condition is not met, the command will exit with exit status 1.

# .octocov.yml
testExecutionTime:
  acceptable: 1 min
$ octocov
Error: test execution time is 1m15s, the condition in the `testExecutionTime.acceptable:` section is not met (`1 min`)

Generate report badges self.

By setting *.badge.path:, generate badges self.

# .octocov.yml
coverage:
  badge:
    path: docs/coverage.svg
# .octocov.yml
codeToTestRatio:
  badge:
    path: docs/ratio.svg
# .octocov.yml
testExecutionTime:
  badge:
    path: docs/time.svg

You can display the coverage badge without external communication by setting a link to this badge image in README.md, etc.

# mytool

![coverage](docs/coverage.svg) ![coverage](docs/ratio.svg) ![coverage](docs/time.svg)

coverage coverage coverage

Push report badges self.

By setting push:, git push report badges self.

# .octocov.yml
coverage:
  badge:
    path: docs/coverage.svg
push:

Store report to datastores

By setting report:, store the reports to datastores and local path.

# .octocov.yml
report:
  datastores:
    - github://owner/coverages/reports
    - s3://bucket/reports
# .octocov.yml
report:
  path: path/to/report.json

Supported datastores

  • GitHub repository
  • GitHub Actions Artifacts
  • Amazon S3
  • Google Cloud Storage (GCS)
  • BigQuery
  • Local

Central mode

By enabling central:, octocov acts as a central repository for collecting reports ( example ).

# .octocov.yml for central mode
central:
  root: .                                  # root directory or index file path of collected coverage reports pages. default: .
  reports:
    datastores:
      - bq://my-project/my-dataset/reports # datastore paths (URLs) where reports are stored. default: local://reports
  badges:
    datastores:
      - local://badges                     # directory where badges are generated.
  push:                                    # enable self git push

Supported datastores

  • GitHub repository
  • GitHub Actions Artifacts
  • Amazon S3
  • Google Cloud Storage (GCS)
  • BigQuery
  • Local

View code coverage report of file

octocov ls-files command can be used to list files logged in code coverage report.

octocov view (alias: octocov cat) command can be used to view the file coverage report.

term

Configuration

repository:

The name of the repository.

It should be in the format owner/repo.

By default, the value of the environment variable GITHUB_REPOSITORY is set.

In case of monorepo, code metrics can be reported to datastore separately by specifying owner/repo/project-a or owner/repo@project-a.

repository: k1LoW/octocov

timeout:

Timeout for octocov execution. (default: 30sec)

timeout: 5min

coverage:

Configuration for code coverage.

coverage.path:

coverage.path: has been deprecated. Please use coverage.paths: instead.

coverage.paths:

The path to the coverage report file.

If no path is specified, the default path for each coverage format will be scanned.

coverage:
  paths:
    - tests/coverage.xml

coverage.exclude:

Exclude files from the coverage report.

coverage:
  exclude:
    - 'cmd/*.ts'
    - 'proto/**/*.pb.ts'

coverage.acceptable:

acceptable coverage condition.

coverage:
  acceptable: 60%
coverage:
  acceptable: current >= 60% && diff >= 0.5%

The variables that can be used are as follows.

value description
current Current code metrics value
prev Previous value. This value is taken from diff.datastores:.
diff The result of current - prev

It is also possible to omit the expression as follows

Omitted expression Expanded expression
60% current >= 60%
> 60% current > 60%

coverage.badge:

Set this if want to generate the badge self.

coverage.badge.path:

The path to the badge.

coverage:
  badge:
    path: docs/coverage.svg

coverage.if:

Conditions for measuring code coverage.

coverage:
  if: is_default_branch

codeToTestRatio:

Configuration for code to test ratio.

codeToTestRatio.code: codeToTestRatio.test:

Files to count.

codeToTestRatio:
  code:                  # files to count as "Code"
    - '**/*.go'
    - '!**/*_test.go'
  test:                  # files to count as "Test"
    - '**/*_test.go'

codeToTestRatio.acceptable:

acceptable ratio condition.

codeToTestRatio:
  acceptable: 1:1.2
codeToTestRatio:
  acceptable: current >= 1.2 && diff >= 0.0

The variables that can be used are as follows.

value description
current Current code metrics value
prev Previous value. This value is taken from diff.datastores:.
diff The result of current - prev

It is also possible to omit the expression as follows

Omitted expression Expanded expression
1:1.2 current >= 1.2
> 1:1.2 current > 1.2

codeToTestRatio.badge:

Set this if want to generate the badge self.

codeToTestRatio.badge.path:

The path to the badge.

codeToTestRatio:
  badge:
    path: docs/ratio.svg

codeToTestRatio.if:

Conditions for measuring code to test ratio.

codeToTestRatio:
  if: is_default_branch

testExecutionTime:

Configuration for test execution time.

testExecutionTime.acceptable

acceptable time condition.

testExecutionTime:
  acceptable: 1min
testExecutionTime:
  acceptable: current <= 1min && diff <= 1sec

The variables that can be used are as follows.

value description
current Current code metrics value
prev Previous value. This value is taken from diff.datastores:.
diff The result of current - prev

It is also possible to omit the expression as follows

Omitted expression Expanded expression
1min current <= 1min
< 1min current < 1min

testExecutionTime.steps

The name of the step to measure the execution time.

testExecutionTime:
  steps:
    - Run test
    - Run slow test

If not specified, the step where the coverage report file is generated is used as the measurement target.

testExecutionTime.badge

Set this if want to generate the badge self.

testExecutionTime.badge.path

The path to the badge.

testExecutionTime:
  badge:
    path: docs/time.svg

testExecutionTime.if:

Conditions for measuring test execution time.

testExecutionTime:
  if: is_pull_request

push:

Configuration for git push files self.

push.if:

Conditions for pushing files.

# .octocov.yml
push:
  if: is_default_branch

The variables available in the if section are here.

push.message:

message for commit.

# .octocov.yml
push:
  message: Update by octocov [skip ci]

comment:

Set this if want to comment report to pull request

comment.hideFooterLink:

Hide footer octocov link.

comment:
  hideFooterLink: true

comment.deletePrevious:

Delete previous code metrics report comments instead of hiding them

comment:
  deletePrevious: true

comment.if:

Conditions for commenting report.

# .octocov.yml
comment:
  if: is_pull_request

The variables available in the if section are here.

summary:

Set this if want to add report to job summary page.

summary.hideFooterLink:

Hide footer octocov link.

summary:
  hideFooterLink: true

summary.if:

Conditions for adding report to job summary page.

# .octocov.yml
summary:
  if: true

The variables available in the if section are here.

body:

Set this if want to insert report to body of pull request.

body.hideFooterLink:

Hide footer octocov link.

body:
  hideFooterLink: true

body.if:

Conditions for inserting report body of pull request.

# .octocov.yml
body:
  if: is_pull_request

The variables available in the if section are here.

diff:

Configuration for comparing reports.

diff.path:

Path of the report to compare.

diff:
  path: path/to/coverage.yml
diff:
  path: path/to/report.json

diff.datastores:

Datastores where the report to be compared is stored.

diff:
  datastores:
    - local://.octocov       # Use .octocov/owner/repo/report.json
    - s3://my-bucket/reports # Use s3://my-bucket/reports/owner/repo/report.json

diff.if:

Conditions for comparing reports

# .octocov.yml
report:
  if: is_pull_request
  path: path/to/report.json

The variables available in the if section are here.

report:

Configuration for reporting to datastores.

report.path:

Path to save the report.

report:
  path: path/to/report.json

report.datastores:

Datastores where the reports are stored.

report:
  datastores:
    - github://owner/coverages/reports
    - s3://bucket/reports

GitHub repository

Use github:// scheme.

github://[owner]/[repo]@[branch]/[prefix]

Required environment variables:

  • GITHUB_TOKEN or OCTOCOV_GITHUB_TOKEN
  • GITHUB_REPOSITORY or OCTOCOV_GITHUB_REPOSITORY
  • GITHUB_API_URL or OCTOCOV_GITHUB_API_URL (optional)

GitHub Actions Artifacts

Use artifact:// or artifacts:// scheme.

artifact://[owner]/[repo]/[artifactName]
  • artifact://[owner]/[repo]/[artifactName]
  • artifact://[owner]/[repo] ( default artifactName: octocov-report )

Note that reporting to the artifact can only be sent from the GitHub Actions of the same repository.

Required environment variables:

  • GITHUB_TOKEN or OCTOCOV_GITHUB_TOKEN
  • GITHUB_REPOSITORY or OCTOCOV_GITHUB_REPOSITORY
  • GITHUB_API_URL or OCTOCOV_GITHUB_API_URL (optional)

Amazon S3

Use s3:// scheme.

s3://[bucket]/[prefix]

Required permission:

  • s3:PutObject

Required environment variables:

  • AWS_ACCESS_KEY_ID or OCTOCOV_AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY or OCTOCOV_AWS_SECRET_ACCESS_KEY
  • AWS_SESSION_TOKEN or OCTOCOV_AWS_SESSION_TOKEN (optional)

Google Cloud Storage

Use gs:// scheme.

gs://[bucket]/[prefix]

Required permission:

  • storage.objects.create
  • storage.objects.delete

Required environment variables:

  • GOOGLE_APPLICATION_CREDENTIALS or GOOGLE_APPLICATION_CREDENTIALS_JSON or OCTOCOV_GOOGLE_APPLICATION_CREDENTIALS or OCTOCOV_GOOGLE_APPLICATION_CREDENTIALS_JSON

BigQuery

Use bq:// scheme.

bq://[project ID]/[dataset ID]/[table]

Required permission:

  • bigquery.datasets.get
  • bigquery.tables.get
  • bigquery.tables.updateData

Required environment variables:

  • GOOGLE_APPLICATION_CREDENTIALS or GOOGLE_APPLICATION_CREDENTIALS_JSON or OCTOCOV_GOOGLE_APPLICATION_CREDENTIALS or OCTOCOV_GOOGLE_APPLICATION_CREDENTIALS_JSON

Datastore schema:

Datastore schema

If you want to create a table, execute the following command ( require bigquery.datasets.create ).

$ octocov migrate-bq-table

Mackerel

Note: Only works with report.datastores or central.reReport.datastores

Use mackerel:// or mkr:// scheme.

mackerel://[Service Name]

Required permission:

  • read
  • write

Required environment variables:

  • MACKEREL_API_KEY or OCTOCOV_MACKEREL_API_KEY

Local

Use local:// or file:// scheme.

local://[path]

Example:

If the absolute path of .octocov.yml is /path/to/.octocov.yml

  • local://reports ... /path/to/reports directory
  • local://./reports ... /path/to/reports directory
  • local://../reports ... /path/reports directory
  • local:///reports ... /reports directory.

report.if:

Conditions for storing a report.

# .octocov.yml
report:
  if: env.GITHUB_REF == 'refs/heads/main'
  datastores:
    - github://owner/coverages/reports

The variables available in the if section are here.

*.if:

Note: It supports expr-lang/expr expressions.

The variables available in the if section are as follows

Variable name Type Description
year int Year of current time (UTC)
month int Month of current time (UTC)
day int Day of current time (UTC)
hour int Hour of current time (UTC)
weekday int Weekday of current time (UTC) (Sunday = 0, ...)
github.event_name string Event name of GitHub Actions ( ex. issues, pull_request )
github.event object Detailed data for each event of GitHub Actions (ex. github.event.action, github.event.label.name )
env.<env_name> string The value of a specific environment variable
is_pull_request boolean Whether the job is related to an pull request (ex. a job fired by on.push will be true if it is related to a pull request)
is_draft boolean Whether the job is related to a draft pull request
labels array Labels that are set for the pull request
is_default_branch boolean Whether the job is related to default branch of repository

central:

Note: When central mode is enabled, other functions are automatically turned off.

central.root:

The root directory or index file ( index file example ) path of collected coverage reports pages. default: .

central:
  root: path/to

central.reports:

central.reports.datastores:

Datastore paths (URLs) where reports are stored. default: local://reports

central:
  reports:
    datastores:
      - local://reports
      - gs://my-gcs-bucket/reports

Use GitHub Actions Artifacts as datastore

When using GitHub Actions Artifacts as a datastore, perform badge generation via on.schedule.

github

# .octocov.yml
report:
  datastores:
    - artifact://${GITHUB_REPOSITORY}
# .octocov.yml for central repo
central:
  reports:
    datastores:
      - artifact://owner/repo
      - artifact://owner/other-repo
      - artifact://owner/another-repo
      [...]
  push:

Code metrics and badges of my open source projects using octocov central mode is here.

Template repositoty is here.

Use GitHub repository as datastore

When using the central repository as a datastore, perform badge generation via on.push.

github

# .octocov.yml
report:
  datastores:
    - github://owner/central-repo/reports
# .octocov.yml for central repo
central:
  reports:
    datastores:
      - github://owner/central-repo/reports
  push:

or

# .octocov.yml for central repo
central:
  reports:
    datastores:
      - local://reports
  push:

Use Amazon S3 bucket as datastore

When using the S3 bucket as a datastore, perform badge generation via on.schedule.

s3

# .octocov.yml
report:
  datastores:
    - s3://my-s3-bucket/reports
# .octocov.yml for central repo
central:
  reports:
    datastores:
      - s3://my-s3-bucket/reports
  push:

Required permission (Central Repo):

  • s3:GetObject
  • s3:ListObject

Required environment variables (Central Repo):

  • AWS_ACCESS_KEY_ID or OCTOCOV_AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY or OCTOCOV_AWS_SECRET_ACCESS_KEY
  • AWS_SESSION_TOKEN or OCTOCOV_AWS_SESSION_TOKEN (optional)

Use GCS bucket as datastore

gcs

When using the GCS bucket as a datastore, perform badge generation via on.schedule.

# .octocov.yml
report:
  datastores:
    - gs://my-gcs-bucket/reports
# .octocov.yml for central repo
central:
  reports:
    datastores:
      - gs://my-gcs-bucket/reports
  push:

Required permission (Central Repo):

  • storage.objects.get
  • storage.objects.list
  • storage.buckets.get

Required environment variables (Central Repo):

  • GOOGLE_APPLICATION_CREDENTIALS or GOOGLE_APPLICATION_CREDENTIALS_JSON or OCTOCOV_GOOGLE_APPLICATION_CREDENTIALS or OCTOCOV_GOOGLE_APPLICATION_CREDENTIALS_JSON

Use BigQuery table as datastore

gcs

When using the BigQuery table as a datastore, perform badge generation via on.schedule.

# .octocov.yml
report:
  datastores:
    - bq://my-project/my-dataset/reports
# .octocov.yml for central repo
central:
  reports:
    datastores:
      - bq://my-project/my-dataset/reports
  push:

Required permission (Central Repo):

  • bigquery.jobs.create
  • bigquery.tables.getData

Required environment variables (Central Repo):

  • GOOGLE_APPLICATION_CREDENTIALS or GOOGLE_APPLICATION_CREDENTIALS_JSON or OCTOCOV_GOOGLE_APPLICATION_CREDENTIALS or OCTOCOV_GOOGLE_APPLICATION_CREDENTIALS_JSON

central.badges:

central.badges.datastores:

Datastore paths (URLs) where badges are generated. default: local://badges

central:
  badges:
    datastores:
      - local://badges
      - s3://my-s3-buckets/badges

central.push:

Configuration for git push index file and badges self.

central.if:

Conditions for central mode.

# .octocov.yml
central:
  if: env.GITHUB_REF == 'refs/heads/main'
  reports:
    datastores:
      - s3://my-s3-bucket/reports

The variables available in the if section are here.

central.reReport:

Store collected reports in yet another datastores.

central.reReport.if:

Conditions for re storing reports.

central.reReport.datastores:

Datastores where the reports are re-stored.

Supported coverage report formats

octocov supports multiple coverage report formats.

And octocov searches for the default path for each format.

If you want to specify the path of the report file, set coverage.path

coverage:
  paths:
    - /path/to/coverage.txt

Go coverage

Default path: coverage.out

LCOV

Default path: coverage/lcov.info

Support SF DA only

SimpleCov

Default path: coverage/.resultset.json

Clover

Default path: coverage.xml

Cobertura

Default path: coverage.xml

JaCoCo

Default path: build/reports/jacoco/test/jacocoTestReport.xml

Supported code metrics

  • Code Coverage
  • Code to Test Ratio
  • Test Execution Time (on GitHub Actions only)

Custom metrics

custom_metrics

octocov accepts custom metrics in addition to the three supporting metrics.

Specify the path to the custom metrics JSON file in an environment variable prefixed with OCTOCOV_CUSTOM_METRICS_ to collect the code metrics at the same time.

The JSON schema for custom metrics can be found here.

If there are multiple custom metrics JSON files, specify each file path in a separate environment variable (example here) or combine the JSONs that satisfy the JSON schema into an array.

Detecting pull request number

octocov detect pull request number following order.

  1. Get pull request number from GITHUB_PULL_REQUEST_NUMBER or OCTOCOV_GITHUB_PULL_REQUEST_NUMBER.
  2. Get pull request number from GITHUB_REF ( e.g. refs/pull/1/merge ).
  3. Get branch name from GITHUB_REF ( e.g. refs/heads/branch/branch/name ) and detect pull request number using GitHub API.

Override environment variables

If an environment variable with prefix OCTOCOV_ is set, it is used as an unprefixed environment variable in octocov.

For example, if OCTOCOV_GITHUB_REF is set, it is handled as GITHUB_REF in octocov.

This feature allows environment variables that cannot normally be overridden to be changed on octocov.

Install

deb:

$ export OCTOCOV_VERSION=X.X.X
$ curl -o octocov.deb -L https://github.com/k1LoW/octocov/releases/download/v$OCTOCOV_VERSION/octocov_$OCTOCOV_VERSION-1_amd64.deb
$ dpkg -i octocov.deb

RPM:

$ export OCTOCOV_VERSION=X.X.X
$ yum install https://github.com/k1LoW/octocov/releases/download/v$OCTOCOV_VERSION/octocov_$OCTOCOV_VERSION-1_amd64.rpm

apk:

$ export OCTOCOV_VERSION=X.X.X
$ curl -o octocov.apk -L https://github.com/k1LoW/octocov/releases/download/v$OCTOCOV_VERSION/octocov_$OCTOCOV_VERSION-1_amd64.apk
$ apk add octocov.apk

homebrew tap:

$ brew install k1LoW/tap/octocov

aqua:

$ aqua g -i k1LoW/octocov

manually:

Download binary from releases page

go install:

$ go install github.com/k1LoW/octocov@latest

docker:

$ docker pull ghcr.io/k1low/octocov:latest

octocov's People

Contributors

dependabot[bot] avatar dragon3 avatar furusax0621 avatar github-actions[bot] avatar k1low avatar k2tzumi avatar rizalgowandy avatar sapuri avatar suzuki-shunsuke avatar toshi0607 avatar u-yas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

octocov's Issues

Make pull request comment better for monorepo

We use the octocov in our monorepo which has multiple language directories, like this:

repo
├── .octocov.go.yaml
├── .octocov.java.yaml
├── .octocov.python.yaml
├── go
├── java
└── python

We test, generate coverage file, and run octocov individually with the separated config files and GitHub actions workflows.

Sometimes we need to run those workflows at the same time (e.g. build whole repository), then comments on pull request look like this:

Screen_Shot_2022-04-14_at_15_37_22

As you can see, there are 3 different reports, but it's hard to know which report is for which.
Also comments got hidden (minimized) except for the last one even they are different reports.


So it would be great if:

  • each report can have comment header (title), like
    • Code Metrics Report (go)
    • Code Metrics Report (java)
    • Code Metrics Report (python)
  • they will not hidden by other reports.

What do you think?

SIGSEGV on v0.38.1

I got the following error on v0.38.1 via [email protected].
Do you have any idea about the SIGSEGV?

I confirmed that v0.38.0 doesn't have this issue. ( So now I'm using it for now )

I've tried to use v0.38.1 binary directly, but got the same error.

octocov version 0.38.1

                       #XXXX (xxxxxxx)  
----------------------------------------
  Coverage                       xx.x%  
  Code to Test Ratio             x:x.x  
  Test Execution Time            XmXXs  

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7f5988e39360]

runtime stack:
runtime.throw({0x164bc18, 0x7f5988b4b653})
	/Users/k1low/sdk/go1.17.7/src/runtime/panic.go:1198 +0x71
runtime.sigpanic()
	/Users/k1low/sdk/go1.17.7/src/runtime/signal_unix.go:719 +0x396

goroutine 41 [syscall]:
runtime.cgocall(0x10f1310, 0xc00006a590)
	/Users/k1low/sdk/go1.17.7/src/runtime/cgocall.go:156 +0x5c fp=0xc00006a568 sp=0xc00006a530 pc=0x40527c
net._C2func_getaddrinfo(0xc001349c60, 0x0, 0xc00134daa0, 0xc002476480)
	_cgo_gotypes.go:91 +0x56 fp=0xc00006a590 sp=0xc00006a568 pc=0x68b116
net.cgoLookupIPCNAME.func1({0xc001349c60, 0xc00006a738, 0x4479af}, 0x16023b9, 0x3)
	/Users/k1low/sdk/go1.17.7/src/net/cgo_unix.go:163 +0x9f fp=0xc00006a5e8 sp=0xc00006a590 pc=0x68ce5f
net.cgoLookupIPCNAME({0x14e22c8, 0x2}, {0x16023b9, 0xc00006a77c})
	/Users/k1low/sdk/go1.17.7/src/net/cgo_unix.go:163 +0x16d fp=0xc00006a738 sp=0xc00006a5e8 pc=0x68c6ad
net.cgoIPLookup(0x0, {0x14e22c8, 0x0}, {0x16023b9, 0x0})
	/Users/k1low/sdk/go1.17.7/src/net/cgo_unix.go:220 +0x3b fp=0xc00006a7a8 sp=0xc00006a738 pc=0x68cf1b
net.cgoLookupIP·dwrap·25()
	/Users/k1low/sdk/go1.17.7/src/net/cgo_unix.go:230 +0x36 fp=0xc00006a7e0 sp=0xc00006a7a8 pc=0x68d396
runtime.goexit()
	/Users/k1low/sdk/go1.17.7/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc00006a7e8 sp=0xc00006a7e0 pc=0x4655e1
created by net.cgoLookupIP
	/Users/k1low/sdk/go1.17.7/src/net/cgo_unix.go:230 +0x125

goroutine 1 [chan receive]:
cloud.google.com/go/compute/metadata.testOnGCE()
	/Users/k1low/go/pkg/mod/cloud.google.com/go/[email protected]/metadata/metadata.go:153 +0x185
cloud.google.com/go/compute/metadata.initOnGCE()
	/Users/k1low/go/pkg/mod/cloud.google.com/go/[email protected]/metadata/metadata.go:114 +0x17
sync.(*Once).doSlow(0x1aa4340, 0xc0029bd530)
	/Users/k1low/sdk/go1.17.7/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc001b61580, {0xc00289c000, 0xdfa, 0xdfa})
	/Users/k1low/sdk/go1.17.7/src/internal/poll/fd_unix.go:167 +0x25a
net.(*netFD).Read(0xc001b61580, {0xc00289c000, 0xc00289c005, 0x56b})
	/Users/k1low/sdk/go1.17.7/src/net/fd_posix.go:56 +0x29
net.(*conn).Read(0xc00056e000, {0xc00289c000, 0x6, 0xc0013ed7f8})
	/Users/k1low/sdk/go1.17.7/src/net/net.go:183 +0x45
crypto/tls.(*atLeastReader).Read(0xc0028ee090, {0xc00289c000, 0x0, 0x40b90d})
	/Users/k1low/sdk/go1.17.7/src/crypto/tls/conn.go:777 +0x3d
bytes.(*Buffer).ReadFrom(0xc0013de978, {0x1aa0b20, 0xc0028ee090})
	/Users/k1low/sdk/go1.17.7/src/bytes/buffer.go:204 +0x98
crypto/tls.(*Conn).readFromUntil(0xc0013de700, {0x1aa44c0, 0xc00056e000}, 0x400)
	/Users/k1low/sdk/go1.17.7/src/crypto/tls/conn.go:799 +0xe5
crypto/tls.(*Conn).readRecordOrCCS(0xc0013de700, 0x0)
	/Users/k1low/sdk/go1.17.7/src/crypto/tls/conn.go:606 +0x112
crypto/tls.(*Conn).readRecord(...)
	/Users/k1low/sdk/go1.17.7/src/crypto/tls/conn.go:574
crypto/tls.(*Conn).Read(0xc0013de700, {0xc00289d000, 0x1000, 0x1})
	/Users/k1low/sdk/go1.17.7/src/crypto/tls/conn.go:1277 +0x16f
net/http.(*persistConn).Read(0xc0001c3200, {0xc00289d000, 0xc002030060, 0xc0013edd30})
	/Users/k1low/sdk/go1.17.7/src/net/http/transport.go:1926 +0x4e
bufio.(*Reader).fill(0xc001335b60)
	/Users/k1low/sdk/go1.17.7/src/bufio/bufio.go:101 +0x103
bufio.(*Reader).Peek(0xc001335b60, 0x1)
	/Users/k1low/sdk/go1.17.7/src/bufio/bufio.go:139 +0x5d
net/http.(*persistConn).readLoop(0xc0001c3200)
	/Users/k1low/sdk/go1.17.7/src/net/http/transport.go:2087 +0x1ac
created by net/http.(*Transport).dialConn
	/Users/k1low/sdk/go1.17.7/src/net/http/transport.go:1747 +0x1e05

goroutine 40 [select]:
net/http.(*persistConn).writeLoop(0xc0001c3200)
	/Users/k1low/sdk/go1.17.7/src/net/http/transport.go:2386 +0xfb
created by net/http.(*Transport).dialConn
	/Users/k1low/sdk/go1.17.7/src/net/http/transport.go:1748 +0x1e65

goroutine 23 [select]:
net/http.(*Transport).getConn(0x2a639a0, 0xc00055e140, {{}, 0x0, {0x15f111b, 0x4}, {0xc000046120, 0x12}, 0x0})
	/Users/k1low/sdk/go1.17.7/src/net/http/transport.go:1372 +0x5d2
net/http.(*Transport).roundTrip(0x2a639a0, 0xc001b00200)
	/Users/k1low/sdk/go1.17.7/src/net/http/transport.go:581 +0x774
net/http.(*Transport).RoundTrip(0xc0013eeb30, 0x1aa4560)
	/Users/k1low/sdk/go1.17.7/src/net/http/roundtrip.go:18 +0x19
net/http.send(0xc001b00200, {0x1aa4560, 0x2a639a0}, {0x14af480, 0x7f599243ef01, 0x0})
	/Users/k1low/sdk/go1.17.7/src/net/http/client.go:252 +0x5d8
net/http.(*Client).send(0x289eb20, 0xc001b00200, {0x0, 0xec8e24, 0x0})
	/Users/k1low/sdk/go1.17.7/src/net/http/client.go:176 +0x9b
net/http.(*Client).do(0x289eb20, 0xc001b00200)
	/Users/k1low/sdk/go1.17.7/src/net/http/client.go:725 +0x908
net/http.(*Client).Do(...)
	/Users/k1low/sdk/go1.17.7/src/net/http/client.go:593
cloud.google.com/go/compute/metadata.testOnGCE.func1()
	/Users/k1low/go/pkg/mod/cloud.google.com/go/[email protected]/metadata/metadata.go:133 +0x310
created by cloud.google.com/go/compute/metadata.testOnGCE
	/Users/k1low/go/pkg/mod/cloud.google.com/go/[email protected]/metadata/metadata.go:130 +0xf5

goroutine 24 [select]:
net.cgoLookupIP({0x1ac2848, 0xc0023c5540}, {0x14e22c8, 0x0}, {0x16023b9, 0x0})
	/Users/k1low/sdk/go1.17.7/src/net/cgo_unix.go:231 +0x1b7
net.cgoLookupHost({0x1ac2848, 0xc0023c5540}, {0x16023b9, 0x18})
	/Users/k1low/sdk/go1.17.7/src/net/cgo_unix.go:59 +0x55
net.(*Resolver).lookupHost(0x2a621e0, {0x1ac2848, 0xc0023c5540}, {0x16023b9, 0x18})
	/Users/k1low/sdk/go1.17.7/src/net/lookup_unix.go:82 +0xa8
net.(*Resolver).LookupHost(0x0, {0x1ac2848, 0xc0023c5540}, {0x16023b9, 0x0})
	/Users/k1low/sdk/go1.17.7/src/net/lookup.go:187 +0x165
cloud.google.com/go/compute/metadata.testOnGCE.func2()
	/Users/k1low/go/pkg/mod/cloud.google.com/go/[email protected]/metadata/metadata.go:143 +0x45
created by cloud.google.com/go/compute/metadata.testOnGCE
	/Users/k1low/go/pkg/mod/cloud.google.com/go/[email protected]/metadata/metadata.go:142 +0x15d

goroutine 13 [runnable]:
net.setDefaultSockopts(0x8, 0x2, 0x1, 0x0)
	/Users/k1low/sdk/go1.17.7/src/net/sockopt_linux.go:12 +0x14f
net.socket({0x1ac28b8, 0xc0013822a0}, {0x14e7c69, 0x3}, 0x2, 0x1, 0x0, 0x18, {0x1acadf8, 0x0}, ...)
	/Users/k1low/sdk/go1.17.7/src/net/sock_posix.go:24 +0x99
net.internetSocket({0x1ac28b8, 0xc0013822a0}, {0x14e7c69, 0x3}, {0x1acadf8, 0x0}, {0x1acadf8, 0xc00287c150}, 0xc00138a000, 0x0, ...)
	/Users/k1low/sdk/go1.17.7/src/net/ipsock_posix.go:142 +0xf8
net.(*sysDialer).doDialTCP(0xc001b60000, {0x1ac28b8, 0xc0013822a0}, 0x0, 0x12fa6e0)
	/Users/k1low/sdk/go1.17.7/src/net/tcpsock_posix.go:66 +0xa5
net.(*sysDialer).dialTCP(0xc0013822a0, {0x1ac28b8, 0xc0013822a0}, 0x4bd566, 0x2000)
	/Users/k1low/sdk/go1.17.7/src/net/tcpsock_posix.go:62 +0x59
net.(*sysDialer).dialSingle(0xc001b60000, {0x1ac28b8, 0xc0013822a0}, {0x1ab6478, 0xc00287c150})
	/Users/k1low/sdk/go1.17.7/src/net/dial.go:583 +0x28b
net.(*sysDialer).dialSerial(0xc001b60000, {0x1ac28b8, 0xc0013822a0}, {0xc00287a090, 0x1, 0x14ede87})
	/Users/k1low/sdk/go1.17.7/src/net/dial.go:551 +0x312
net.(*Dialer).DialContext(0xc00127c9c0, {0x1ac2880, 0xc0001aa000}, {0x14e7c69, 0x7f59897e7f20}, {0xc000046120, 0x118})
	/Users/k1low/sdk/go1.17.7/src/net/dial.go:428 +0x736
net.(*Dialer).Dial(...)
	/Users/k1low/sdk/go1.17.7/src/net/dial.go:351
net/http.(*Transport).dial(0xc00287e000, {0x1ac2848, 0xc0023c5540}, {0x14e7c69, 0x3000106}, {0xc000046120, 0xffffffffffffffff})
	/Users/k1low/sdk/go1.17.7/src/net/http/transport.go:1169 +0x5a
net/http.(*Transport).dialConn(0x2a639a0, {0x1ac2848, 0xc0023c5540}, {{}, 0x0, {0x15f111b, 0x4}, {0xc000046120, 0x12}, 0x0})
	/Users/k1low/sdk/go1.17.7/src/net/http/transport.go:1604 +0x845
net/http.(*Transport).dialConnFor(0x0, 0xc001380000)
	/Users/k1low/sdk/go1.17.7/src/net/http/transport.go:1446 +0xb0
created by net/http.(*Transport).queueForDial
	/Users/k1low/sdk/go1.17.7/src/net/http/transport.go:1415 +0x3d7

[FEATURE REQUEST] Enable use of `**`/ `*` in coverage.paths

Hi, thanks for creating great library!
I would like to send a feature request:

coverage:
  paths:
    - domain/**/lcov.info
    - domain/*/lcov.info

looks much nicer if it could read domain/hoge/lcov.info , domain/hoge/fuga/lcov.info for these settings for using ** / * .

octocov didn't comment on the pull request

I use rspec, here is my octocov.yml file

coverage:
  paths:
    - coverage/.resultset.json
codeToTestRatio:
  code:
    - '**/*.rb'
    - '!**/*_spec.rb'
  test:
    - '**/*_spec.rb'
testExecutionTime:
  if: true
diff:
  datastores:
    - artifact://${GITHUB_REPOSITORY}
comment:
  if: true
  deletePrevious: true
summary:
  if: true
report:
  datastores:
    - artifact://${GITHUB_REPOSITORY}

everything goes well during the CI, but no comment is added to the PR. an error also occurs if you look at the logs

octocov version 0.56.3
---------------------------------------
  Coverage                      42.7%  
  Code to Test Ratio            1:0.1  

Commenting report...
Skip commenting report to pull request: context deadline exceeded
Adding report to job summary page...
Skip adding report to job summary page: context deadline exceeded
Skip inserting report to body of pull request: body: is not set
Storing report...
Skip pushing generate files: push: is not set

Acceptable Coverage calculation is inconsistent

Scenario 1: Acceptable coverage correctly calculates, and the build check passes
octocov.yml
coverage:
acceptable: current >= 77.8%

Screenshot 2024-05-23 at 12 29 45 PM

Scenario 2: Acceptable coverage incorrectly calculates, and the build check fails
octocov.yml
coverage:
acceptable: current >= 32.6%

Screenshot 2024-05-23 at 12 33 21 PM

NOTE: current coverage needs to be at least 0.01% above the acceptable for the check to pass

Increase format presision of Code to Test Ratio

It takes a lot of time and effort to increase the test coverage by 10%. Sometimes it is impossible to achieve it, for example from 80% to 90% and from 90 to 100.
Why don't we use 2 or 3 decimal places as default? In my case, this change will motivate me to write test codes.
This may break changes but I think it won't change any system behaviors.

If you agree the proposal, I'll make a pull-request👍
https://github.com/k1LoW/octocov/blob/bdda036c59ac40b949f6b76f6e4f741e2606763a/report/report.go#LL111C32-L111C36

Could not detect number of pull request

Here is my workflow using workflow_run to trigger the action.

name: "Code Coverage Report"
on:
  workflow_run:
    workflows: ["Tests"]
    types:
      - completed

jobs:
  coverage:
    runs-on: ubuntu-latest
    if: github.event.workflow_run.conclusion != 'skipped'

    steps:
     - name: Download and Extract Artifacts
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
        run: |
          mkdir -p artifacts && cd artifacts

          artifacts_url=${{ github.event.workflow_run.artifacts_url }}

          gh api --paginate "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
          do
            IFS=$'\t' read name url <<< "$artifact"
            gh api $url > "$name.zip"
            unzip -d "$name" "$name.zip"
          done
      - uses: k1LoW/octocov-action@v0
Build Log

Run k1LoW/octocov-action@v0
/usr/bin/docker run --name c0442a2d2e6653b5046d3b41aa510b.....
octocov version 0.47.2
Skip measuring code to test ratio: codeToTestRatio: is not set
Skip measuring test execution time: the step that was executed at the relevant time (2023-04-01 16:37:32 +0000 UTC) does not exist in the job (12448157160).
Generate coverage report badge...

        dev (61834fg)  

Coverage 45.9%

Skip commenting report to pull request: could not detect number of pull request
Adding report to job summary page...
Skip inserting report to body of pull request: body: is not set
Storing report...
Skip pushing generate files: push: is not set

Its working when you run base on pull request. In my situation I need the test run first before we can grab the coverage report. I think it doesn't detect pull request on workflow_run. Maybe we need additional way to get the pull request if for action that triggered by workflow_run.

For me every pull request have an issue attach to it, maybe we can use this issues api to get the pull request.

[FEATURE REQUEST] `octocov` to show more information

Hey thank you for the great tool.

Right now I heavily using octocov command in CLI usecase.

It might be more useful to have more information than overall coverage only.

For example Files, Lines, Covered which printed in detail for Comment and Summary in GitHub Actions usecase.

$ octocov -r path/to/report

                         path/to/report             
----------------------------------------
Coverage                      93.0% 
Files                         XXXX
Lines                         XXXX
Covered                       XXXX

and also are there any chance that I can change path/to/report to something more shorter ?

Anyway thanks for great tools you make and keep up the good works.

JaCoCo format support

Hello, thank you for creating a great tool! We are considering introducing octocov. I'd like to confirm if JaCoCo will be supported (or how we implement a patch for JaCoCo). This is because we are using JaCoCo for Java workload, and clover and cobertura that are supported by octocov seems not to be actively developed.

Error: GITHUB_EVENT_NAME is not set when running octocov ls-files locally

I'm trying to use octocov ls-files in a local environment, but I encounter the following error message:

$ octocov --version
octocov version 0.54.3
$ octocov ls-files
Error: env GITHUB_EVENT_NAME is not set

Is the GITHUB_EVENT_NAME environment variable required for running octocov commands locally? If so, could you provide more information on why it's necessary? If not, could this be considered a bug?

Thank you for your help.

Allow the link to the file in the comments to be changed to an HTML file to check the line of coverage

Proposal

Some coverage tools output reports in html to check coverage lines.

I want to change the file link destination for the code coverage of the files in the scope of the pull request.

Issue

  • github actions by itself cannot host the html of the coverage report, so we need to put the html on an external server.
    Need to change the link to an external server
  • Some HTML in the coverage report does not allow assembling URLs that refer to the coverage in question from the path of the change file
    It may be necessary to generate URLs from the path of changed files only for reports that can be handled.

octocov-action with v0.41.0 fails

Thank you for the very useful tool! Our org stated to use this in many projects.

I found the CI stared to fail as soon as the new version released with the same CI and the same test code. I hope the following stack trace will help. I also investigate the cause.

Before

octocov version 0.40.1

                       feature/xxx-branch
                                  (xxxxxxxx)              
---------------------------------------------------------
  Coverage                                        32.7%  
  Code to Test Ratio                              1:0.5  
  Test Execution Time                             1m22s  

Commenting report...
Skip storing the report: the condition in the `if` section is not met (is_default_branch)
Skip pushing generate files: push: is not set

After

octocov version 0.41.0

                       feature/xxx-branch
                                  (xxxxxxxx)              
---------------------------------------------------------
  Coverage                                        32.7%  
  Code to Test Ratio                              1:0.5  
  Test Execution Time                             1m36s  

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7f5cac004360]

runtime stack:
runtime.throw({0x17bde[16](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:17)?, 0x7f5ca4b94623?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/runtime/panic.go:992 +0x71
runtime.sigpanic()
	/opt/hostedtoolcache/go/1.18.5/x64/src/runtime/signal_unix.go:802 +0x389

goroutine 52 [syscall]:
runtime.cgocall(0x120bb10, 0xc000c6ed98)
	/opt/hostedtoolcache/go/1.18.5/x64/src/runtime/cgocall.go:157 +0x5c fp=0xc000c6ed70 sp=0xc000c6ed38 pc=0x40571c
net._C2func_getaddrinfo(0xc0021555d0, 0x0, 0xc0020f8d80, 0xc000010900)
	_cgo_gotypes.go:94 +0x56 fp=0xc000c6ed98 sp=0xc000c6ed70 pc=0x6b2c36
net.cgoLookupIPCNAME.func1({0xc0021555d0, 0x689af2?, 0xc000188980?}, 0xc0018d7c50?, 0x6b919b?)
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/cgo_unix.go:160 +0x9f fp=0xc000c6edf0 sp=0xc000c6ed98 pc=0x6b495f
net.cgoLookupIPCNAME({0x16497a4, 0x3}, {0xc0018d7c50, 0xe})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/cgo_unix.go:160 +0x16d fp=0xc000c6ef38 sp=0xc000c6edf0 pc=0x6b41cd
net.cgoIPLookup(0x2d09230?, {0x16497a4?, 0xc0018d7c68?}, {0xc0018d7c50?, 0xc000c7d810?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/cgo_unix.go:2[17](https://github.comxxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:18) +0x3b fp=0xc000c6efa8 sp=0xc000c6ef38 pc=0x6b4a1b
net.cgoLookupIP.func1()
	/opt/hostedtoolcache/go/1.[18](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:19).5/x64/src/net/cgo_unix.go:227 +0x36 fp=0xc000c6efe0 sp=0xc000c6efa8 pc=0x6b4e56
runtime.goexit()
	/opt/hostedtoolcache/go/1.18.5/x64/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc000c6efe8 sp=0xc000c6efe0 pc=0x4658a1
created by net.cgoLookupIP
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/cgo_unix.go:227 +0x12a

goroutine 1 [select]:
net/http.(*Transport).getConn(0xc001018500, 0xc0021597c0, {{}, 0x0, {0xc0021323c0, 0x5}, {0xc0018d7c50, 0x12}, 0x0})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/transport.go:1375 +0x5c6
net/http.(*Transport).roundTrip(0xc001018500, 0xc00162c500)
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/transport.go:581 +0x76f
net/http.(*Transport).RoundTrip(...)
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/roundtrip.go:17
github.com/k1LoW/go-github-client/v45/factory.roundTripper.RoundTrip({0xc001018500?, {0xc0012d090d?, 0x2d5a543a0?}}, 0xc00162c500)
	/home/runner/go/pkg/mod/github.com/k1!lo!w/go-github-client/[email protected]/factory/factory.go:[19](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:20)0 +0x147
net/http.send(0xc00162c100, {0x1d14f60, 0xc00210b7d0}, {0x160dc[20](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:21)?, 0x487201?, 0x2d0a420?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/client.go:252 +0x5d8
net/http.(*Client).send(0xc0020f8ae0, 0xc00162c100, {0x730000c00[21](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:22)3[23](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:24)c6?, 0x0?, 0x2d0a420?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/client.go:176 +0x9b
net/http.(*Client).do(0xc0020f8ae0, 0xc00162c100)
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/client.go:725 +0x8f5
net/http.(*Client).Do(...)
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/client.go:593
github.com/google/go-github/v45/github.(*Client).BareDo(0xc00009a500, {0x1d1e0c0, 0xc00012e000}, 0xc000c79d00)
	/home/runner/go/pkg/mod/github.com/google/go-github/[email protected]/github/github.go:643 +0x2bf
github.com/google/go-github/v45/github.(*Client).Do(0xc00009a500?, {0x1d1e0c0?, 0xc00012e000?}, 0xc002132380?, {0x135c2c0?, 0xc00210b830})
	/home/runner/go/pkg/mod/github.com/google/go-github/[email protected]/github/github.go:707 +0x79
github.com/google/go-github/v45/github.(*PullRequestsService).List(0xc00009a678, {0x1d1e0c0, 0xc00012e000}, {0xc00004a1f2?, 0x0?}, {0xc00004a1fb, 0x7}, 0xc0019fcc60?)
	/home/runner/go/pkg/mod/github.com/google/go-github/[email protected]/github/pulls.go:160 +0x158
github.com/k1LoW/octocov/gh.(*Gh).DetectCurrentPullRequestNumber(0xc001a0caa0, {0x1d1e0c0, 0xc00012e000}, {0xc00004a1f2, 0x8}, {0xc00004a1fb, 0x7})
	/home/runner/work/octocov/octocov/gh/gh.go:[24](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:25)7 +0x172
github.com/k1LoW/octocov/config.(*Config).CommentConfigReady(0xc001517b00)
	/home/runner/work/octocov/octocov/config/ready.go:77 +0xd4
github.com/k1LoW/octocov/cmd.glob..func7(0x2b11940?, {0x2d411f8?, 0x0?, 0x0?})
	/home/runner/work/octocov/octocov/cmd/root.go:332 +0xfd0
github.com/spf13/cobra.(*Command).execute(0x2b11940, {0xc0001021e0, 0x0, 0x0})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:872 +0x694
github.com/spf13/cobra.(*Command).ExecuteC(0x2b11940)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:990 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:918
github.com/k1LoW/octocov/cmd.Execute()
	/home/runner/work/octocov/octocov/cmd/root.go:500 +0xdb
main.main()
	/home/runner/work/octocov/octocov/main.go:48 +0x33

goroutine 4 [select]:
go.opencensus.io/stats/view.(*worker).start(0xc0001a7c00)
	/home/runner/go/pkg/mod/[email protected]/stats/view/worker.go:276 +0xad
created by go.opencensus.io/stats/view.init.0
	/home/runner/go/pkg/mod/[email protected]/stats/view/worker.go:34 +0x8d

goroutine 23 [select]:
github.com/lestrrat-go/backoff/v2.(*controller).loop(0xc0011c22a0)
	/home/runner/go/pkg/mod/github.com/lestrrat-go/backoff/[email protected]/controller.go:52 +0xbc
created by github.com/lestrrat-go/backoff/v2.newController
	/home/runner/go/pkg/mod/github.com/lestrrat-go/backoff/[email protected]/controller.go:46 +0x236

goroutine 9 [select]:
github.com/lestrrat-go/backoff/v2.(*controller).loop(0xc0019fc480)
	/home/runner/go/pkg/mod/github.com/lestrrat-go/backoff/[email protected]/controller.go:52 +0xbc
created by github.com/lestrrat-go/backoff/v2.newController
	/home/runner/go/pkg/mod/github.com/lestrrat-go/backoff/[email protected]/controller.go:46 +0x236

goroutine 7 [IO wait]:
internal/poll.runtime_pollWait(0x7f5ca5f1eb18, 0x72)
	/opt/hostedtoolcache/go/1.18.5/x64/src/runtime/netpoll.go:302 +0x89
internal/poll.(*pollDesc).wait(0xc001750e00?, 0xc001820000?, 0x0)
	/opt/hostedtoolcache/go/1.18.5/x64/src/internal/poll/fd_poll_runtime.go:83 +0x32
internal/poll.(*pollDesc).waitRead(...)
	/opt/hostedtoolcache/go/1.18.5/x64/src/internal/poll/fd_poll_runtime.go:88
internal/poll.(*FD).Read(0xc001750e00, {0xc001820000, 0xe58, 0xe58})
	/opt/hostedtoolcache/go/1.18.5/x64/src/internal/poll/fd_unix.go:167 +0x[25](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:26)a
net.(*netFD).Read(0xc001750e00, {0xc001820000?, 0xc0010366c0?, 0xc001820005?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/fd_posix.go:55 +0x29
net.(*conn).Read(0xc000010080, {0xc001820000?, 0x58?, 0x7f5cd3d0a108?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/net.go:183 +0x45
crypto/tls.(*atLeastReader).Read(0xc000c72930, {0xc001820000?, 0x0?, 0x15c95a0?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/crypto/tls/conn.go:785 +0x3d
bytes.(*Buffer).ReadFrom(0xc0012f4cf8, {0x1d108e0, 0xc000c72930})
	/opt/hostedtoolcache/go/1.18.5/x64/src/bytes/buffer.go:204 +0x98
crypto/tls.(*Conn).readFromUntil(0xc0012f4a80, {0x1d13d80?, 0xc000010080}, 0x72?)
	/opt/hostedtoolcache/go/1.18.5/x64/src/crypto/tls/conn.go:807 +0xe5
crypto/tls.(*Conn).readRecordOrCCS(0xc0012f4a80, 0x0)
	/opt/hostedtoolcache/go/1.18.5/x64/src/crypto/tls/conn.go:614 +0x116
crypto/tls.(*Conn).readRecord(...)
	/opt/hostedtoolcache/go/1.18.5/x64/src/crypto/tls/conn.go:582
crypto/tls.(*Conn).Read(0xc0012f4a80, {0xc001821000, 0x1000, 0x0?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/crypto/tls/conn.go:1[28](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:29)5 +0x16f
net/http.(*persistConn).Read(0xc00110c7e0, {0xc001821000?, 0xc0015ff380?, 0xc00007bd30?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/transport.go:19[29](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:30) +0x4e
bufio.(*Reader).fill(0xc0019fc240)
	/opt/hostedtoolcache/go/1.18.5/x64/src/bufio/bufio.go:106 +0x103
bufio.(*Reader).Peek(0xc0019fc240, 0x1)
	/opt/hostedtoolcache/go/1.18.5/x64/src/bufio/bufio.go:144 +0x5d
net/http.(*persistConn).readLoop(0xc00110c7e0)
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/transport.go:2093 +0x1ac
created by net/http.(*Transport).dialConn
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/transport.go:1750 +0x173e

goroutine 8 [select]:
net/http.(*persistConn).writeLoop(0xc00110c7e0)
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/transport.go:2392 +0xf5
created by net/http.(*Transport).dialConn
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/transport.go:1751 +0x1791

goroutine 36 [IO wait]:
internal/poll.runtime_pollWait(0x7f5ca5f1ea28, 0x72)
	/opt/hostedtoolcache/go/1.18.5/x64/src/runtime/netpoll.go:[30](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:31)2 +0x89
internal/poll.(*pollDesc).wait(0xc001750f80?, 0xc001a90000?, 0x0)
	/opt/hostedtoolcache/go/1.18.5/x64/src/internal/poll/fd_poll_runtime.go:83 +0x32
internal/poll.(*pollDesc).waitRead(...)
	/opt/hostedtoolcache/go/1.18.5/x64/src/internal/poll/fd_poll_runtime.go:88
internal/poll.(*FD).Read(0xc001750f80, {0xc001a90000, 0xe58, 0xe58})
	/opt/hostedtoolcache/go/1.18.5/x64/src/internal/poll/fd_unix.go:167 +0x25a
net.(*netFD).Read(0xc001750f80, {0xc001a90000?, 0xc0017455e0?, 0xc001a90005?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/fd_posix.go:55 +0x29
net.(*conn).Read(0xc000123a48, {0xc001a90000?, 0x58?, 0x7f5cd3d0a5b8?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/net.go:183 +0x45
crypto/tls.(*atLeastReader).Read(0xc0019c9ad0, {0xc001a90000?, 0x0?, 0x15c95a0?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/crypto/tls/conn.go:785 +0x3d
bytes.(*Buffer).ReadFrom(0xc0010c05f8, {0x1d108e0, 0xc0019c9ad0})
	/opt/hostedtoolcache/go/1.18.5/x64/src/bytes/buffer.go:204 +0x98
crypto/tls.(*Conn).readFromUntil(0xc0010c0380, {0x1d13d80?, 0xc000123a48}, 0x2?)
	/opt/hostedtoolcache/go/1.18.5/x64/src/crypto/tls/conn.go:807 +0xe5
crypto/tls.(*Conn).readRecordOrCCS(0xc0010c0380, 0x0)
	/opt/hostedtoolcache/go/1.18.5/x64/src/crypto/tls/conn.go:614 +0x116
crypto/tls.(*Conn).readRecord(...)
	/opt/hostedtoolcache/go/1.18.5/x64/src/crypto/tls/conn.go:582
crypto/tls.(*Conn).Read(0xc0010c0380, {0xc001a91000, 0x1000, 0x0?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/crypto/tls/conn.go:1285 +0x16f
net/http.(*persistConn).Read(0xc00110c900, {0xc001a91000?, 0x448680?, 0xc000076ec8?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/transport.go:1929 +0x4e
bufio.(*Reader).fill(0xc001a8d200)
	/opt/hostedtoolcache/go/1.18.5/x64/src/bufio/bufio.go:106 +0x103
bufio.(*Reader).Peek(0xc001a8d200, 0x1)
	/opt/hostedtoolcache/go/1.18.5/x64/src/bufio/bufio.go:144 +0x5d
net/http.(*persistConn).readLoop(0xc00110c900)
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/transport.go:2093 +0x1ac
created by net/http.(*Transport).dialConn
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/transport.go:1750 +0x173e

goroutine 37 [select]:
net/http.(*persistConn).writeLoop(0xc00110c900)
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/transport.go:2392 +0xf5
created by net/http.(*Transport).dialConn
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/transport.go:1751 +0x1791

goroutine 40 [IO wait]:
internal/poll.runtime_pollWait(0x7f5ca5f1e938, 0x72)
	/opt/hostedtoolcache/go/1.18.5/x64/src/runtime/netpoll.go:302 +0x89
internal/poll.(*pollDesc).wait(0xc000188a00?, 0xc001aca000?, 0x0)
	/opt/hostedtoolcache/go/1.18.5/x64/src/internal/poll/fd_poll_runtime.go:83 +0x32
internal/poll.(*pollDesc).waitRead(...)
	/opt/hostedtoolcache/go/1.18.5/x64/src/internal/poll/fd_poll_runtime.go:88
internal/poll.(*FD).Read(0xc000188a00, {0xc001aca000, 0x4432, 0x4432})
	/opt/hostedtoolcache/go/1.18.5/x64/src/internal/poll/fd_unix.go:167 +0x25a
net.(*netFD).Read(0xc000188a00, {0xc001aca000?, 0xc001745860?, 0xc001acb34f?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/fd_posix.go:55 +0x29
net.(*conn).Read(0xc000123a70, {0xc001aca000?, 0x7fffe3007fffe2?, 0x1fffdc007fffe4?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/net.go:183 +0x45
crypto/tls.(*atLeastReader).Read(0xc000c73350, {0xc001aca000?, 0x0?, 0x34?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/crypto/tls/conn.go:785 +0x3d
bytes.(*Buffer).ReadFrom(0xc0010c1078, {0x1d108e0, 0xc000c73350})
	/opt/hostedtoolcache/go/1.18.5/x64/src/bytes/buffer.go:204 +0x98
crypto/tls.(*Conn).readFromUntil(0xc0010c0e00, {0x1d13d80?, 0xc000123a70}, 0x30f0?)
	/opt/hostedtoolcache/go/1.18.5/x64/src/crypto/tls/conn.go:807 +0xe5
crypto/tls.(*Conn).readRecordOrCCS(0xc0010c0e00, 0x0)
	/opt/hostedtoolcache/go/1.18.5/x64/src/crypto/tls/conn.go:614 +0x116
crypto/tls.(*Conn).readRecord(...)
	/opt/hostedtoolcache/go/1.18.5/x64/src/crypto/tls/conn.go:582
crypto/tls.(*Conn).Read(0xc0010c0e00, {0xc001ab7000, 0x1000, 0x74c6e0?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/crypto/tls/conn.go:1285 +0x16f
bufio.(*Reader).Read(0xc001ab4120, {0xc001a9e3c0, 0x9, 0x75aaa2?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/bufio/bufio.go:236 +0x1b4
io.ReadAtLeast({0x1d0f9a0, 0xc001ab4120}, {0xc001a9e3c0, 0x9, 0x9}, 0x9)
	/opt/hostedtoolcache/go/1.18.5/x64/src/io/io.go:3[31](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:32) +0x9a
io.ReadFull(...)
	/opt/hostedtoolcache/go/1.18.5/x64/src/io/io.go:350
net/http.http2readFrameHeader({0xc001a9e3c0?, 0x9?, 0xc0011fd920?}, {0x1d0f9a0?, 0xc001ab4120?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/h2_bundle.go:1566 +0x6e
net/http.(*http2Framer).ReadFrame(0xc001a9e380)
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/h2_bundle.go:1830 +0x95
net/http.(*http2clientConnReadLoop).run(0xc0011dbf98)
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/h2_bundle.go:8815 +0x130
net/http.(*http2ClientConn).readLoop(0xc0011fe300)
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/h2_bundle.go:8711 +0x6f
created by net/http.(*http2Transport).newClientConn
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/h2_bundle.go:7439 +0xa65

goroutine 16 [select]:
net/http.setRequestCancel.func4()
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/client.go:398 +0x8b
created by net/http.setRequestCancel
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/client.go:397 +0x439

goroutine 50 [select]:
net.(*Resolver).lookupIPAddr(0x2d09220, {0x1d1e0f8?, 0xc0019fcfc0}, {0x16497a4, 0x3}, {0xc0018d7c50, 0xe})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/lookup.go:[32](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:33)5 +0x51b
net.(*Resolver).internetAddrList(0x1d1e0f8?, {0x1d1e0f8?, 0xc0019fcfc0?}, {0x16497a4, 0x3}, {0xc0018d7c50?, 0x12?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/ipsock.go:288 +0x67a
net.(*Resolver).resolveAddrList(0x2d411f8?, {0x1d1e0f8, 0xc0019fcfc0}, {0x164fbb1, 0x4}, {0x16497a4?, 0x0?}, {0xc0018d7c50, 0x12}, {0x0, ...})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/dial.go:221 +0x41b
net.(*Dialer).DialContext(0xc0019fcc00, {0x1d1e0c0, 0xc00012e000}, {0x16497a4, 0x3}, {0xc0018d7c50, 0x12})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/dial.go:406 +0x448
net.(*Dialer).Dial(0x7f5ca4ee2418?, {0x16497a4?, 0x5cd3d0a108?}, {0xc0018d7c50?, 0x118?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/dial.go:[35](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:36)1 +0x45
net/http.(*Transport).dial(0x0?, {0x1d1e0f8?, 0xc0019fcd20?}, {0x16497a4?, 0x2?}, {0xc0018d7c50?, 0x0?})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/transport.go:1172 +0x5a
net/http.(*Transport).dialConn(0xc001018500, {0x1d1e0f8, 0xc0019fcd20}, {{}, 0x0, {0xc0021323c0, 0x5}, {0xc0018d7c50, 0x12}, 0x0})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/transport.go:1607 +0x83f
net/http.(*Transport).dialConnFor(0xc0019899[40](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:41)?, 0xc000c7d810)
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/transport.go:1449 +0xb0
created by net/http.(*Transport).queueForDial
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/http/transport.go:1[41](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:42)8 +0x3d2

goroutine 51 [select]:
net.cgoLookupIP({0x1d1e088, 0xc002159800}, {0x16497a4, 0x3}, {0xc0018d7c50, 0xe})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/cgo_unix.go:228 +0x1aa
net.(*Resolver).lookupIP(0x2d09220, {0x1d1e088, 0xc002159800}, {0x16497a4, 0x3}, {0xc0018d7c50, 0xe})
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/lookup_unix.go:96 +0x128
net.glob..func1({0x1d1e088?, 0xc002159800?}, 0x0?, {0x16497a4?, 0x2d0a[42](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:43)0?}, {0xc0018d7c[50](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:51)?, 0x77[59](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:60)70?})
	/opt/hostedtoolcache/go/1.18.5/x[64](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:65)/src/net/hook.go:23 +0x3d
net.(*Resolver).lookupIPAddr.func1()
	/opt/hostedtoolcache/go/1.18.5/x64/src/net/lookup.go:319 +0x9f
internal/singleflight.(*Group).doCall(0x2d09230, 0xc002104c30, {0xc0018d7c[68](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:69), 0x12}, 0xc000c7d[81](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:82)0?)
	/opt/hostedtoolcache/go/1.18.5/x64/src/internal/singleflight/singleflight.go:95 +0x3b
created by internal/singleflight.(*Group).DoChan
	/opt/hostedtoolcache/go/1.18.5/x64/src/internal/singleflight/singleflight.go:[88](https://github.com/xxxxxxxxxx/runs/8129049326?check_suite_focus=true#step:11:89) +0x2ec

Other configs

test.yml

...
      - name: Run tests
        shell: bash
        run: |
          go test --tags github_test ./pkg/... -coverprofile=coverage.out
      - name: Show coverage
        uses: k1LoW/octocov-action@v0

.octocov.yml

coverage:
  if: true
codeToTestRatio:
  code:
    - '**/*.go'
    - '!**/*_test.go'
  test:
    - '**/*_test.go'
testExecutionTime:
  if: true
diff:
  datastores:
    - artifact://${GITHUB_REPOSITORY}
comment:
  if: is_pull_request
report:
  if: is_default_branch
  datastores:
    - artifact://${GITHUB_REPOSITORY}

`Gh.DetectCurrentBranch` returns wrong string when current branch name contains slash

I'm using octocov from Github Actions and want to add reports to Actions Job Summaries.
I found an issue below:

Gh.DetectCurrentBranch parses $GITHUB_REF and return 3rd element of splitted slice.

octocov/gh/gh.go

Lines 229 to 231 in fb8298c

if strings.Contains(os.Getenv("GITHUB_REF"), "refs/heads/") {
return splitted[2], nil
}

But branch name can be contains slash. Given that branch name is issue/123, then $GITHUB_REF will be refs/heads/issue/123, so Gh.DetectCurrentBranch returns wrong branch name (issue), and finally createReportContent fail.

[UPDATE NOTICE] Change the Artifact API used by octocov to use the same one as actions/upload-artifact@v4 as far as possible.

Hello all octocov users :octocat:

The Artifact API used by octocov will also be updated with the following update from GitHub.

https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions/

The update policy is as follows.

Environment Current Next
GitHub.com Same API as actions/upload-artifact@v3 Same API as actions/upload-artifact@v4
GitHub Enterprise Cloud Same API as actions/upload-artifact@v3 Same API as actions/upload-artifact@v4
GitHub Enterprise Server Same API as actions/upload-artifact@v3 Same API as actions/upload-artifact@v3

This update will be applied in the near future without waiting for a deprecation on the GitHub side.

Note if octocov and actions/download-artifact are working together.

Also, we plan to provide a way to force the use of the same API as v3.

Thank you 🐙

Add the installation guide with aqua to the document

Hi, thank you for your great project!

We suggest to add the installation guide with aqua to the document.
aqua is a declarative CLI Version Manager.
You can install this tool with aqua.

aqua init # Create aqua.yaml
aqua g -i k1LoW/octocov # Add this tool to aqua.yaml
aqua i # Install tools

For the detail of aqua, please see the official document.

We expect you can just copy and paste the following guide to your document.


Install with aqua

You can install this tool with aqua.

aqua g -i k1LoW/octocov # Add k1LoW/octocov to aqua.yaml

Thank you.

This issue was created automatically by script. For the detail, please see here.

unable to fetch result from a private repo under the same org in central mode.

Central Repo Config
.octocov.yml

timeout: 60sec
central:
  reports:
    datastores:
      - artifact://org/repo-1
      - artifact://org/repo-2
  push:
    enable: true
  reReport:
    enable: true
  summary:
    if: true

Repo-1 Config
.octocov.yml

codeToTestRatio:
  code:
    - '**/*.go'
    - '!**/*_test.go'
  test:
    - '**/*_test.go'
diff:
  datastores:
    - artifact://${GITHUB_REPOSITORY}
push:
  if: is_default_branch
comment:
  if: is_pull_request
summary:
  if: true
report:
  if: is_default_branch
  datastores:
    - artifact://${GITHUB_REPOSITORY}

No Error in the Logs but the readme gets updated with a blank result -
Screenshot 2023-11-02 at 6 57 54 PM

Add an option to specify files to be excluded from coverage aggregation

Hi, thanks for the great project.

Starting with Go 1.22, the coverage report output will change for code that does not have its own tests.

https://tip.golang.org/doc/go1.22#go-command

go test -cover now prints coverage summaries for covered packages that do not have their own test files. Prior to Go 1.22 a go test -cover run for such a package would report

? mymod/mypack [no test files]

and now with Go 1.22, functions in the package are treated as uncovered:

mymod/mypack coverage: 0.0% of statements

For example, the report output for this project will change as follows:

$ go version
go version go1.22rc2 darwin/arm64

$ go test ./cmd/ -coverprofile=coverage.out
	github.com/k1LoW/octocov/cmd		coverage: 0.0% of statements

$ cat coverage.out
mode: set
github.com/k1LoW/octocov/cmd/badge.go:54.54,57.44 3 0
github.com/k1LoW/octocov/cmd/badge.go:57.44,59.4 1 0
github.com/k1LoW/octocov/cmd/badge.go:60.3,63.17 3 0
github.com/k1LoW/octocov/cmd/badge.go:63.17,65.4 1 0
github.com/k1LoW/octocov/cmd/badge.go:67.3,68.20 2 0
github.com/k1LoW/octocov/cmd/badge.go:68.20,70.18 2 0
github.com/k1LoW/octocov/cmd/badge.go:70.18,72.5 1 0
github.com/k1LoW/octocov/cmd/badge.go:73.4,73.17 1 0
...

Many projects will see unintended coverage drops due to this change.
However, it is difficult to mechanically distinguish between "code without intentionally written tests" and "code with poorly written tests" based on the information in the report alone.

So I want to add a new option to the .octocov.yml configuration file. That is, add the following exclude option, such as:

coverage:
  if: true
  acceptable: current >= 60%
  exclude:
    - "github.com/k1LoW/octocov/cmd/*.go"

In the above example, lines matching "github.com/k1LoW/octocov/cmd/*.go" are excluded from coverage aggregation.

I believe this idea will make this project better. Please consider it.

Thank you.

"Error: env ACTIONS_RUNTIME_URL is only available from the context of an action" occurred on GHES

We using octocov on GHES and self hosted runner (macOS).

This error occurs is in the report upload.

Storing report...
Error: env ACTIONS_RUNTIME_URL is only available from the context of an action
Error: Process completed with exit code 1.

Can we give or substitute the ACTIONS_RUNTIME_URL in our environment?

workflow:

run: |
  gh release download --repo github.com/k1LoW/octocov --pattern "*darwin_amd64.zip"
  unzip -d octocov octocov*.zip
  ./octocov/octocov

Environment variable being set:

  • GITHUB_API_URL
  • GITHUB_TOKEN

.octocov:

report:
  if: is_default_branch
  datastores:
    - artifact://${GITHUB_REPOSITORY}

Coverage calculation results have changed since v0.57.0

When using v0.57.0, gocover's coverage calculation results are lower than v0.56.x.
For example, v0.56.4 is used for test data from this repository, the coverage would be as follows:

~/ghq/github.com/k1LoW/octocov/coverage/testdata/gocover main
❯ octocov -v
octocov version 0.56.4

~/ghq/github.com/k1LoW/octocov/coverage/testdata/gocover main
❯ octocov -r coverage.out

            main (faa6ab0)
----------------------------
  Coverage           68.0%

But with v0.57.0, the coverage would be as follows:

~/ghq/github.com/k1LoW/octocov/coverage/testdata/gocover main
❯ octocov -v
octocov version 0.57.0

~/ghq/github.com/k1LoW/octocov/coverage/testdata/gocover main
❯ octocov -r coverage.out

            main (faa6ab0)
----------------------------
  Coverage           65.1%

I thin the problem is caused by the (*Coverage).reCalc() method being called.

func (c *Coverage) reCalc() error {
total := 0
covered := 0
for _, f := range c.Files {
lcs := f.Blocks.ToLineCoverages()
f.Total = lcs.Total()
f.Covered = lcs.Covered()
total += f.Total
covered += f.Covered
}
c.Total = total
c.Covered = covered
return nil
}

This method calculates file coverage from line coverage. However, this approach is not appropriate because the coverage representation of gocover is different from other formats.

For example, in the following block, the value of "numberOfStatements" is 1 for lines 45 through 47, so the number of rows to be recorded is 1, not 3.

github.com/k1LoW/tbls/dict/dict.go:45.23,47.3 1 2

However, if the (BlockCoverages).ToLineCoverages() method is called, the line coverage for this block is counted as 3.

Environment variables required by GHES differ from error message

Conditions

  • octocov version 0.46.0
  • GHES and self hosted runner (macOS, Ubuntu)
  • Set environment variables: GH_HOST, GITHUB_API_URL, GITHUB_GRAPHQL_URL

push on central mode

Error occurred when Set push in .octocov

octocov version 0.46.0
Central mode enabled
Collect report of orga/repo
Collect report of orga/repo
Error: env GITHUB_TOKEN is not set
Error: Process completed with exit code 1.

However, what was needed was GITHUB_ENTERPRISE_TOKEN.

Hope to fix the message or add a note to the README.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.