rlinuxgithubgithub-actionsr-usethis

Github Action failing: Process completed with exit code 1 when installing system dependencies for R-CMD-Check


I am trying to run the use_github_action_check_standard() command from the usethis R package to check my package on every push on GitHub Actions.

The test works without a problem on Windows and MacOS, but for both Linux versions my workflow code fails before it even gets to the package code.

It fails when it tries to install the system dependencies where it gives me the error ##[error]Process completed with exit code 1.

When I look at the raw logs (below), I notice the line: Cache not found for input keys: Linux-287c850eb370edd647ed85b6fac18cbaee02effa7d01b981304dce84a452b22c-1-, Linux--1-. But I'm afraid I don't understand that error. Also I don't think this is it, because the key appears in the group above (notice the ##[endgroup]) already but the error only appears in the next group (as on the Screenshot).

Any ideas? Many thanks!

I also post my entire workflow code below.

Screenshot

enter image description here

Raw Log

2020-08-12T22:21:55.5243116Z ##[group]Run install.packages('remotes')
2020-08-12T22:21:55.5243360Z [36;1minstall.packages('remotes')[0m
2020-08-12T22:21:55.5243487Z [36;1msaveRDS(remotes::dev_package_deps(dependencies = TRUE), "../.github/depends.Rds", version = 2)[0m
2020-08-12T22:21:55.5243834Z [36;1mwriteLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), "../.github/R-version")[0m
2020-08-12T22:21:55.5250702Z shell: /usr/local/bin/Rscript {0}
2020-08-12T22:21:55.5251247Z env:
2020-08-12T22:21:55.5251370Z   R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
2020-08-12T22:21:55.5251571Z   RSPM: https://packagemanager.rstudio.com/cran/__linux__/focal/latest
2020-08-12T22:21:55.5251726Z   R_LIBS_USER: /home/runner/work/_temp/Library
2020-08-12T22:21:55.5251838Z   TZ: UTC
2020-08-12T22:21:55.5251944Z   NOT_CRAN: true
2020-08-12T22:21:55.5252036Z ##[endgroup]
2020-08-12T22:21:55.7245517Z Installing package into ‘/home/runner/work/_temp/Library’
2020-08-12T22:21:55.7246358Z (as ‘lib’ is unspecified)
2020-08-12T22:22:10.8252493Z trying URL 'https://packagemanager.rstudio.com/cran/__linux__/focal/latest/src/contrib/remotes_2.2.0.tar.gz'
2020-08-12T22:22:11.4785067Z Content type 'binary/octet-stream' length 385906 bytes (376 KB)
2020-08-12T22:22:11.4972702Z ==================================================
2020-08-12T22:22:11.4973457Z downloaded 376 KB
2020-08-12T22:22:11.4973749Z 
2020-08-12T22:22:11.7705424Z * installing *binary* package ‘remotes’ ...
2020-08-12T22:22:11.7751638Z * DONE (remotes)
2020-08-12T22:22:11.7952384Z 
2020-08-12T22:22:11.7953131Z The downloaded source packages are in
2020-08-12T22:22:11.7954176Z    ‘/tmp/RtmpnMfdtp/downloaded_packages’
2020-08-12T22:22:28.2516191Z ##[group]Run actions/cache@v1
2020-08-12T22:22:28.2516310Z with:
2020-08-12T22:22:28.2516416Z   path: /home/runner/work/_temp/Library
2020-08-12T22:22:28.2516545Z   key: Linux-287c850eb370edd647ed85b6fac18cbaee02effa7d01b981304dce84a452b22c-1-
2020-08-12T22:22:28.2516663Z   restore-keys: Linux--1-
2020-08-12T22:22:28.2516765Z env:
2020-08-12T22:22:28.2516865Z   R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
2020-08-12T22:22:28.2517041Z   RSPM: https://packagemanager.rstudio.com/cran/__linux__/focal/latest
2020-08-12T22:22:28.2517180Z   R_LIBS_USER: /home/runner/work/_temp/Library
2020-08-12T22:22:28.2517288Z   TZ: UTC
2020-08-12T22:22:28.2517383Z   NOT_CRAN: true
2020-08-12T22:22:28.2517481Z ##[endgroup]
2020-08-12T22:22:28.3670558Z Cache not found for input keys: Linux-287c850eb370edd647ed85b6fac18cbaee02effa7d01b981304dce84a452b22c-1-, Linux--1-.
2020-08-12T22:22:28.3750527Z ##[group]Run while read -r cmd
2020-08-12T22:22:28.3750930Z [36;1mwhile read -r cmd[0m
2020-08-12T22:22:28.3751045Z [36;1mdo[0m
2020-08-12T22:22:28.3751155Z [36;1m  eval sudo $cmd[0m
2020-08-12T22:22:28.3751285Z [36;1mdone < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "20.04"), sep = "\n")')[0m
2020-08-12T22:22:28.3792540Z shell: /usr/bin/bash -e {0}
2020-08-12T22:22:28.3792673Z env:
2020-08-12T22:22:28.3792794Z   R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
2020-08-12T22:22:28.3792990Z   RSPM: https://packagemanager.rstudio.com/cran/__linux__/focal/latest
2020-08-12T22:22:28.3793151Z   R_LIBS_USER: /home/runner/work/_temp/Library
2020-08-12T22:22:28.3793268Z   TZ: UTC
2020-08-12T22:22:28.3793377Z   NOT_CRAN: true
2020-08-12T22:22:28.3793480Z ##[endgroup]
2020-08-12T22:22:29.0943838Z usage: sudo -h | -K | -k | -V
2020-08-12T22:22:29.0944936Z usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
2020-08-12T22:22:29.0945856Z usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
2020-08-12T22:22:29.0946223Z             [command]
2020-08-12T22:22:29.0947040Z usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
2020-08-12T22:22:29.0947710Z             prompt] [-T timeout] [-u user] [VAR=value] [-i|-s] [<command>]
2020-08-12T22:22:29.0948381Z usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
2020-08-12T22:22:29.0948992Z             prompt] [-T timeout] [-u user] file ...
2020-08-12T22:22:29.0956330Z ##[error]Process completed with exit code 1.

Workflow code:

# 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:
      - master
  pull_request:
    branches:
      - 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: windows-latest, r: 'release'}
          - {os: macOS-latest, r: 'release'}
          - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
          - {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}

    env:
      R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
      RSPM: ${{ matrix.config.rspm }}
    
   defaults:
      run:
        working-directory: myfunctionname
    steps:
      - uses: actions/checkout@v2

      - uses: r-lib/actions/setup-r@master
        with:
          r-version: ${{ matrix.config.r }}

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

      - name: Query dependencies
        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
        if: runner.os != 'Windows'
        uses: actions/cache@v1
        with:
          path: ${{ env.R_LIBS_USER }}
          key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('../.github/depends.Rds') }}
          restore-keys: ${{ runner.os }}-${{ hashFiles('../.github/R-version') }}-1-

      - name: Install system dependencies
        if: runner.os == 'Linux'
        run: |
          while read -r cmd
          do
            eval sudo $cmd
          done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "20.04"), sep = "\n")')
      - name: Install dependencies
        run: |
          remotes::install_deps(dependencies = TRUE)
          remotes::install_cran("rcmdcheck")
        shell: Rscript {0}

      - 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@main
        with:
          name: ${{ runner.os }}-r${{ matrix.config.r }}-results
          path: check

Solution

  • I figured it out in the end but will leave this here, as it might be useful for someone else!

    The error was associated with the R code that was in the command, so if this occurs to you as well, focus in on the R-part of your code rather than on the workflow code.

    run: |
       while read -r cmd
            do
              eval sudo $cmd
            done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "20.04"), sep = "\n")')
    

    My package was in the sub-directory myfunctionname of my GitHub account, as I have specified in the working directory above:

    defaults:
          run:
            working-directory: myfunctionname
    

    This meant that the R function remotes::system_requirements("ubuntu", "20.04") could not find a package in the specified folder. Once I had added the information simply through: remotes::system_requirements("ubuntu", "20.04","myfunctionname") everything worked.