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

Sh test gem action #221

Closed
wants to merge 12 commits into from
Closed
24 changes: 6 additions & 18 deletions .github/workflows/gem.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
name: Build and release gem

on:
workflow_dispatch:
push:
branches:
- main
tags:
- 'v*'

pull_request:

jobs:
native_gem:
Expand All @@ -21,7 +20,6 @@ jobs:
- "x86_64-darwin"
- "x86_64-linux-gnu"
- "x86_64-linux-musl"
- "x64-mingw32"
- "x64-mingw-ucrt"
environment: "yrb-deploy"
steps:
Expand All @@ -35,21 +33,11 @@ jobs:
cargo-cache: true
cargo-vendor: true

- name: Transform platform name
id: transform_platform
run: echo "cross_gem_platform=$(echo '${{ matrix.platform }}' | sed 's/-gnu$//')" >> $GITHUB_ENV

- uses: oxidize-rb/cross-gem-action@main
with:
platform: ${{ env.cross_gem_action_platform }}
version: 'latest'
env: |
RUBY_CC_VERSION=3.4.0:3.3.5:3.2.0:3.1.0

- uses: actions/download-artifact@v3
- uses: oxidize-rb/actions/cross-gem@v1
id: cross-gem
with:
name: cross-gem
path: pkg/
platform: ${{ matrix.platform }}
ruby-versions: '3.1,3.2,3.3,3.4'

- name: Display structure of built gems
run: ls -R
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-3.2.0
ruby-3.4.1
66 changes: 38 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 4 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

require "bundler/gem_tasks"
require "rubygems/package_task"
require "rake_compiler_dock"
require "rake/testtask"
require "rake/extensiontask"
require "rb_sys"

cross_rubies = %w[3.4.0 3.3.5 3.2.0 3.1.0]
ruby_cc_version = RakeCompilerDock.ruby_cc_version([">= 3.1", "< 3.5"])
cross_platforms = %w[
aarch64-linux-gnu
aarch64-linux-musl
Expand Down Expand Up @@ -41,15 +42,11 @@ namespace "gem" do
cross_platforms.each do |plat|
desc "Build the native gem for #{plat}"
task plat => "prepare" do
require "rake_compiler_dock"

# rbsys doesn't ship an alias -gnu image yet
rcd_plat = plat.gsub(/-gnu$/, '')
ENV["RCD_IMAGE"] = "rbsys/#{rcd_plat}:#{RbSys::VERSION}"
ENV["RCD_IMAGE"] = "rbsys/#{plat}:#{RbSys::VERSION}"

RakeCompilerDock.sh <<~SH, platform: plat
bundle && \
RUBY_CC_VERSION="#{cross_rubies.join(":")}" \
RUBY_CC_VERSION="#{ruby_cc_version}"
rake native:#{plat} pkg/#{spec.full_name}-#{plat}.gem
SH
end
Expand Down
3 changes: 1 addition & 2 deletions y-rb.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ Gem::Specification.new do |spec|
spec.metadata["rubygems_mfa_required"] = "true"

spec.add_dependency "rake", "~> 13.2"
spec.add_dependency "rb_sys", "~> 0.9.86"
spec.add_dependency "rb_sys", "~> 0.9.110"

spec.add_development_dependency "base64"
spec.add_development_dependency "rake-compiler", "~> 1.2.1"
spec.add_development_dependency "rake-compiler-dock", "~> 1.9.1"

spec.extensions = ["ext/yrb/extconf.rb"]
end
Loading