cibuildgem 0.2.2 โ 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -43
- data/lib/cibuildgem/cli.rb +12 -2
- data/lib/cibuildgem/compilation_tasks.rb +13 -12
- data/lib/cibuildgem/extension_patch.rb +7 -1
- data/lib/cibuildgem/tasks/wrapper.rake +2 -4
- data/lib/cibuildgem/templates/github/workflows/cibuildgem.yaml.tt +2 -0
- data/lib/cibuildgem/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f6f1f69c8bc8ebbbe053eab7e7d12d680c3cf2fce25720165e7bcf5340238eff
|
|
4
|
+
data.tar.gz: 1a9190614d8194c3bd972dda1bc559e42ee4b69ca7f1a61682fbb8b390f79b2c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a180af046d430b34fe5bd6173d8047d836d2cd623455fbf44a5001a8d51364df28f3ebee1a65b687091535784bd0efd9331a1ba32d54e65e6270738f88f062a1
|
|
7
|
+
data.tar.gz: c64afb34a1f9927bdb3821fcd281c7c5e6a469176ca14084969290520fde52d180a4cbcd0c918abec847063be42b9999d2daba93f56b586c0c6b571791180c42
|
data/README.md
CHANGED
|
@@ -22,49 +22,22 @@ As noted by [@flavorjones](https://github.com/flavorjones), this toolchain works
|
|
|
22
22
|
|
|
23
23
|
## ๐ป cibuildgem
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
> cibuildgem is for now not able to compile projects that needs to link on external libraries. Unless the project vendors those libraries or uses [mini_portile](https://github.com/flavorjones/mini_portile).
|
|
27
|
-
|
|
28
|
-
### How to use it
|
|
29
|
-
|
|
30
|
-
While cibuildgem is generally **not** meant to be used locally, it provides a command to generate the right GitHub workflow for your project:
|
|
31
|
-
|
|
32
|
-
1. Install cibuildgem: `gem install cibuildgem`
|
|
33
|
-
2. Generate the workflow: `cd` in your gem's folder and run `cibuildgem ci_template`
|
|
34
|
-
3. Commit the `.github/workflows/cibuildgem.yaml` file.
|
|
35
|
-
|
|
36
|
-
### Triggering the workflow
|
|
37
|
-
|
|
38
|
-
Once pushed in your repository **default** branch, the workflow that we just generated is actionable manually on the GitHub action page. It will run in sequence:
|
|
39
|
-
|
|
40
|
-
1. Compile the gem on the target platform (defaults to MacOS ARM, MacOS Intel, Windows, Ubuntu 24)
|
|
41
|
-
2. Once the compilation succeeds on all platform, it proceeds to run the test suite on the target platform. This will trigger many CI steps as the testing matrix is big.
|
|
42
|
-
3. Once the test suite passes for all platforms and all Ruby versions the gem is compatible with, the action proceeds to installing the gem we just packaged. This step ensure that the gem is actually installable.
|
|
43
|
-
4. [OPTIONAL] When trigering the workflow manually, you can tick the box to automatically release the gems that were packaged. This works using the RubyGems trusted publisher feature (documentation to write later). If you do no want the tool to make the release, you can download all the GitHub artifacts that were uploaded. It will contain all the gems with precompiled binaries in the `pkg` folder. You are free to download them locally and release them yourself from your machine.
|
|
25
|
+
Head to the [documentation Wiki](https://github.com/Shopify/cibuildgem/wiki) to setup and configure cibuildgem for your gem.
|
|
44
26
|
|
|
27
|
+
## Working examples
|
|
45
28
|
|
|
46
|
-
|
|
29
|
+
Here are some working examples on gem that have setup cibuildgem
|
|
47
30
|
|
|
48
|
-
|
|
49
|
-
|
|
31
|
+
| Name | Example Run | Published Gem |
|
|
32
|
+
|-----------|-------------|---------------|
|
|
33
|
+
| [Rubydex](https://github.com/shopify/rubydex) | [CI Run](https://github.com/Shopify/rubydex/actions/runs/21880161517) | [Gem](https://rubygems.org/gems/rubydex/versions/0.1.0.beta4-arm64-darwin) |
|
|
34
|
+
| [Heap Profiler](https://github.com/shopify/heap-profiler) | [CI Run](https://github.com/Shopify/heap-profiler/actions/runs/20996043558) | [Gem](https://rubygems.org/gems/heap-profiler/versions/0.8.0.rc1-x86_64-linux) |
|
|
35
|
+
| [djb2](https://github.com/Shopify/djb2) | [CI Run](https://github.com/Shopify/djb2/actions/runs/22188688549) | [Gem](https://rubygems.org/gems/djb2/versions/0.1.1-x86_64-linux) |
|
|
36
|
+
| [Blake3](https://github.com/Shopify/blake3-rb) | [CI Run](https://github.com/Shopify/blake3-rb/actions/runs/21253662535) | [Gem](https://rubygems.org/gems/blake3-rb/versions/1.5.6.rc1-x86_64-linux) |
|
|
37
|
+
| [Raindrops (fork)](https://github.com/Edouard-chin/raindrops) | [CI Run](https://github.com/Edouard-chin/raindrops/actions/runs/22045845221) | [Gem](https://rubygems.org/gems/precompiled-raindrops) |
|
|
38
|
+
| [Stack Frames](https://github.com/Shopify/stack_frames) | [CI Run](https://github.com/Shopify/stack_frames/actions/runs/19969899178) | [Gem](https://rubygems.org/gems/stack_frames/versions/0.1.4-x86_64-linux) |
|
|
50
39
|
|
|
51
|
-
|
|
52
|
-
# Before
|
|
53
|
-
|
|
54
|
-
require 'date_core.so'
|
|
55
|
-
|
|
56
|
-
# After
|
|
57
|
-
|
|
58
|
-
begin
|
|
59
|
-
ruby_version = /(\d+\.\d+)/.match(::RUBY_VERSION)
|
|
60
|
-
require "#{ruby_version}/date_core"
|
|
61
|
-
rescue LoadError
|
|
62
|
-
# It's important to leave for users that can not or don't want to use the gem with precompiled binaries.
|
|
63
|
-
require "date_core"
|
|
64
|
-
end
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### Supported platforms/Ruby versions
|
|
40
|
+
## Supported platforms/Ruby versions
|
|
68
41
|
|
|
69
42
|
| | MacOS Intel | MacOS ARM | Windows x64 UCRT | Linux GNU x86_64|Linux AARCH64 |
|
|
70
43
|
|---------|------------- | --------- | ------------|-----------------|-----------------|
|
|
@@ -72,7 +45,4 @@ end
|
|
|
72
45
|
| Ruby 3.2| ๐ข | ๐ข | ๐ข | ๐ข | ๐ข |
|
|
73
46
|
| Ruby 3.3| ๐ข | ๐ข | ๐ข | ๐ข | ๐ข |
|
|
74
47
|
| Ruby 3.4| ๐ข | ๐ข | ๐ข | ๐ข | ๐ข |
|
|
75
|
-
|
|
76
|
-
## ๐งช Development
|
|
77
|
-
|
|
78
|
-
If you'd like to run a end-to-end test, the `date` gem is vendored in this project. You can trigger a manual run to do the whole compile, test, install dance from the GitHub action menu.
|
|
48
|
+
| Ruby 4.0| ๐ข | ๐ข | ๐ (not tested)| ๐ข | ๐ข |
|
data/lib/cibuildgem/cli.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require "thor"
|
|
4
4
|
require "rake/extensiontask"
|
|
5
5
|
require "prism"
|
|
6
|
+
require "open3"
|
|
6
7
|
|
|
7
8
|
module Cibuildgem
|
|
8
9
|
class CLI < Thor
|
|
@@ -112,14 +113,23 @@ module Cibuildgem
|
|
|
112
113
|
pathname = Pathname(file)
|
|
113
114
|
next if pathname.directory? || pathname.extname != ".gem"
|
|
114
115
|
|
|
115
|
-
|
|
116
|
+
out, status = Open3.capture2e("gem push #{file}")
|
|
117
|
+
next if status.success?
|
|
118
|
+
|
|
119
|
+
if out =~ /Repushing of gem versions is not allowed/
|
|
120
|
+
puts "Gem #{file} already exists on RubyGems.org, skipping..."
|
|
121
|
+
|
|
122
|
+
next
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
raise out
|
|
116
126
|
end
|
|
117
127
|
end
|
|
118
128
|
|
|
119
129
|
desc "print_ruby_cc_version", "Output the cross compile ruby version needed for the gem. For internal usage", hide: true
|
|
120
130
|
method_option "gemspec", type: "string", required: false, desc: "The gemspec to use. If the option is not passed, a gemspec file from the current working directory will be used."
|
|
121
131
|
def print_ruby_cc_version
|
|
122
|
-
print(compilation_task.ruby_cc_version)
|
|
132
|
+
print(ENV["RUBY_CC_VERSION"] || compilation_task.ruby_cc_version)
|
|
123
133
|
end
|
|
124
134
|
|
|
125
135
|
desc "normalized_platform", "The platform name for compilation purposes", hide: true
|
|
@@ -17,8 +17,6 @@ module Cibuildgem
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def setup
|
|
20
|
-
Rake::ExtensionTask.enable!
|
|
21
|
-
|
|
22
20
|
gemspec.extensions.each do |path|
|
|
23
21
|
binary_name = parse_extconf(path)
|
|
24
22
|
define_task(path, binary_name)
|
|
@@ -54,16 +52,19 @@ module Cibuildgem
|
|
|
54
52
|
end
|
|
55
53
|
|
|
56
54
|
def define_task(path, binary_name)
|
|
57
|
-
@extension_task = Rake::ExtensionTask.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
@extension_task = Rake::ExtensionTask.current || Rake::ExtensionTask.new
|
|
56
|
+
|
|
57
|
+
@extension_task.name = File.basename(binary_name)
|
|
58
|
+
@extension_task.config_script = File.basename(path)
|
|
59
|
+
@extension_task.ext_dir = File.dirname(path)
|
|
60
|
+
@extension_task.lib_dir = binary_lib_dir(binary_name) if binary_lib_dir(binary_name)
|
|
61
|
+
@extension_task.gem_spec = gemspec
|
|
62
|
+
@extension_task.cross_platform = normalized_platform
|
|
63
|
+
@extension_task.cross_compile = true
|
|
64
|
+
@extension_task.no_native = true
|
|
65
|
+
|
|
66
|
+
Rake::ExtensionTask.enable!
|
|
67
|
+
@extension_task.define
|
|
67
68
|
|
|
68
69
|
disable_shared unless Gem.win_platform?
|
|
69
70
|
end
|
|
@@ -7,7 +7,7 @@ module Cibuildgem
|
|
|
7
7
|
class << self
|
|
8
8
|
def prepended(mod)
|
|
9
9
|
class << mod
|
|
10
|
-
attr_accessor :enabled
|
|
10
|
+
attr_accessor :enabled, :current
|
|
11
11
|
|
|
12
12
|
def enable!
|
|
13
13
|
@enabled = true
|
|
@@ -16,6 +16,12 @@ module Cibuildgem
|
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
def initialize(*)
|
|
20
|
+
super
|
|
21
|
+
|
|
22
|
+
self.class.current = self
|
|
23
|
+
end
|
|
24
|
+
|
|
19
25
|
def define
|
|
20
26
|
super if self.class.enabled
|
|
21
27
|
end
|
|
@@ -12,11 +12,9 @@ task "cibuildgem:setup" do
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
task "copy:stage:lib" do
|
|
15
|
-
|
|
16
|
-
dest = File.join(task.extension_task.lib_dir, version)
|
|
17
|
-
src = File.join("tmp", task.extension_task.cross_platform, "stage", dest)
|
|
15
|
+
src = File.join("tmp", task.extension_task.cross_platform, "stage")
|
|
18
16
|
|
|
19
|
-
cp_r(src,
|
|
17
|
+
cp_r(Dir.glob("#{src}/*"), ".", remove_destination: true)
|
|
20
18
|
end
|
|
21
19
|
|
|
22
20
|
unless Rake::Task.task_defined?(:test)
|
data/lib/cibuildgem/version.rb
CHANGED