Skip to content

Commit

Permalink
add github action to cross compile gems
Browse files Browse the repository at this point in the history
  • Loading branch information
felipecsl committed Oct 11, 2024
1 parent 35e4cbc commit 3f6909e
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/ruby-cross-compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: Build Ruby gems

on:
push:
branches:
- main
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
ci-data:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.fetch.outputs.result }}
steps:
# This compiles for all supported Ruby cross-compilation platforms.
- id: fetch
uses: oxidize-rb/actions/fetch-ci-data@main
with:
supported-ruby-platforms: |
exclude: []
stable-ruby-versions: |
exclude: [head]
cross_gems:
name: Cross compile gems
needs: ci-data
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby-platform: ${{ fromJSON(needs.ci-data.outputs.result).supported-ruby-platforms }}
steps:
- uses: actions/checkout@v4

- uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
ruby-version: "3.3"
bundler-cache: true
cargo-cache: true
cargo-vendor: true
cache-version: v2-${{ matrix.ruby-platform }}

- name: Set vars
id: vars
run: |
echo "rb-sys-version=$(bundle exec ruby -rrb_sys -e 'puts RbSys::VERSION')" >> $GITHUB_OUTPUT
- uses: "ruby/setup-ruby@v1"
with:
ruby-version: "3.2"
bundler-cache: true

- uses: oxidize-rb/cross-gem-action@main
with:
version: ${{ steps.vars.outputs.rb-sys-version }}
platform: ${{ matrix.ruby-platform }}
ruby-versions: ${{ join(fromJSON(needs.ci-data.outputs.result).stable-ruby-versions, ', ') }}

0 comments on commit 3f6909e

Please sign in to comment.