简体   繁体   English

使用 GitHub Package R 操作

[英]Use GitHub Package R Actions

I was trying to use actions in a package I wrote.我试图在我写的package中使用操作 The issue is that the package actions uses remotes in its setup to install CRAN only packages.问题是 package操作在其设置中使用remotes来安装仅限 CRAN 的软件包。

Since the package I am working on depends on a non CRAN package that is present on GitHub, both coverage and R CMD checks fail. Since the package I am working on depends on a non CRAN package that is present on GitHub, both coverage and R CMD checks fail. I tried to avoid this by naively downgrading to an earlier version of the package in depends but some functions are not exported.我试图通过在依赖中天真地降级到 package 的早期版本来避免这种情况,但某些功能没有导出。 I am wondering if someone knows a workaround that might help(I cannot open an issue at actions since their support.md file discourages this).我想知道是否有人知道可能有帮助的解决方法(我无法在操作中打开问题,因为他们的support.md文件不鼓励这样做)。

If your package depends on a non-CRAN package, you must include under Remotes: rather than just Imports: in your DESCRIPTION file.如果您的 package 依赖于非 CRAN package,则必须在Remotes:下包含Imports:而不仅仅是在您的 DESCRIPTION 文件中。 Here you would have:在这里,您将拥有:

Imports:
  actions
Remotes:
  r-lib/actions

This will pass checks, but there is no work around for publishing to CRAN if any of your dependencies are not on CRAN, thus you'll get a warning if any packages are present in the Remotes field.这将通过检查,但如果您的任何依赖项不在 CRAN 上,则无法解决发布到 CRAN 的问题,因此如果Remotes字段中存在任何包,您将收到警告。

The alternative using Travis is adding r_github_packages: r-lib/actions to your.travis.yml.使用 Travis 的替代方法是将r_github_packages: r-lib/actions添加到 your.travis.yml。

After some time, I have found a workaround that for now is good enough if you want to test for the development version(like I wanted).一段时间后,我找到了一种解决方法,如果您想测试开发版本(就像我想要的那样),现在就足够了。 You should include an install_github command in the check.yaml file.您应该在check.yaml文件中包含install_github命令。 Here's an example:这是一个例子:

 - name: Install dependencies
        run: |
          install.packages(c("remotes","testthat"),dependencies=TRUE)
          remotes::install_github("tidyverse/dplyr")
          remotes::install_cran("covr")
        shell: Rscript {0}

The above snippet fixed my issue because I wanted to depend on a future dplyr version.上面的代码片段解决了我的问题,因为我想依赖未来的dplyr版本。 You can view the full yaml file here .您可以在此处查看完整的yaml文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM