{"id":20338243,"url":"https://github.com/openclassrooms/coverage-checker","last_synced_at":"2025-04-11T23:11:30.373Z","repository":{"id":45067027,"uuid":"363884958","full_name":"OpenClassrooms/coverage-checker","owner":"OpenClassrooms","description":"Github action to check coverage","archived":false,"fork":false,"pushed_at":"2024-07-16T10:07:49.000Z","size":250,"stargazers_count":4,"open_issues_count":2,"forks_count":4,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-04-11T23:11:26.922Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpenClassrooms.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-03T09:53:52.000Z","updated_at":"2024-07-16T09:03:54.000Z","dependencies_parsed_at":"2023-01-19T05:30:31.287Z","dependency_job_id":null,"html_url":"https://github.com/OpenClassrooms/coverage-checker","commit_stats":{"total_commits":19,"total_committers":6,"mean_commits":"3.1666666666666665","dds":"0.42105263157894735","last_synced_commit":"6fbcfa22751c489d53a9d9413f125dd1f7f6a987"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenClassrooms%2Fcoverage-checker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenClassrooms%2Fcoverage-checker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenClassrooms%2Fcoverage-checker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenClassrooms%2Fcoverage-checker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenClassrooms","download_url":"https://codeload.github.com/OpenClassrooms/coverage-checker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248492868,"owners_count":21113163,"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":[],"created_at":"2024-11-14T21:12:10.342Z","updated_at":"2025-04-11T23:11:30.357Z","avatar_url":"https://github.com/OpenClassrooms.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# coverage-checker\n\nA Github action to check if you didn't degrade your code coverage.\n\n## Description\n\nThis action is split into two actions :\n\n| Context | Action | Description |\n|---------|--------|-------------|\n| Push on main branch | update | By configuring the \"update\" action to be ran on pushes to your main branch, it will parse your clover file, generate a JSON containing interesting metrics, and push it to a branch named _coverage_. You'll benefit from the natural commits history to track the evolution of your overall coverage.\n| Pull request | check | By configuring the \"check\" action to be ran on pull requests, it will get the main branch's coverage, located in the _coverage_ branch, and compare it to your pull request's coverage. A report will be posted as a comment on your pull request, and the action will fail if the coverage has been degraded.\n\n\n![Workflow diagram](./doc/github-action.png)\n\n## The actions\n\n### Update\n\nThe update process is the one used to update coverage report for the main branch of the project. After calculation, it pushes results to a dedicated `coverage` branch.\n\n**Here is an exemple of how to use it (on a php project) :**\n\n```yaml\nname: Coverage update\non:\n  push:\n    branches:\n      - main\njobs:\n  coverage_update:\n    runs-on: ubuntu-lastest\n    steps:\n      - uses: actions/checkout@v2\n      - name: Install dependencies\n        run: composer install --prefer-dist --no-progress --no-suggest\n      - name: Run test suite\n        run: make test\n      - name: Coverage update\n        uses: OpenClassrooms/coverage-checker@v1.0.0\n        with:\n          token: ${{ secrets.GITHUB_TOKEN }}\n          action: update\n```\n\u003e Note that the `Run test suite` step will generate a [`clover` file containing the coverage information](https://openclover.org/documentation). This action will use this file to generate the report.\n\n#### Badge generation\n\nIf a \"badge\" property is defined in the configuration, the update action will generate an SVG badge and commit it in the coverage branch.\n\n#### Coverage history\n\nA file named `coverage-history.json`, persisted in the coverage branch, will be updated at each base coverage update. By querying it and using it in a visualization tool, you'll be able to share metrics regarding your coverage history easily. \n\n### Check\n\n```yaml\nname: Coverage check\non: [pull_request]\njobs:\n  coverage_check:\n    runs-on: ubuntu-lastest\n    steps:\n      - uses: actions/checkout@v2\n      - name: Install dependencies\n        run: composer install --prefer-dist --no-progress --no-suggest\n      - name: Run test suite\n        run: make test\n      - name: Coverage check\n        uses: OpenClassrooms/coverage-checker@v1.0.0\n        with:\n          token: ${{ secrets.GITHUB_TOKEN }}\n          action: check\n```\n\nThe output of this action is a comment on the PR to simply see if the coverage has been degraded or not, and an action failure in case of degradation.\n\n![Workflow diagram](./doc/success.png)\n\n![Workflow diagram](./doc/failure.png)\n\n## Configuration reference\n\n| Parameter | Required | Default    | Comment |\n|-----------|----------|------------|---------|\n| `token`   | Yes      | No default | The action token. Will be used to push or read from _coverage_ branch |\n| `action`  | No       | `update`   | The action to be executed. Either `update` or `check` |\n| `files`   | No       | `[{\"coverage\": \"coverage.xml\", \"summary\": \"coverage-summary.json\", \"label\": \"Coverage\", \"badge\": \"coverage.svg\"}]` | An array of objects representing the **clover** file that will be generated by your test suite, the **json** file and **SVG badge** that will be created by this action and uploaded to the `coverage` branch, and the label to display on reports and badges |\n\n## Contributing\n\n### Setup your dev env\n\nAfter having cloned the project, run `make install`, that will install dependencies, and [ncc](https://www.npmjs.com/package/@vercel/ncc) (required to compile code before pushing it).\n\n### Compile \u0026 commit\n\nCompile code before committing by running this command:\n`make`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenclassrooms%2Fcoverage-checker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenclassrooms%2Fcoverage-checker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenclassrooms%2Fcoverage-checker/lists"}