Skip to content

Commit

Permalink
Switching coverage to coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
dazzimonti committed Oct 31, 2024
1 parent 97a2470 commit 2a3dd94
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 38 deletions.
60 changes: 25 additions & 35 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: test-coverage.yaml

permissions: read-all
name: test-coverage

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_TOKEN: ${{ secrets.COVERALLS_API }}
CI_BRANCH: "main"

steps:
- uses: actions/checkout@v4
Expand All @@ -25,37 +25,27 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr, any::xml2
needs: coverage
extra-packages: covr

- name: Test coverage
- name: Enable Repo on Coveralls
id: enable_coveralls
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
curl -s -H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: token $COVERALLS_TOKEN" \
-d '{"repo": {"service": "github","name": "'$GITHUB_REPOSITORY'"}}' \
-X POST https://coveralls.io/api/repos
- name: Get Coveralls Repo Token
id: get_coverall_repo_token
run: |
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
echo "COVERALLS_REPO_TOKEN=$(\
curl -s -H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: token $COVERALLS_TOKEN" \
https://coveralls.io/api/repos/github/$GITHUB_REPOSITORY \
| jq '.token')" >> $GITHUB_ENV
- name: Generate and Upload R Package Coverage
run: covr::coveralls(service_name='travis-pro', repo_token=${{ env.COVERALLS_REPO_TOKEN }}, type='all')
shell: Rscript {0}
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ knitr::opts_chunk$set(
[![](http://cranlogs.r-pkg.org/badges/grand-total/bayesRecon)](https://cran.r-project.org/package=bayesRecon)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![License: LGPL (>= 3)](https://img.shields.io/badge/license-LGPL (>= 3)-yellow.svg)](https://www.gnu.org/licences/lgpl-3.0)
[![Codecov test coverage](https://codecov.io/gh/IDSIA/bayesRecon/graph/badge.svg)](https://app.codecov.io/gh/IDSIA/bayesRecon)
[![coverage](https://coveralls.io/repos/github/IDSIA/bayesRecon/badge.svg)](https://coveralls.io/r/IDSIA/bayesRecon?branch=main)
<!-- badges: end -->

The package `bayesRecon` implements several methods for probabilistic reconciliation of hierarchical time series forecasts.
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ status](https://www.r-pkg.org/badges/version/bayesRecon)](https://CRAN.R-project
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![License: LGPL (\>=
3)](https://img.shields.io/badge/license-LGPL%20(%3E=%203)-yellow.svg)](https://www.gnu.org/licences/lgpl-3.0)
[![Codecov test
coverage](https://codecov.io/gh/IDSIA/bayesRecon/graph/badge.svg)](https://app.codecov.io/gh/IDSIA/bayesRecon)
[![coverage](https://coveralls.io/repos/github/IDSIA/bayesRecon/badge.svg)](https://coveralls.io/r/IDSIA/bayesRecon?branch=main)
<!-- badges: end -->

The package `bayesRecon` implements several methods for probabilistic
Expand Down

0 comments on commit 2a3dd94

Please sign in to comment.