add covr testing via GitHub Actions #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check, build, and test | |
on: | |
push: | |
branches: | |
- devel | |
# paths: | |
# - DESCRIPTION | |
pull_request: | |
branches: | |
- devel | |
env: | |
cache-version: v1 | |
jobs: | |
r-build-and-check: | |
runs-on: ubuntu-latest | |
container: bioconductor/bioconductor_docker:devel | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: TRUE | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
CRAN: https://packagemanager.posit.co/cran/__linux__/jammy/latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Query dependencies and update old packages | |
run: | | |
BiocManager::install(ask=FALSE) | |
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) | |
shell: Rscript {0} | |
- name: Cache R packages | |
if: runner.os != 'Windows' | |
uses: actions/cache@v4 | |
with: | |
path: /usr/local/lib/R/site-library | |
key: ${{ env.cache-version }}-${{ runner.os }}-r-${{ hashFiles('.github/depends.Rds') }} | |
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-r- | |
- name: Install dependencies | |
run: | | |
BiocManager::repositories() | |
remotes::install_deps(dependencies = TRUE, repos = BiocManager::repositories()) | |
remotes::install_cran(c("rcmdcheck", "covr")) | |
shell: Rscript {0} | |
- name: Check | |
env: | |
_R_CHECK_CRAN_INCOMING_REMOTE_: false | |
run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "warning", check_dir = "check") | |
shell: Rscript {0} | |
- name: Test coverage | |
run: | | |
covr::codecov( | |
quiet = FALSE, | |
clean = FALSE, | |
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") | |
) | |
shell: Rscript {0} | |
- name: Show output | |
if: always() | |
run: | | |
find ${{ runner.temp }}/package -name 'tinytest.Rout*' -exec cat '{}' \; || true | |
shell: bash | |
- name: Upload test results | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-test-failures | |
path: ${{ runner.temp }}/package |