Skip to content

Commit

Permalink
Update R-CMD-check.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixErnst committed Mar 19, 2024
1 parent 833ec90 commit 7e52843
Showing 1 changed file with 46 additions and 57 deletions.
103 changes: 46 additions & 57 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,31 @@ jobs:

steps:

- name: Set R Library home on Linux
if: runner.os == 'Linux'
run: |
mkdir /__w/_temp/Library
echo ".libPaths('/__w/_temp/Library')" > ~/.Rprofile
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup R from r-lib
if: runner.os != 'Linux'
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}

- name: Setup pandoc from r-lib
if: runner.os != 'Linux'
uses: r-lib/actions/setup-pandoc@v2

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
shell: Rscript {0}
- name: Query dependencies from r-lib
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- name: Query dependencies from r-lib (Linux)
if: runner.os == 'Linux' && runner.r == '4.3'
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, any::covr, local::.
needs: website, coverage

- name: Restore R package cache
if: "!contains(github.event.head_commit.message, '/nocache') && runner.os != 'Linux'"
Expand All @@ -78,63 +78,52 @@ jobs:
key: ${{ env.cache-version }}-${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-r-${{ matrix.config.r }}-

- name: Install system dependencies
if: runner.os == 'ubuntu-22.04'
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"
- name: Install R dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
remotes::install_cran("pkgdown")
remotes::install_cran("covr")
shell: Rscript {0}

- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

- name: Run CMD check
env:
_R_CHECK_CRAN_INCOMING_: false
DISPLAY: 99.0
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Reveal testthat details
if: env.has_testthat == 'true'
run: find . -name testthat.Rout -exec cat '{}' ';'
- name: Run CMD check from r-lib
uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

- name: Test coverage
if: github.ref == 'refs/heads/master' && env.run_covr == 'true' && runner.os == 'ubuntu-22.04'
if: github.ref == 'refs/heads/master' && runner.os == 'Linux' && runner.r == '4.3'
run: |
covr::codecov(coverage = covr::package_coverage(type = "all"))
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
shell: Rscript {0}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload check results
if: failure()
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check

- name: Install package
if: github.ref == 'refs/heads/master' && runner.os == 'ubuntu-22.04' && runner.r == '4.3'
run: |
R CMD INSTALL .
git config --global user.name ${{secrets.GH_USER}}
git config --global user.email ${{secrets.GH_EMAIL}}
name: coverage-test-failures
path: ${{ runner.temp }}/package

- name: Deploy Pkgdown to branch
if: github.ref == 'refs/heads/master' && runner.os == 'ubuntu-22.04' && runner.r == '4.3'
run: pkgdown::deploy_to_branch(new_process = FALSE)
- name: Build with Pkgdown
if: github.ref == 'refs/heads/master' && runner.os == 'Linux' && runner.r == '4.3'
run: pkgdown::deploy_to_branch(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.ref == 'refs/heads/master' && runner.os == 'Linux' && runner.r == '4.3'
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
folder: docs

0 comments on commit 7e52843

Please sign in to comment.