Techioz Blog

Travis CI 上の Ruby 3.2.2 YJIT

概要

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