Updates no-response workflow #326
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
# NOTE: This workflow is overkill for most R packages | |
# check-standard.yaml is likely a better choice | |
# usethis::use_github_action("check-standard") will install it. | |
# | |
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. | |
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions | |
on: | |
push: | |
branches: | |
- main | |
- devel | |
pull_request: | |
branches: | |
- main | |
- devel | |
name: R-CMD-check | |
jobs: | |
R-CMD-check: | |
runs-on: ${{ matrix.config.os }} | |
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {os: macOS-latest, r: 'release'} | |
- {os: windows-latest, r: 'release'} | |
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", http-user-agent: "R/4.1.0 (ubuntu-20.04) R (4.1.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } | |
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} | |
- {os: ubuntu-20.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} | |
env: | |
RSPM: ${{ matrix.config.rspm }} | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
id: install-r | |
with: | |
r-version: ${{ matrix.config.r }} | |
http-user-agent: ${{ matrix.config.http-user-agent }} | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- uses: r-lib/actions/setup-tinytex@v2 | |
- run: tlmgr --version | |
- run: tlmgr install apa6 threeparttable caption fancyhdr endfloat was multirow threeparttablex environ trimspaces lineno csquotes babel-english grfext | |
- name: Install Ghostscript on Linux | |
if: runner.os == 'Linux' | |
run: sudo DEBIAN_FRONTEND=noninteractive apt-get install --yes ghostscript | |
- name: Install Ghostscript on macOS | |
if: runner.os == 'macOS' | |
run: brew install ghostscript | |
- name: Install Ghostscript on Windows | |
if: runner.os == 'Windows' | |
run: choco install ghostscript --no-progress | |
- name: Install pak and query dependencies | |
run: | | |
cat("::group::Install pak\n") | |
options(pak.no_extra_messages = TRUE) | |
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/") | |
deps <- pak::pkg_deps( | |
"local::." | |
, dependencies = list( | |
direct = c("Depends", "Imports", "LinkingTo", "Suggests") | |
, indirect = c("Depends", "Imports", "LinkingTo") | |
) | |
) | |
saveRDS(deps, ".github/r-depends.rds") | |
shell: Rscript {0} | |
- name: Get R and OS version | |
id: get-version | |
run: | | |
cat("::set-output name=os-version::", sessionInfo()$running, "\n", sep = "") | |
cat("::set-output name=r-version::", R.Version()$version.string, "\n", sep = "") | |
cat("::endgroup::\n") | |
shell: Rscript {0} | |
- name: Restore R package cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
${{ env.R_LIBS_USER }}/* | |
!${{ env.R_LIBS_USER }}/pak | |
key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{inputs.cache-version }}-${{ hashFiles('.github/r-depends.rds') }} | |
restore-keys: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{inputs.cache-version }}- | |
- name: Install dependencies | |
run: | | |
cat("::group::Install dependencies\n") | |
options(pak.no_extra_messages = TRUE) | |
local_deps <- pak::local_dev_deps(dependencies = TRUE)[["ref"]] | |
needs <- sprintf("Config/Needs/%s", strsplit("${{ inputs.needs }}", "[[:space:],]+")[[1]]) | |
needs_deps <- pak::local_dev_deps(dependencies = needs)[["ref"]] | |
needs_only_deps <- setdiff(needs_deps, local_deps) | |
extra_deps <- c("rcmdcheck", "covr") | |
if (Sys.info()[["sysname"]] == "Linux") { | |
pak::local_system_requirements(execute = TRUE) | |
for (dep in c(needs_only_deps, extra_deps)) { | |
pak::pkg_system_requirements(dep, execute = TRUE) | |
} | |
} | |
pak::pkg_install(c(local_deps, needs_only_deps, extra_deps, "sessioninfo")) | |
cat("::endgroup::\n") | |
shell: Rscript {0} | |
- name: Session info | |
run: | | |
cat("::group::Session info\n") | |
options(width = 100) | |
pkgs <- installed.packages()[, "Package"] | |
sessioninfo::session_info(pkgs, include_base = TRUE) | |
cat("::endgroup::\n") | |
shell: Rscript {0} | |
- name: Don't use tar 1.30 from Rtools35 to store the cache | |
shell: bash | |
run: | | |
if command -v /c/Rtools/bin/tar && /c/Rtools/bin/tar --version | grep -q 'tar (GNU tar) 1.30' | |
then echo 'C:/Program Files/Git/usr/bin' >> $GITHUB_PATH | |
fi | |
- uses: r-lib/actions/check-r-package@v2 | |
with: | |
build_args: '"--compact-vignettes=both"' | |
- name: Code Coverage | |
env: | |
_R_CHECK_CRAN_INCOMING_: false | |
run: covr::codecov() | |
shell: Rscript {0} | |
- name: Show testthat output | |
if: always() | |
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true | |
shell: bash | |
- name: Upload check results | |
if: failure() | |
uses: actions/upload-artifact@main | |
with: | |
name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results | |
path: check | |
- name: Don't use tar from old Rtools to store the cache | |
if: ${{ runner.os == 'Windows' && startsWith(steps.install-r.outputs.installed-r-version, '3.6' ) }} | |
shell: bash | |
run: echo "C:/Program Files/Git/usr/bin" >> $GITHUB_PATH |