|
# 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 |
|
- master |
|
pull_request: |
|
branches: |
|
- main |
|
- master |
|
|
|
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: |
|
# vdiffr & shinytest only runs on mac r-release since the results aren't cross-platform |
|
- {os: macOS-latest, r: 'release', visual_tests: true, node: "14.x", shinytest: true} |
|
- {os: windows-latest, r: 'release'} |
|
# - {os: windows-latest, r: 'oldrel-1'} # pak is having issues |
|
- {os: ubuntu-latest, r: 'devel'} |
|
- {os: ubuntu-latest, r: 'release'} |
|
- {os: ubuntu-latest, r: 'oldrel-1'} |
|
- {os: ubuntu-latest, r: 'oldrel-2'} |
|
# - {os: ubuntu-latest, r: 'oldrel-3'} # dependency issues with oldrel-3 |
|
# - {os: ubuntu-latest, r: 'oldrel-4'} # dependency issues with oldrel-4 |
|
|
|
env: |
|
VISUAL_TESTS: ${{ matrix.config.visual_tests }} |
|
SHINYTEST: ${{ matrix.config.shinytest }} |
|
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
|
MAPBOX_TOKEN: ${{ secrets.MAPBOX_TOKEN }} |
|
plotly_username: ${{ secrets.PLOTLY_USERNAME }} |
|
plotly_api_key: ${{ secrets.PLOTLY_API_KEY }} |
|
|
|
steps: |
|
- uses: actions/checkout@v4 |
|
with: |
|
persist-credentials: false |
|
|
|
- uses: r-lib/actions/setup-r@v2 |
|
id: install-r |
|
with: |
|
r-version: ${{ matrix.config.r }} |
|
use-public-rspm: true |
|
|
|
- uses: r-lib/actions/setup-pandoc@v2 |
|
|
|
- uses: r-lib/actions/setup-r-dependencies@v2 |
|
with: |
|
cache-version: 3 |
|
needs: check |
|
|
|
- name: Set up Python (for reticulate) |
|
if: matrix.config.visual_tests == true |
|
uses: actions/setup-python@v4 |
|
with: |
|
python-version: '3.11' |
|
|
|
- name: Install kaleido |
|
if: matrix.config.visual_tests == true |
|
run: | |
|
# We pin kaleido to v0.2.1 here since >=v1.0 doesn't appear to be correctly rendering some plots |
|
Rscript -e 'library(reticulate); use_python(Sys.which("python")); py_install(c("kaleido==0.2.1", "plotly"))' |
|
|
|
# Run test() before R CMD check since, for some reason, rcmdcheck::rcmdcheck() skips vdiffr tests |
|
- name: Run Tests |
|
run: | |
|
options(crayon.enabled = TRUE, testthat.progress.max_fails=1000) |
|
res <- devtools::test() |
|
df <- as.data.frame(res) |
|
if (sum(df$failed) > 0 || any(df$error)) stop("GHA CI tests failed") |
|
shell: Rscript {0} |
|
|
|
# Upload the whole pkg since tests where run with devtools::test() |
|
- name: Upload check results |
|
if: always() |
|
uses: actions/upload-artifact@master |
|
with: |
|
name: ${{ runner.os }}-r${{ matrix.config.r }}-results |
|
path: | |
|
./ |
|
!./.git/ |
|
|
|
- name: Check package |
|
uses: r-lib/actions/check-r-package@v2 |
|
with: |
|
check-dir: '"check"' |
|
# Run check with --no-tests since we ran them abve |
|
# 2023-01-03: `{purrr}` v1.0.0 had trouble on Windows without the `--no-multiarch` |
|
# https://github.com/plotly/plotly.R/pull/2221 |
|
args: 'c("--no-tests", "--no-manual", "--as-cran", "--no-multiarch")' |
|
error-on: '"warning"' |
|
|
|
#- name: Show testthat output |
|
# if: always() |
|
# run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true |
|
# shell: bash |