Skip to content

Commit

Permalink
Update test-coverage.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielblain authored Jul 23, 2024
1 parent e261306 commit 82cf8ce
Showing 1 changed file with 47 additions and 17 deletions.
64 changes: 47 additions & 17 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,58 @@
name: Test Coverage
# Workflow derived from https://github.com/r-lib/actions/tree/v2/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]

on: [push, pull_request]
name: test-coverage

permissions: read-all

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- name: Set up R
uses: r-lib/actions/setup-r@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

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

- name: Install dependencies
- name: Test coverage
run: |
install.packages('remotes')
remotes::install_deps(dependencies = TRUE)
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}

- name: Run tests
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
R CMD build .
R CMD check *tar.gz
- name: Upload coverage to Codecov
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: Rscript -e 'covr::codecov()'
## --------------------------------------------------------------------
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

0 comments on commit 82cf8ce

Please sign in to comment.