In CS156, we have had the practice of transferring the project repos for legacy code projects from one course org to another, e.g

When this happens, codecov loses its context; i.e. there is no ‘baseline’ for calculating the difference in code coverage for subsequent PRs.

This causes symptoms such as these:

  • The badge reports an “unknown” status: image
  • CI/CD runs get stuck at the yellow dot like this: image

To remedy this, you can make a “dummy” commit, PR, and merge to establish the baseline, by taking these steps:

  1. Checkout a fresh copy of the main branch:
    git fetch
    git checkout main
    git pull origin main
    
  2. Create a new branch
    git checkout -b pc-dummyPRToEstablishCodeCovBaseline
    
  3. Make a dummy commit and push this to the branch
    git commit --allow-empty -m "pc - dummy commit, PR, and merge to establish baseline for codecov"
    git push origin pc-dummyPRToEstablishCodeCovBaseline
    
  4. Open a PR for this branch. Here’s a sample description:

    • Title: pc - dummy commit, PR, and merge to establish baseline for codecov
    • Description: ``` After moving a repo between owners (e.g. from one org to another) codecov can show some anomalies:
      • the coverage badge shows “unknown”, like this: image
      • the CI/CD pipeline for Codecov can get stuck, perseverating on the yellow dot, like this: image

      The fix is a PR such as this one.

      This PR contains no code changes; it contains only an empty commit. When merged into main, it will establish a new baseline on codecov so that:

      • the CI/CD pipeline for codecov gets unstuck for pending PRs
      • the badge for the new repo shows the correct coverage. ```
  5. Merge the PR
  6. Then, check the badge and the CI/CD runs. Note that you might also need to take these additional steps: