Skip to content

Commit

Permalink
restore previous test-coverage.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
kadyb authored Nov 6, 2024
1 parent 6f5b362 commit ec18974
Showing 1 changed file with 28 additions and 44 deletions.
72 changes: 28 additions & 44 deletions .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,52 @@
# source: https://github.com/r-lib/actions/blob/master/examples/test-coverage.yaml

# test coverage is skipped for these functions:
# geonames_download, geodb_download, borders_download (too large file size)
# DEM_request, ortho_request (requests from GitHub are blocked)

# 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
name: test-coverage

on:
push:
branches: [main, master]
branches: [ master ]
pull_request:
branches: [main, master]

name: test-coverage

permissions: read-all
branches: [ master ]

jobs:
test-coverage:
runs-on: ubuntu-latest
runs-on: macOS-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-pandoc@v2

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

- name: Test coverage
- name: Query dependencies
run: |
skip_fun = c("geonames_download", "geodb_download", "borders_download",
"DEM_request", "ortho_request", "orto_request")
cov <- covr::package_coverage(
function_exclusions = skip_fun,
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- uses: codecov/codecov-action@v4
- name: Cache R packages
uses: actions/cache@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 }}
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Show testthat output
if: always()
- name: Install dependencies
run: |
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
options("pkgType" = "binary")
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("covr")
shell: Rscript {0}

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
- name: Test coverage
run: |
skip_fun = c("geonames_download", "geodb_download", "borders_download",
"DEM_request", "ortho_request", "orto_request")
covr::codecov(function_exclusions = skip_fun)
shell: Rscript {0}

0 comments on commit ec18974

Please sign in to comment.