updating r-cmd check to install homebrew and qpdf #11
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
on: | |
push: | |
branches: | |
- main | |
- master | |
pull_request: | |
branches: | |
- main | |
- master | |
schedule: | |
- cron: '1 23 * * Sun' | |
name: R-CMD-check | |
defaults: | |
run: | |
shell: Rscript {0} | |
jobs: | |
R-CMD-check: | |
name: ${{ matrix.os }}, tf-${{ matrix.tf }}, R-${{ matrix.r}} | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {os: 'ubuntu-latest', tf: 'default', r: 'release'} | |
- {os: 'windows-latest', tf: 'default', r: 'release'} | |
- {os: 'macOS-latest', tf: 'default', r: 'release'} | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.tf == 'nightly' || contains(matrix.tf, 'rc') || matrix.r == 'devel' }} | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: 'true' | |
R_COMPILE_AND_INSTALL_PACKAGES: 'never' | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-r@v2 | |
id: setup-r | |
with: | |
r-version: ${{ matrix.r }} | |
Ncpus: '2L' | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- name: Restore R package cache | |
uses: actions/cache@v2 | |
id: r-package-cache | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: ${{ matrix.os }}-${{ steps.setup-r.outputs.installed-r-version }}-${{ github.run_id }} | |
- name: Install remotes | |
if: steps.r-package-cache.outputs.cache-hit != 'true' | |
run: install.packages("remotes") | |
# Install Homebrew and qpdf on macOS | |
- name: Install Homebrew and qpdf | |
if: runner.os == 'macOS' | |
run: | | |
# Install Homebrew if not already installed | |
if ! command -v brew &> /dev/null; then | |
echo "Installing Homebrew..." | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
else | |
echo "Homebrew already installed." | |
fi | |
# Ensure Homebrew is updated | |
brew update | |
# Install qpdf | |
brew install qpdf | |
- name: Install system dependencies | |
if: runner.os == 'Linux' | |
shell: bash | |
run: | | |
. /etc/os-release | |
while read -r cmd | |
do | |
echo "$cmd" | |
sudo $cmd | |
done < <(Rscript -e "writeLines(remotes::system_requirements('$ID-$VERSION_ID'))") | |
- name: Install package + deps | |
run: remotes::install_local(dependencies = TRUE, force = TRUE) | |
- name: Install greta deps | |
run: | | |
library(greta) | |
greta::install_greta_deps(timeout = 50) | |
- name: Situation Report on greta install | |
run: greta::greta_sitrep() | |
- name: Install rcmdcheck | |
run: remotes::install_cran("rcmdcheck") | |
- name: R CMD check | |
run: rcmdcheck::rcmdcheck(args = '--no-manual', error_on = 'warning', check_dir = 'check') | |
- name: Show testthat output | |
if: always() | |
shell: bash | |
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true | |
- name: Don't use tar from old Rtools to store the cache | |
if: ${{ runner.os == 'Windows' && startsWith(steps.setup-r.outputs.installed-r-version, '3') }} | |
shell: bash | |
run: echo "C:/Program Files/Git/usr/bin" >> $GITHUB_PATH | |
- name: Check on single core machine | |
if: runner.os != 'Windows' | |
env: | |
R_PARALLELLY_AVAILABLE_CORES: 1 | |
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--no-multiarch")) | |
- name: Session info | |
run: | | |
options(width = 100) | |
pkgs <- installed.packages()[, "Package"] | |
sessioninfo::session_info(pkgs, include_base = TRUE) |