Michael Roswell
Michael Roswell

Reputation: 1482

Package failing R-CMD check on github actions, some kind of Tex issue

19 days ago an R package I'm working on suddenly started failing the checks on github actions, even though it passed locally on my machine. It looks like I started with github actions using something like usethis::use_github_action_check_standard() in December, 2020. It worked for over a year. Then a few weeks ago, the GH actions run would give some inscrutable errors suggesting something was failing with latex when building vignettes, but I was really struggling to figure it out. The errors/warnings for the different systems were different but all pointed to latex issues, here's an e.g. from ubuntu-20.04 (release) from 19 days ago:

Warning in system2(..., stdout = if (use_file_stdout()) f1 else FALSE, stderr = f2) :
  error in running command
! sh: 1: xelatex: not found

I don't know what steps are required to reproduce but the header on one vignette went something like this:

---
title: "vignette-title"
output: rmarkdown::html_vignette
bibliography: '`r system.file( "REFERENCES.bib", package="myPackage")`'
latex_engine: xelatex
vignette: >
  %\VignetteIndexEntry{vignette title}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
  %\SweaveUTF8
  
---

What can I change so my package passes R CMD check on github actions?

Upvotes: 2

Views: 896

Answers (1)

Michael Roswell
Michael Roswell

Reputation: 1482

Based on the answer here and response here, I figured it would involve adding details to r-lib actions to the YAML header in the .github directory. However, the fixes there didn't quite work for me. I (re?)ran usethis::use_github_action("check-standard") and then added the tinytex line and changed pandoc line to - uses: r-lib/actions/setup-pandoc@v2 rather than @v1, and it seems to have finally worked. Full .yaml:

# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
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:
          - {os: macOS-latest,   r: 'release'}
          - {os: windows-latest, r: 'release'}
          - {os: ubuntu-latest,   r: 'devel', http-user-agent: 'release'}
          - {os: ubuntu-latest,   r: 'release'}
          - {os: ubuntu-latest,   r: 'oldrel-1'}

    env:
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
      R_KEEP_PKG_SOURCE: yes

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

      - uses: r-lib/actions/setup-r-dependencies@v1
        with:
          extra-packages: rcmdcheck

      - uses: r-lib/actions/setup-tinytex@v2
      - uses: r-lib/actions/check-r-package@v1

Upvotes: 3

Related Questions