diff --git a/.github/workflows/cibuildgem.yaml b/.github/workflows/cibuildgem.yaml new file mode 100644 index 0000000..562d17d --- /dev/null +++ b/.github/workflows/cibuildgem.yaml @@ -0,0 +1,86 @@ +name: "Package and release gems with precompiled binaries" +on: + workflow_dispatch: + inputs: + release: + description: "If the whole build passes on all platforms, release the gems on RubyGems.org" + required: false + type: boolean + default: false +jobs: + compile: + timeout-minutes: 20 + name: "Cross compile the gem on different ruby versions" + strategy: + matrix: + os: ["macos-latest", "ubuntu-22.04"] + runs-on: "${{ matrix.os }}" + steps: + - name: "Checkout code" + uses: "actions/checkout@v5" + - name: "Setup Ruby" + uses: "ruby/setup-ruby@v1" + with: + ruby-version: "3.1.7" + bundler-cache: true + - name: "Run cibuildgem" + uses: "shopify/cibuildgem/.github/actions/cibuildgem@main" + with: + step: "compile" + test: + timeout-minutes: 20 + name: "Run the test suite" + needs: compile + strategy: + matrix: + os: ["macos-latest", "ubuntu-22.04"] + rubies: ["3.1", "3.2", "3.3", "3.4"] + type: ["cross", "native"] + runs-on: "${{ matrix.os }}" + steps: + - name: "Checkout code" + uses: "actions/checkout@v5" + - name: "Setup Ruby" + uses: "ruby/setup-ruby@v1" + with: + ruby-version: "${{ matrix.rubies }}" + bundler-cache: true + - name: "Run cibuildgem" + uses: "shopify/cibuildgem/.github/actions/cibuildgem@main" + with: + step: "test_${{ matrix.type }}" + install: + timeout-minutes: 5 + name: "Verify the gem can be installed" + needs: test + strategy: + matrix: + os: ["macos-latest", "ubuntu-22.04"] + runs-on: "${{ matrix.os }}" + steps: + - name: "Setup Ruby" + uses: "ruby/setup-ruby@v1" + with: + ruby-version: "3.4.7" + - name: "Run cibuildgem" + uses: "shopify/cibuildgem/.github/actions/cibuildgem@main" + with: + step: "install" + release: + permissions: + id-token: write + contents: read + timeout-minutes: 5 + if: ${{ inputs.release }} + name: "Release all gems with RubyGems" + needs: install + runs-on: "ubuntu-latest" + steps: + - name: "Setup Ruby" + uses: "ruby/setup-ruby@v1" + with: + ruby-version: "3.4.7" + - name: "Run cibuildgem" + uses: "shopify/cibuildgem/.github/actions/cibuildgem@main" + with: + step: "release" diff --git a/lib/stack_frames.rb b/lib/stack_frames.rb index 068bf9b..f653bbc 100644 --- a/lib/stack_frames.rb +++ b/lib/stack_frames.rb @@ -1,7 +1,13 @@ # frozen_string_literal: true require 'stack_frames/version' -require 'stack_frames/stack_frames' + +begin + ruby_version = /(\d+\.\d+)/.match(RUBY_VERSION) + require "stack_frames/#{ruby_version}/stack_frames" +rescue LoadError + require "stack_frames/stack_frames" +end StackFrames::Frame.singleton_class.class_eval do private(:new)