Skip to content

Commit

Permalink
🩺 Update R CMD check in GitHub Actions
Browse files Browse the repository at this point in the history
* test solution for #8 (attempt 4)
  • Loading branch information
idblr committed Jul 9, 2024
1 parent de41436 commit 0d8a26b
Showing 1 changed file with 34 additions and 26 deletions.
60 changes: 34 additions & 26 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples

# 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]
branches:
- main
pull_request:
branches: [main, master]
branches:
- main

name: R-CMD-check

Expand All @@ -24,36 +26,35 @@ jobs:
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'oldrel-2'}
- {os: ubuntu-latest, r: 'oldrel-3'}
- {os: ubuntu-latest, r: 'oldrel-4'}
- {os: ubuntu-latest, r: 'oldrel-5'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
R_KEEP_PKG_SOURCE: yes
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2.9.0
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-pandoc@v2

# For file snapshot that uses png
- name: Install xquartz
if: runner.os == 'macOS'
run: brew install --cask xquartz
# # For file snapshot that uses png
# - name: Install xquartz
# if: runner.os == 'macOS'
# run: brew install --cask xquartz

# - uses: r-lib/actions/setup-r-dependencies@v2.9.0
# - uses: r-lib/actions/setup-r-dependencies@v
# with:
# extra-packages: any::rcmdcheck
# needs: check
Expand All @@ -62,6 +63,7 @@ jobs:
run: |
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}

- name: Cache R packages
Expand All @@ -70,7 +72,7 @@ jobs:
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-r-${{ matrix.config.r }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-1-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install macOS specific dependencies for sf
if: runner.os == 'macOS'
Expand All @@ -80,31 +82,37 @@ jobs:
if: runner.os == 'Linux'
run: sudo apt-get install libgdal-dev libproj-dev libgeos-dev libudunits2-dev

- name: Install language dependencies
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE, build = FALSE)
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

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

- uses: r-lib/actions/check-r-package@v2.9.0
with:
upload-snapshots: true
# - uses: r-lib/actions/check-r-package@v2
# with:
# upload-snapshots: true

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

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

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

0 comments on commit 0d8a26b

Please sign in to comment.