{"id":20414481,"url":"https://github.com/codecov/codecov-ats","last_synced_at":"2025-04-12T16:45:23.161Z","repository":{"id":196112206,"uuid":"691790679","full_name":"codecov/codecov-ats","owner":"codecov","description":"GitHub Action that uploads returns selected test labels to CI ☂️","archived":false,"fork":false,"pushed_at":"2024-11-13T19:36:04.000Z","size":26098,"stargazers_count":3,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-13T20:29:14.791Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codecov.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":"2023-09-14T22:40:01.000Z","updated_at":"2024-11-04T15:12:40.000Z","dependencies_parsed_at":"2023-10-17T05:56:12.752Z","dependency_job_id":"aba74b30-4807-4072-aa1e-c2d8d9f8f8c3","html_url":"https://github.com/codecov/codecov-ats","commit_stats":null,"previous_names":["codecov/codecov-ats"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecov%2Fcodecov-ats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecov%2Fcodecov-ats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecov%2Fcodecov-ats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecov%2Fcodecov-ats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codecov","download_url":"https://codeload.github.com/codecov/codecov-ats/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224737104,"owners_count":17361345,"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-15T06:10:17.906Z","updated_at":"2024-11-15T06:10:18.727Z","avatar_url":"https://github.com/codecov.png","language":"Shell","readme":"# codecov-ats\nGitHub Action that uploads returns selected test labels to CI ☂️\n\nThis Action is currently in beta. Currently, it has only been tested on `linux` and `macos` builds using `python` and `pytest`.\n\nIf you have feedback or issues with running this action, please don't hesitate to let us know by creating a Github Issue against this repo.\n\n### Usage\n1. Update the `checkout` step in GitHub actions to include `fetch-depth: 0`\n\n```\n      - name: Checkout\n        uses: actions/checkout@v4\n        with:\n          fetch-depth: 0\n```\n\n2. Add in `CODECOV_TOKEN` and `CODECOV_STATIC_TOKEN` secrets from the Codecov UI to GitHub.\nYou can find the `CODECOV_STATIC_TOKEN` as the `Static analysis token`\n\nSet the Static analysis token to `CODECOV_STATIC_TOKEN` in your repository secrets.\n\n3. Update your `codecov.yml` by adding the following\n\n```yaml\nflag_management:\n  individual_flags:\n    - name: smart-tests\n      carryforward: true\n      carryforward_mode: \"labels\"\n      statuses:\n        - type: \"project\"\n        - type: \"patch\"\n\ncli:\n  plugins:\n    pycoverage:\n      report_type: \"json\"\n```\n\n4. If `pytest-cov` is not a dependency, add it to your `requirements.txt` file, or run the following after you install your python dependencies in your GitHub Actions workflow.\n\n```yaml\n- name: Install pytest\n  run: pip install pytest-cov\n```\n\n5. Add the Codecov ATS Action to your CI. This should happen after you install python dependencies, but before you run tests.\nThis action will populate files in `codecov_ats` folder with the tests to run.\n\n```yaml\n- name: Run ATS\n  uses: codecov/codecov-ats@v0\n  env:\n    CODECOV_STATIC_TOKEN: ${{ secrets.CODECOV_STATIC_TOKEN }}\n    CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}\n# This is an example, do not copy below.\n# - name: Run tests.\n#   run: pytest ...\n```\n\n6. Update your `pytest` run to include the tests selected from ATS. You will read the list of tests that were selected to run by ATS.\nThese tests are exported to `codecov_ats/tests_to_run.txt`. Skips running tests if no tests were selected.\n(You can copy the same step and use the `codecov_ats/tests_to_skip.txt` file to run the tests selected to be skipped)\n\n```yaml\n- name: Run tests and collect coverage\n  run: |\n    cat codecov_ats/tests_to_run.txt | xargs pytest --cov app\n```\n\n1. If you are not already using the Codecov CLI to upload coverage, you can update the Codecov Action to `v4-beta`\n\n```yaml\n- name: Upload coverage to Codecov\n  uses: codecov/codecov-action@v4-beta\n  env:\n    CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}\n  with:\n    flags: smart-tests\n    plugins: pycoverage,compress-pycoverage\n```\n\n8. Run your CI! On your first run, Codecov will not have any labels data and will have to run all tests. However, once all following commits or pull requests are rebased on top of this commit, you should be able to see the benefits of ATS.\n\n### Output\n\nThis action creates a `codecov_ats` folder in the current directory and populates it with 3 files:\n1. `codecov_ats/tests_to_run.json` - List of tests selected by Automated Test Selection that should be executed\n2. `codecov_ats/tests_to_skip.json` - List of tests that are being skiped\n3. `codecov_ats/result.json` - Summary of results for test selection","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecov%2Fcodecov-ats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodecov%2Fcodecov-ats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecov%2Fcodecov-ats/lists"}