簡體   English   中英

Github 操作失敗:為 R-CMD-Check 安裝系統依賴項時,進程完成,退出代碼為 1

[英]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.

測試在 Windows 和 MacOS 上沒有問題,但是對於 Linux 版本,我的工作流代碼在到達 package 代碼之前就失敗了。

當它嘗試安裝系統依賴項時失敗,它給我錯誤##[error]Process completed with exit code 1

當我查看原始日志(如下)時,我注意到以下行: Cache not found for input keys: Linux-287c850eb370edd647ed85b6fac18cbaee02effa7d01b981304dce84a452b22c-1-, Linux--1-. 但恐怕我不明白那個錯誤。 另外我不認為是這樣,因為密鑰已經出現在上面的組中(注意##[endgroup] ),但錯誤只出現在下一組中(如屏幕截圖所示)。

有任何想法嗎? 非常感謝!

我還在下面發布了我的整個工作流程代碼。

截屏

在此處輸入圖像描述

原始日志

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.

工作流程代碼:

# 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

我最終想通了,但將其留在這里,因為它可能對其他人有用!

該錯誤與命令中的 R 代碼相關:

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

我的myfunctionname位於我的 GitHub 帳戶的子目錄 myfunctionname 中,正如我在上面的工作目錄中指定的那樣:

defaults:
      run:
        working-directory: myfunctionname

這意味着 R function remotes::system_requirements("ubuntu", "20.04")在指定的文件夾中找不到 ZEFE90A8E604A7C840E88D03A67F6B7D。 一旦我通過以下方式添加了信息: remotes::system_requirements("ubuntu", "20.04","myfunctionname")一切正常。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM