Ruby 和 Rails Github Action 退出代码 16

我正在尝试为一个新的 Rails 项目设置一个带有 Github 操作的持续集成工作流。这是错误:

2022-05-21T17:07:01.1242737Z Your bundle only supports platforms ["x86_64-darwin-19", "x86_64-darwin-21"] but
2022-05-21T17:07:01.1243516Z your local platform is x86_64-linux. Add the current platform to the lockfile
2022-05-21T17:07:01.1244782Z with `bundle lock --add-platform x86_64-linux` and try again.
2022-05-21T17:07:01.1294935Z Took   1.38 seconds
2022-05-21T17:07:01.1295823Z ##[endgroup]
2022-05-21T17:07:01.1347744Z ##[error]Error: The process '/opt/hostedtoolcache/Ruby/3.1.2/x64/bin/bundle' failed with exit code 16
    at ExecState._setResult (/home/runner/work/_actions/ruby/setup-ruby/v1/dist/index.js:4918:25)
    at ExecState.CheckComplete (/home/runner/work/_actions/ruby/setup-ruby/v1/dist/index.js:4901:18)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/ruby/setup-ruby/v1/dist/index.js:4795:27)
    at ChildProcess.emit (node:events:390:28)
    at maybeClose (node:internal/child_process:1064:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)

以及配置文件:

name: My workflow
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - uses: ruby/setup-ruby@v1
      with:
        bundler-cache: true
    - run: bundle exec rake

有谁知道是什么问题?

非常感谢!

stack overflow Ruby and Rails Github Action exit code 16
原文答案

答案:

作者头像

[问题已解决]

解决方案:

运行 bundle lock --add-platform x86_64-linux

作者头像

Gerard Morera 提供的答案对我来说很好;但是,我花了一段时间才意识到我需要在项目中通过 PowerShell/命令行运行 bundle lock --add-platform x86_64-linux (在我的案例中,它是一个 Jekyll 项目/站点)。

强调这个问题出现在我的案例中的原因可能是有帮助的,因为我在 Windows 10 上捆绑了站点,而 Linux 驱动的机器处理了部署(由 GitHub 工作流触发/控制。

相关问题