{"id":17322091,"url":"https://github.com/newm4n/goornogo","last_synced_at":"2025-03-27T03:21:43.708Z","repository":{"id":57541855,"uuid":"292236126","full_name":"newm4n/goornogo","owner":"newm4n","description":"goornogo read `go test` report file and calculate the total coverage for the entire project. very useful to enforce coverage test in your pipeline","archived":false,"fork":false,"pushed_at":"2020-09-04T04:44:32.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T08:45:58.847Z","etag":null,"topics":["cli","coverage","go","golang","pipeline","test"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/newm4n.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-02T09:18:11.000Z","updated_at":"2024-09-19T09:47:04.000Z","dependencies_parsed_at":"2022-09-09T04:11:55.967Z","dependency_job_id":null,"html_url":"https://github.com/newm4n/goornogo","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newm4n%2Fgoornogo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newm4n%2Fgoornogo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newm4n%2Fgoornogo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newm4n%2Fgoornogo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/newm4n","download_url":"https://codeload.github.com/newm4n/goornogo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245773382,"owners_count":20669765,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","coverage","go","golang","pipeline","test"],"created_at":"2024-10-15T13:41:00.251Z","updated_at":"2025-03-27T03:21:43.686Z","avatar_url":"https://github.com/newm4n.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# goornogo\r\n\r\nGo Or No Go. Enforce coverage test in your golang project pipeline.\r\nGoornogo will calculate coverage percentage from all tested golang source\r\ncode getting tested by the `go test`, not package by package.\r\n \r\nIf your Go project meet minimum coverage percentage, \r\nthe pipeline will finish without error. Otherwise your build will fail.\r\n\r\n## Install\r\n\r\n```text\r\n$ go install github.com/newm4n/goornogo\r\n```\r\n\r\n## Usage in the pipeline\r\n\r\n```text\r\ngo test ./... -covermode=count -coverprofile=coverage.out\r\ngoornogo -i coverage.out -c 60\r\n```\r\n\r\nParams :\r\n\r\n- `i` path to coverage report file\r\n- `c` minimum coverage in percentage, 10 = 10%, 45.6 = 45.6% \r\n\r\nIf coverage is above minimum coverage, goornogo will exit with code 0.\r\nIf bellow the minimum coverage, it will exit with code 1, failing your pipeline.\r\n\r\n### Travis-CI\r\n\r\n```yaml\r\nlanguage: go\r\n\r\ngo:\r\n  - 1.13.x\r\n\r\nscript:\r\n  - go install github.com/newm4n/goornogo \r\n  - go test ./... -v -covermode=count -coverprofile=coverage.out\r\n  - goornogo -i coverage.out -c 45.3\r\n```\r\n\r\n### Circle-CI\r\n\r\n```yaml\r\nversion: 2\r\njobs:\r\n  build:\r\n    docker:\r\n      - image: circleci/golang:1.13\r\n\r\n    working_directory: /go/src/github.com/my/beautiful-project\r\n    steps:\r\n      - checkout\r\n\r\n      # specify any bash command here prefixed with `run: `\r\n      - run: go get -v -t -d ./...\r\n      - run: go install github.com/newm4n/goornogo\r\n      - run: go test ./... -v -covermode=count -coverprofile=coverage.out\r\n      - run: goornogo -i coverage.out -c 45.3\r\n```\r\n\r\n### Azure DevOps\r\n\r\n```yaml\r\ntrigger:\r\n  - master\r\n\r\nvariables:\r\n  GO111MODULE: 'on'\r\n  GOBIN:  '$(GOPATH)/bin' # Go binaries path\r\n  GOROOT: '/usr/local/go1.13' # Go installation path\r\n  GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path\r\n  modulePath: '$(GOPATH)/src/github.com/my/beautiful-project' # Path to the module's code\r\n\r\nsteps:\r\n  - script: |\r\n      mkdir -p '$(GOBIN)'\r\n      mkdir -p '$(GOPATH)/pkg'\r\n      mkdir -p '$(modulePath)'\r\n      shopt -s extglob\r\n      mv !(gopath) '$(modulePath)'\r\n      echo '##vso[task.prependpath]$(GOBIN)'\r\n      echo '##vso[task.prependpath]$(GOROOT)/bin'\r\n      echo '##vso[task.setvariable variable=path]$(PATH):$(GOBIN)'\r\n    displayName: 'Set up the Go workspace'\r\n  - script: go get -v -t -d ./...\r\n    workingDirectory: '$(modulePath)'\r\n    displayName: 'go get dependencies'\r\n  - script: go build -v ./...\r\n    workingDirectory: '$(modulePath)'\r\n    displayName: 'Build'\r\n  - script: |\r\n      go install github.com/newm4n/goornogo\r\n      go test ./... -v -covermode=count -coverprofile=coverage.out\r\n      goornogo -i coverage.out -c 45.3\r\n    workingDirectory: '$(modulePath)'\r\n    displayName: 'Run tests'\r\n```\r\n\r\n### Gitlab-CI\r\n\r\n```yaml\r\nimage: golang:1.13\r\n\r\nstages:\r\n  - build\r\n  - test\r\n\r\nbuild:\r\n  script:\r\n    - go build ./...\r\n\r\ntest:\r\n  script:\r\n    - go install github.com/newm4n/goornogo\r\n    - go test ./... -v -covermode=count -coverprofile=coverage.out\r\n    - goornogo -i coverage.out -c 45.3\r\n```\r\n\r\n### Github Action\r\n\r\n```yaml\r\non:\r\n  pull_request:\r\n    branches:\r\n      - master\r\njobs:\r\n  build:\r\n    runs-on: ubuntu-latest\r\n    steps:\r\n      - name: Install Go\r\n        uses: actions/setup-go@v2\r\n        with:\r\n          go-version: 1.13\r\n      - name: Checkout code\r\n        uses: actions/checkout@v2\r\n      - name: Fetching dependencies\r\n        run : go get -v -t -d ./...\r\n      - name: Install Goornogo\r\n        run : go install github.com/newm4n/goornogo\r\n      - name: Execute test\r\n        run : |\r\n          go test ./... -v -covermode=count -coverprofile=coverage.out\r\n          goornogo -i coverage.out -c 45.3\r\n```\r\n\r\n## How you do that ?\r\n\r\nGoornogo will read the produced coverage report file from `go test`.\r\nIt uses logic from [this code](https://github.com/golang/go/blob/2bc8d90fa21e9547aeb0f0ae775107dc8e05dc0a/src/cmd/cover/html.go#L96)\r\nand [this code](https://github.com/golang/go/blob/2bc8d90fa21e9547aeb0f0ae775107dc8e05dc0a/src/cmd/cover/profile.go#L56) to understand the format and how to calculate the percentage. \r\n\r\n## Twist\r\n\r\nThis tiny winny fluffy project talks about code-coverage. While itself don't have any.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnewm4n%2Fgoornogo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnewm4n%2Fgoornogo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnewm4n%2Fgoornogo/lists"}