Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: use codecov badge depending on the current git branch #1087

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

ilyaZar
Copy link
Contributor

@ilyaZar ilyaZar commented Aug 9, 2023

Fix #1086

This PR implements a changing codecov status badge dependening on the current git-branch of the {golem} projects.

README.Rmd is altered to programmatically retrieve the current git branch and alter links to point to the correct coverage results from https://about.codecov.io/ for the svg-images and webpages.

- to clearly show what the testing coverage is on each branch via the
  badge
- `README.Rmd` is altered to programatically retrieve the current git
  branch which automatically uses the correct coverage results from https://about.codecov.io/

Refs: ThinkR-open#1086
@VincentGuyader
Copy link
Member

hi,

dont thinks It will works because we never push directly to master branch.
the readme.md file will come from another branch, no ?

@ilyaZar
Copy link
Contributor Author

ilyaZar commented Aug 9, 2023

hi,

@VincentGuyader hmm tricky.

I think it should work because the CI rebuilds README.Rmd which generates README.md on any branch.

e.g. on the current dev the codecov is 84% as generated via covr::package_covereage() whereas on the current master it is 69% and we see this in the "About"-readme section.

If this is the case, then the README.md is branch dependent. And then the only thing which is tricky is the CI finding the git branch via system("git symbolic-ref --short HEAD", intern = TRUE).

EDIT:

Maybe just try? I can fix any mistakes, it would be great to have different codecov-badges for dev and master really.

Do you mean the CI is not triggered when you merge from dev to master but rather you copy the file README.md (which comes from dev) directly in a merge?

@VincentGuyader
Copy link
Member

Actually, I was only talking about the GitHub homepage... I hadn't thought that you were referring to pkgdown, etc... so it's not that straightforward, let's try to find a way to have both?

It would indeed be cool to have different coverage based on the branch.

- when CI rebuilds README.Rmd it should also use the badge of the git-branch so the codecov gets an update
@ilyaZar
Copy link
Contributor Author

ilyaZar commented Aug 9, 2023

@VincentGuyader so breaking up the problem

  1. regarding the standard github page I tried the commit 51113f0

    • I just pushed a workflow that rebuilds the README.md from README.Rmd
    • it's taken from r-libs/actions/examples/render-rmarkdown.yaml with some modifications to only render the README.Rmd
    • it is probably not using the correct git configs i.e. there is to fill correctly:
          git config --local user.name "$GITHUB_ACTOR"
          git config --local user.email "[email protected]"
    

    at the bottom of the *.yaml

  2. regarding pkgdown: maybe it gets an automatic update from that as well but I have not had the time to look into this file yet

@ColinFay
Copy link
Member

Let's try and merge it to an intermediate branch

@ColinFay ColinFay changed the base branch from dev to test-for-gh February 28, 2024 15:26
@ColinFay ColinFay merged commit ae6c49c into ThinkR-open:test-for-gh Feb 28, 2024
5 checks passed
@ColinFay
Copy link
Member

I can confirm that it works, merging to dev soon

@ColinFay
Copy link
Member

Now in dev #1133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants