我正在尝试在 Travis CI 上构建支持 YJIT 的 Ruby 3.2.2,但 Travis 似乎不允许这样做。
我在
.travis.yml
内部使用以下内容:
language: ruby
dist: focal
rvm:
- 3.2.2
env:
- RUBY_CONFIGURE_OPTS="--enable-yjit"
- RUBY_YJIT_ENABLE=1
- RUBYOPT="--enable-yjit"
cache:
npm: true
bundler: true
sudo: false
services:
- mysql
- redis-server
before_script:
- sudo apt install -y curl build-essential gcc make
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- source "$HOME/.cargo/env"
- rustc --version
stages:
- ruby
jobs:
include:
- stage: ruby
name: "Ruby Version Info"
script:
- ruby --yjit -v
(我尝试使用
before_install
,但也不起作用。)
该阶段的输出如下:
0.32s$ sudo apt install -y curl build-essential gcc make
before_script.5
14.65s$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
before_script.6
0.00s$ source "$HOME/.cargo/env"
before_script.7
0.05s$ rustc --version
rustc 1.73.0 (cc66ad468 2023-10-03)
0.02s$ ruby --yjit -v
ruby: warning: Ruby was built without YJIT support. You may need to install rustc to build Ruby with YJIT.
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
The command "ruby --yjit -v" exited with 0.
Travis 支持为我找到了解决方案:
before_install:
- curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
- source "$HOME/.cargo/env"
- rustc --version
- RUBYCONFIGUREOPTS=--enable-yjit rvm reinstall --disable-binary 3.2.2