Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
chevron-right

GitHub Action

cross-gem

v1

cross-gem

chevron-right

cross-gem

Cross compiles a native Ruby gem written in Rust

Installation

Copy and paste the following snippet into your .yml file.

              

- name: cross-gem

uses: oxidize-rb/cross-gem-action@v1

Learn more about this action in oxidize-rb/cross-gem-action

Choose a version

Cross Gem Action

MIT licensed Join the discussion Continuous integration

This action makes it easy to compile and package native Rubygems that are written in Rust. Under the hood, it uses a customized version rake-compiler-dock to compile a gem, and is meant to be used in tandem with rb-sys.

Table of Contents

Example workflow

# Adjust this based on your release workflow
on:
  workflow_dispatch:

jobs:
  native_gem:
    name: Compile native gem
    runs-on: ubuntu-latest
    strategy:
      platform:
        - x86_64-linux
        - aarch64-linux
        - arm-linux
        - x86_64-darwin
        - arm64-darwin
        - x64-mingw32
        - x64-mingw-ucrt
    steps:
      - uses: actions/checkout@v2

      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: '3.1'
          bundler-cache: true

      - uses: oxidize-rb/cross-gem@v1
        with:
          platform: ${{ matrix.platform }}
          env: | # optional
            RUBY_CC_VERSION=3.1.0:3.0.0:2.7.0
            SOME_OTHER_ENV=some_value

Inputs

Name Required Description Type Default
platform Target Ruby platform string
directory Directory of the Rakefile string
env Extra env to set in the container string

License

This Action is distributed under the terms of the MIT license, see LICENSE for details.