DEV Community

Cover image for ⚡️ setup-ruby-flash
Peter H. Boling
Peter H. Boling

Posted on

⚡️ setup-ruby-flash

Find out how fast my workflows can go!
-You, possibly

GH Marketplace Dogfood Current Tag License Source Stars
GH Marketplace CI GitHub tag (latest SemVer) License: MIT GH Source GH Repo Stars

A fast GitHub Action for fast Ruby environment setup using rv for Ruby installation and ore for gem management.

⚡ Install Ruby in under 2 seconds — no compilation required!

⚡ Install Gems 50% faster — using ORE ✅️!

Features

  • 🚀 Lightning-fast Ruby installation via prebuilt binaries from rv
  • 📦 Rapid gem installation with ore (Bundler-compatible, ~50% faster)
  • 💾 Intelligent caching for both Ruby and gems
  • 🔒 Security auditing via ore audit
  • 🐧 Linux & macOS support (x86_64 and ARM64)
  • ☕️ Gitea Actions support
  • 🦊 Forgejo Actions support
  • 🧊 Codeberg Actions support
  • 🐙 GitHub Actions support

Requirements

  • Operating Systems: Ubuntu 22.04+, macOS 14+
  • Architectures: x86_64, ARM64
  • Ruby Versions: 3.2, 3.3, 3.4, 4.0
# Important Alternative
1 Windows is not supported ruby/setup-ruby
2 Ruby <= 3.1 is not supported ruby/setup-ruby

Key Differences with setup-ruby

Feature setup-ruby setup-ruby-flash
Ruby Install ~5 seconds < 2 seconds
Gem Install Bundler ore (~50% faster)
ruby-version: ruby ✅ latest stable ✅ latest stable
rubygems: latest
bundler: latest
Windows
Ruby < 3.2
JRuby ❌ (planned)
TruffleRuby ❌ (planned)
Security Audit ✅ (ore audit)

Basic Usage

- uses: appraisal-rb/setup-ruby-flash@v1
  with:
    ruby-version: '3.4'
Enter fullscreen mode Exit fullscreen mode

With Gem Installation

- uses: appraisal-rb/setup-ruby-flash@v1
  with:
    ruby-version: '3.4'
    ore-install: true
Enter fullscreen mode Exit fullscreen mode

Using Version Files

When ruby-version is set to default (the default), setup-ruby-flash reads from:

  • .ruby-version
  • .tool-versions (asdf format)
  • mise.toml
- uses: appraisal-rb/setup-ruby-flash@v1
  with:
    ore-install: true
Enter fullscreen mode Exit fullscreen mode

Enough Talk, Where?

Inputs

Input Description Default
ruby-version Ruby version to install (e.g., 3.4, 3.4.1). Use ruby for latest stable version, or default to read from version files. default
rubygems RubyGems version: default, latest, or a version number (e.g., 3.5.0) default
bundler Bundler version: Gemfile.lock, default, latest, none, or a version number Gemfile.lock
ore-install Run ore install and cache gems false
working-directory Directory for version files and Gemfile .
cache-version Cache version string for invalidation v1
rv-version Version of rv to install latest
ore-version Version of ore to install latest
skip-extensions Skip building native extensions false
without-groups Gem groups to exclude (comma-separated) ''
ruby-install-retries Number of retry attempts for Ruby installation (with exponential backoff) 3
token GitHub token for API calls ${{ github.token }}

Outputs

Output Description
ruby-version The installed Ruby version
ruby-prefix The path to the Ruby installation
rv-version The installed rv version
rubygems-version The installed RubyGems version
bundler-version The installed Bundler version
ore-version The installed ore version
cache-hit Whether gems were restored from cache

Examples

Matrix Build

name: CI
on: [push, pull_request]

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
        ruby: ['3.2', '3.3', '3.4']
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v5
      - uses: appraisal-rb/setup-ruby-flash@v1
        with:
          ruby-version: ${{ matrix.ruby }}
          ore-install: true
      - run: bundle exec rake test
Enter fullscreen mode Exit fullscreen mode

Production Gems Only

- uses: appraisal-rb/setup-ruby-flash@v1
  with:
    ruby-version: '3.4'
    ore-install: true
    without-groups: 'development,test'
Enter fullscreen mode Exit fullscreen mode

Latest Ruby with Latest RubyGems and Bundler

- uses: appraisal-rb/setup-ruby-flash@v1
  with:
    ruby-version: ruby
    rubygems: latest
    bundler: latest
    ore-install: true
Enter fullscreen mode Exit fullscreen mode

Specific RubyGems Version

- uses: appraisal-rb/setup-ruby-flash@v1
  with:
    ruby-version: '3.4'
    rubygems: '3.5.0'
    ore-install: true
Enter fullscreen mode Exit fullscreen mode

Skip Native Extensions

- uses: appraisal-rb/setup-ruby-flash@v1
  with:
    ruby-version: '3.4'
    ore-install: true
    skip-extensions: true
Enter fullscreen mode Exit fullscreen mode

Custom Working Directory

- uses: appraisal-rb/setup-ruby-flash@v1
  with:
    ruby-version: '3.4'
    ore-install: true
    working-directory: './my-app'
Enter fullscreen mode Exit fullscreen mode

Specific Tool Versions

- uses: appraisal-rb/setup-ruby-flash@v1
  with:
    ruby-version: '3.4.1'
    rv-version: '0.4.0'
    ore-version: '0.1.0'
    ore-install: true
Enter fullscreen mode Exit fullscreen mode

Custom Retry Configuration

If you experience intermittent failures due to GitHub API rate limiting, you can adjust the number of retry attempts:

- uses: appraisal-rb/setup-ruby-flash@v1
  with:
    ruby-version: '3.4'
    ruby-install-retries: '5'
Enter fullscreen mode Exit fullscreen mode

Migration from setup-ruby

setup-ruby-flash is designed to be a near drop-in replacement for ruby/setup-ruby on supported platforms:

# Before (setup-ruby)
- uses: ruby/setup-ruby@v1
  with:
    ruby-version: '3.4'
    bundler-cache: true
- run: bundle exec rake test

# After (setup-ruby-flash)
- uses: appraisal-rb/setup-ruby-flash@v1
  with:
    ruby-version: '3.4'
    ore-install: true
- run: bundle exec rake test
Enter fullscreen mode Exit fullscreen mode

With Latest RubyGems and Bundler

# Before (setup-ruby)
- uses: ruby/setup-ruby@v1
  with:
    ruby-version: ruby
    rubygems: latest
    bundler: latest

# After (setup-ruby-flash)
- uses: appraisal-rb/setup-ruby-flash@v1
  with:
    ruby-version: ruby
    rubygems: latest
    bundler: latest
Enter fullscreen mode Exit fullscreen mode

Acknowledgements

  • setup-ruby the venerable mainstay for many years, and inspiration for this project.
  • rv by Spinel Cooperative
  • ore by Contriboss

Support & Funding Info

I am a full-time FLOSS maintainer. If you find my work valuable I ask that you become a sponsor. Every dollar helps!

🥰 Support FLOSS work 🥰 Get access "Sponsors" channel on Galtzo FLOSS Discord 👇️ Live Chat on Discord
OpenCollective Backers OpenCollective Sponsors Buy me a coffee Donate at ko-fi.com Donate on PayPal Donate on Polar Sponsor Me on Github Liberapay Goal Progress

Cover photo (cropped) by Kyle Hinkson on Unsplash

Top comments (0)