Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fat gems for all supported Ruby versions and platforms on CI #360

Merged
merged 13 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/build-gems.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build gems
on:
push:
branches: [main]
tags: ["*"]
paths-ignore:
- "*.md"
- "docs/**"
pull_request:

jobs:
ci-data:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.fetch.outputs.result }}
steps:
- uses: oxidize-rb/actions/fetch-ci-data@v1
id: fetch
with:
supported-ruby-platforms: |
exclude: [arm-linux]
stable-ruby-versions: |
exclude: [head]

cross-gem:
name: Compile native gem for ${{ matrix.ruby-platform }}
runs-on: ubuntu-latest
needs: ci-data
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.2"
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: 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, ', ') }}
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ jobs:
ruby-version: "3.2"
bundler-cache: true
- run: ./bin/setup
- run: rake check:type
- run: bundle exec rake check:type
- run: sudo apt-get install clang-format
- run: ./tools/clang-format-diff.sh
- run: rake check:bindgen
- run: bundle exec rake check:bindgen
- run: git diff --exit-code

build-builder-image:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ gemspec
group :development do
gem "rake"
gem "rake-compiler"
gem "rb_sys", "~> 0.9.63"
gem "rb_sys", "0.9.85"
end

group :check do
Expand Down
5 changes: 4 additions & 1 deletion tasks/gem.rake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ end
begin
require "rb_sys/extensiontask"

RbSys::ExtensionTask.new("ruby_wasm") { |ext| ext.lib_dir = "lib/ruby_wasm" }
gemspec = Gem::Specification.load("ruby_wasm.gemspec")
RbSys::ExtensionTask.new("ruby_wasm", gemspec) do |ext|
ext.lib_dir = "lib/ruby_wasm"
end
rescue LoadError => e
task :compile do
$stderr.puts "Skipping compilation of ruby_wasm extension: #{e.message}"
Expand Down
Loading