R-hub v2
R-hub v2 使用 GitHub Actions 来运行 R CMD check
和类似的软件包检查。rhub 软件包可帮助你为你的 R 软件包设置 R-hub v2 并开始运行检查。
如果你的软件包不在 GitHub 上,请查看 R 集群运行器 部分,了解 rhub 的使用方法。
rhub 使用 GitHub Actions,这对公开存储库是免费的。对于私人存储库,你也会获得一些免费的分钟数,具体取决于你拥有的 GitHub 订阅。有关详细信息,请参见 关于 GitHub Actions 计费。
rhub::rhub_setup()
,将 R-hub 工作流文件添加到你的软件包。rhub::rhub_setup()
#> Setting up R-hub v2. #> ✔ Found R package at /tmp/cli. #> ✔ Found git repository at /tmp/cli. #> ✔ Created workflow file /tmp/cli/.github/workflows/rhub.yaml. #> #> Notes: #> • The workflow file must be added to the default branch of the GitHub #> repository. #> • GitHub actions must be enabled for the repository. They are disabled for #> forked repositories by default. #> #> Next steps: #> • Add the workflow file to git using `git add <filename>`. #> • Commit it to git using `git commit`. #> • Push the commit to GitHub using `git push`. #> • Call `rhub::rhub_doctor()` to check that you have set up R-hub correctly. #> • Call `rhub::rhub_check()` to check your package.
运行 git commit
和 git push
,将工作流文件推送到 GitHub。
运行 rhub::rhub_doctor()
,检查所有设置是否正确
rhub::rhub_doctor()
#> ✔ Found R package at /tmp/cli. #> ✔ Found git repository at /tmp/cli. #> ✔ Found GitHub PAT. #> ✔ Found repository on GitHub at <https://github.com/r-lib/cli>. #> ✖ Does your GitHub PAT have the right scopes? #> Error: #> ! Could not use the PAT to authenticate to GitHub #> ℹ Make sure that the URL and your PAT are correct. #> Type .Last.error to see the more details.
使用 rhub::rhub_platforms()
获取支持的平台和检查列表
rhub::rhub_platforms()
#> ── Virtual machines ─────────────────────────────────────────────────────────── #> 1 [VM] linux #> All R versions on GitHub Actions ubuntu-latest #> 2 [VM] macos #> All R versions on GitHub Actions macos-latest #> 3 [VM] macos-arm64 #> All R versions on GitHub Actions macos-14 #> 4 [VM] windows #> All R versions on GitHub Actions windows-latest #> #> ── Containers ───────────────────────────────────────────────────────────────── #> 5 [CT] atlas [ATLAS] #> R Under development (unstable) (2024-04-10 r86396) on Fedora Linux 38 (Conta… #> ghcr.io/r-hub/containers/atlas:latest #> 6 [CT] clang-asan [asan, clang-ASAN, clang-UBSAN, ubsan] #> R Under development (unstable) (2024-04-10 r86396) on Ubuntu 22.04.4 LTS #> ghcr.io/r-hub/containers/clang-asan:latest #> 7 [CT] clang16 [clang16] #> R Under development (unstable) (2024-04-09 r86391) on Ubuntu 22.04.4 LTS #> ghcr.io/r-hub/containers/clang16:latest #> 8 [CT] clang17 [clang17] #> R Under development (unstable) (2024-04-09 r86391) on Ubuntu 22.04.4 LTS #> ghcr.io/r-hub/containers/clang17:latest #> 9 [CT] clang18 [clang18] #> R Under development (unstable) (2024-04-09 r86391) on Ubuntu 22.04.4 LTS #> ghcr.io/r-hub/containers/clang18:latest #> 10 [CT] donttest [donttest] #> R Under development (unstable) (2024-04-09 r86391) on Ubuntu 22.04.4 LTS #> ghcr.io/r-hub/containers/donttest:latest #> 11 [CT] gcc13 [gcc13] #> R Under development (unstable) (2024-04-10 r86396) on Fedora Linux 38 (Conta… #> ghcr.io/r-hub/containers/gcc13:latest #> 12 [CT] intel [Intel] #> R Under development (unstable) (2024-04-10 r86396) on Fedora Linux 38 (Conta… #> ghcr.io/r-hub/containers/intel:latest #> 13 [CT] mkl [MKL] #> R Under development (unstable) (2024-04-10 r86396) on Fedora Linux 38 (Conta… #> ghcr.io/r-hub/containers/mkl:latest #> 14 [CT] nold [noLD] #> R Under development (unstable) (2024-04-10 r86396) on Ubuntu 22.04.4 LTS #> ghcr.io/r-hub/containers/nold:latest #> 15 [CT] nosuggests [noSuggests] #> R Under development (unstable) (2024-04-10 r86396) on Fedora Linux 38 (Conta… #> ghcr.io/r-hub/containers/nosuggests:latest #> 16 [CT] ubuntu-clang [r-devel-linux-x86_64-debian-clang] #> R Under development (unstable) (2024-04-10 r86396) on Ubuntu 22.04.4 LTS #> ghcr.io/r-hub/containers/ubuntu-clang:latest #> 17 [CT] ubuntu-gcc12 [r-devel-linux-x86_64-debian-gcc] #> R Under development (unstable) (2024-04-10 r86396) on Ubuntu 22.04.4 LTS #> ghcr.io/r-hub/containers/ubuntu-gcc12:latest #> 18 [CT] ubuntu-next [r-next, r-patched, r-patched-linux-x86_64] #> R version 4.4.0 beta (2024-04-09 r86391) on Ubuntu 22.04.4 LTS #> ghcr.io/r-hub/containers/ubuntu-next:latest #> 19 [CT] ubuntu-release [r-release, r-release-linux-x86_64, ubuntu] #> R version 4.3.3 (2024-02-29) on Ubuntu 22.04.4 LTS #> ghcr.io/r-hub/containers/ubuntu-release:latest #> 20 [CT] valgrind [valgrind] #> R Under development (unstable) (2024-04-10 r86396) on Fedora Linux 38 (Conta… #> ghcr.io/r-hub/containers/valgrind:latest
运行 rhub::rhub_check()
,在 GitHub Actions 上启动 R-hub v2 检查
rhub::rhub_check()
#> ✔ Found git repository at /tmp/cli. #> ✔ Found GitHub PAT. #> #> Available platforms (see `rhub::rhub_platforms()` for details): #> #> 1 [VM] linux R-* (any version) ubuntu-latest on GitHub #> 2 [VM] macos R-* (any version) macos-latest on GitHub #> 3 [VM] macos-arm64 R-* (any version) macos-14 on GitHub #> 4 [VM] windows R-* (any version) windows-latest on GitHu #> 5 [CT] atlas R-devel (2024-04-10 r86396) Fedora Linux 38 (Contai… #> 6 [CT] clang-asan R-devel (2024-04-10 r86396) Ubuntu 22.04.4 LTS #> 7 [CT] clang16 R-devel (2024-04-09 r86391) Ubuntu 22.04.4 LTS #> 8 [CT] clang17 R-devel (2024-04-09 r86391) Ubuntu 22.04.4 LTS #> 9 [CT] clang18 R-devel (2024-04-09 r86391) Ubuntu 22.04.4 LTS #> 10 [CT] donttest R-devel (2024-04-09 r86391) Ubuntu 22.04.4 LTS #> 11 [CT] gcc13 R-devel (2024-04-10 r86396) Fedora Linux 38 (Contai… #> 12 [CT] intel R-devel (2024-04-10 r86396) Fedora Linux 38 (Contai… #> 13 [CT] mkl R-devel (2024-04-10 r86396) Fedora Linux 38 (Contai… #> 14 [CT] nold R-devel (2024-04-10 r86396) Ubuntu 22.04.4 LTS #> 15 [CT] nosuggests R-devel (2024-04-10 r86396) Fedora Linux 38 (Contai… #> 16 [CT] ubuntu-clang R-devel (2024-04-10 r86396) Ubuntu 22.04.4 LTS #> 17 [CT] ubuntu-gcc12 R-devel (2024-04-10 r86396) Ubuntu 22.04.4 LTS #> 18 [CT] ubuntu-next R-4.4.0 beta (2024-04-09 r86391) Ubuntu 22.04.4 LTS #> 19 [CT] ubuntu-release R-4.3.3 (2024-02-29) Ubuntu 22.04.4 LTS #> 20 [CT] valgrind R-devel (2024-04-10 r86396) Fedora Linux 38 (Contai… #> #> Selection (comma separated numbers, 0 to cancel): 1, 5 #> #> ✔ Check started: linux, atlas (irresponsible-hookersealion). #> See <https://github.com/r-lib/cli/actions> for live output!
如果你不想在 GitHub 上放置你的软件包,你仍然可以使用 rhub 软件包在 https://github.com/r-hub2 GitHub 组织中使用一组共享的运行器在任何支持的平台上运行软件包检查。
该过程与 R-hub 的第一个版本类似
将工作目录设置为你想检查的 R 软件包。
从 R-hub 获取令牌,以验证你的电子邮件地址
(如果你已使用相同的电脑和电子邮件地址将软件包提交至 R-hub 的旧版本,则无需执行此操作。调用 rc_list_local_tokens()
检查你是否已有令牌。)
使用以下命令提交构建:
选择要使用的平台,并按照说明和提供的链接查看检查结果。
rhub_setup()
和 rhub_check()
函数。rc_submit()
提交构建时,必须至少等待五分钟。若要避免这些限制(除了需要 GitHub 账户的限制外),请将你的软件包放入 GitHub 存储库,并使用 rhub_setup()
和 rhub_check()
函数,而不是 rc_submit()
和 R 联盟的运行程序。
请注意,rhub 软件包会随 贡献者行为准则 一起发布。通过向此项目做出贡献,即表示你同意遵守其条款。