{"id":25986989,"url":"https://github.com/maxgio92/apkover","last_synced_at":"2025-03-05T12:47:26.394Z","repository":{"id":278552243,"uuid":"933357432","full_name":"maxgio92/apkover","owner":"maxgio92","description":"APKover is a tool to extract the coverage of a Wolfi package as the percentage of statements that are covered by the Melange tests.","archived":false,"fork":false,"pushed_at":"2025-02-27T17:04:04.000Z","size":1071,"stargazers_count":5,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T00:17:36.535Z","etag":null,"topics":["linux","package-development","testing-tools","wolfi-os"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxgio92.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-15T19:01:38.000Z","updated_at":"2025-02-27T17:04:04.000Z","dependencies_parsed_at":"2025-02-20T12:34:40.337Z","dependency_job_id":null,"html_url":"https://github.com/maxgio92/apkover","commit_stats":null,"previous_names":["maxgio92/apkover"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxgio92%2Fapkover","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxgio92%2Fapkover/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxgio92%2Fapkover/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxgio92%2Fapkover/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxgio92","download_url":"https://codeload.github.com/maxgio92/apkover/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242031304,"owners_count":20060579,"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":["linux","package-development","testing-tools","wolfi-os"],"created_at":"2025-03-05T12:47:25.603Z","updated_at":"2025-03-05T12:47:26.382Z","avatar_url":"https://github.com/maxgio92.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003e\u003cimg src=\"logo.svg\" alt=\"drawing\" style=\"width: 150px; vertical-align: middle\"/\u003eAPKover\u003c/h1\u003e\n\nAPKover is a tool to extract the coverage a Wolfi package as the percentage of statements of the packaged software\nthat are covered by the [Melange](https://github.com/chainguard-dev/melange/) tests.\n\nIt leverages the language specific instrumentation features to generate integration tests coverage,\nby re-building the package to enable the software measure the coverage data at runtime.\nFinally, it reports the overall package test coverage as a percentage to standard output.\n\nA minimum threshold can be set to make APKover exit 1 when a package does not meet the coverage criteria.\n\n```\nUsage:\n  apkover [flags]\n\nFlags:\n  -c, --config string      path to package config file\n      --fail-under float   The minimum accepted coverage, expressed as percentage (e.g. 80 for 80% of coverage). Fail if it's under the specified threshold.\n  -h, --help               help for apkover\n      --language string    main language of the package (default \"go\")\n      --log-level string   log level (default \"info\")\n  -o, --output string      output format (text, json, yaml) (default \"text\")\n```\n\n## Requirements\n- GNU `make`\n- [Melange](http://github.com/chainguard-dev/melange/)\n- A local copy of a [Wolfi packages repository](https://github.com/wolfi-dev/os/)\n\n## Quickstart\n\nSpecify a Wolfi package Melange config to the `--config` flag.\n\n```shell\n$ apkover --config wolfi-dev/os/crane.yaml\n2025-02-16T19:11:15+01:00 INF Updating the build pipeline to instrument the package package=crane\n2025-02-16T19:11:15+01:00 INF Updating the test pipeline to generate coverage data package=crane\n2025-02-16T19:11:15+01:00 INF Writing the package config to disk package=crane\n2025-02-16T19:11:15+01:00 INF Re-building the package instrumented package=crane steps=2\n2025-02-16T19:11:15+01:00 INF Running tests and writing coverage data package=crane steps=7\n\n Test Coverage: [█████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 14%\n```\n\n### Fail on low coverage\n\nNow imagine you want to ensure a package test coverage and you want a quality gate in continuous integration.\nYou can specify a minimum threshold as a percentage to the `--fail-under` CLI flag to make `apkover` exit 1 when the\ncoverage is below that percentage:\n\n```shell\n$ apkover --config wolfi-dev/os/crane.yaml --fail-under 20 2\u003e/dev/null\n\n Test Coverage: [█████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 14%\n\n❌ test coverage is below the minimum required\nexit status 1\n```\n\n### Monitoring the coverage over time\n\nThe coverage data can be easily consumed as metrics and monitored over time using machine readable formats like JSON:\n\n```shell\n$ apkover --config wolfi-dev/os/crane.yaml --output=json 2\u003e/dev/null | jq\n{\n  \"pkg_name\": \"crane\",\n  \"pkg_version\": \"0.20.3\",\n  \"pkg_epoch\": 2,\n  \"cov_float\": 0.14199999809265137\n}\n```\n\n## Support\n\n### Languages\n\nThe supported language now is:\n* `go`\n* `rust`\n\nSupport for additional language is yet to be implemented.\n\n#### Go\n\nAPKover leverages the Go [Coverage profiling support for integration tests](https://go.dev/doc/build-cover)\nto build the Go binary instrumented for measurement and coverage data analysis with the `covdata` Go tool.\n\n#### Rust\n\nAPKover leverages the [`llvm.instrprof.increment` LLVM intrinsic](https://llvm.org/docs/LangRef.html#llvm-instrprof-increment-intrinsic) to instrument the binary via the `rustc` `-C instrument-coverage` flag, and `llvm-profdata` and `llvm-cov` LLVM tools to merge coverage data and produce a report, respectively.\n\n### Packages\n\nCurrently only the main package of a Melange pipeline is supported.\n\nSupport for subpackages is yet to be implemented.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxgio92%2Fapkover","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxgio92%2Fapkover","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxgio92%2Fapkover/lists"}