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 ee3970d commit e261306
Showing 1 changed file with 17 additions and 50 deletions.
67 changes: 17 additions & 50 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,61 +1,28 @@
# 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]
name: Test Coverage

name: test-coverage

permissions: read-all
on: [push, pull_request]

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

steps:
- 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
- uses: actions/checkout@v2
- name: Set up R
uses: r-lib/actions/setup-r@v2

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

0 comments on commit e261306

Please sign in to comment.